[issue34492] Python/coreconfig.c: Missing NULL check in _Py_wstrlist_copy()

2018-08-24 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : The return value of PyMem_RawMalloc() is not checked for NULL at https://github.com/python/cpython/blob/ef8861c112ed1dac9351958c121bc24ca4ecdb08/Python/coreconfig.c#L71. Reported by Svace static analyzer. -- components: Interpreter Core messages

[issue34468] An always-false condition in range_repr() from Objects/rangeobject.c

2018-08-23 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Thank you, Brett, I've submitted a PR. -- ___ Python tracker <https://bugs.python.org/issue34468> ___ ___ Python-bugs-list m

[issue34468] An always-false condition in range_repr() from Objects/rangeobject.c

2018-08-23 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8357 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34468> ___ ___ Py

[issue34482] datetime: Tests for potential crashes due to non-UTF-8-encodable strings

2018-08-23 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- pull_requests: +8355 ___ Python tracker <https://bugs.python.org/issue34482> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34482] datetime: Tests for potential crashes due to non-UTF-8-encodable strings

2018-08-23 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8353 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34482> ___ ___ Py

[issue34454] datetime: NULL dereference in fromisoformat() on PyUnicode_AsUTF8AndSize() failure

2018-08-23 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- pull_requests: +8354 ___ Python tracker <https://bugs.python.org/issue34454> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34481] Different behavior of C and Python impls of datetime.strftime with non-UTF-8-encodable strings

2018-08-23 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : The C datetime implementation uses PyUnicode_AsUTF8AndSize() in wrap_strftime() and rejects strings containing surrogate code points (0xD800 - 0xDFFF) since they can't be encoded in UTF-8. On the other hand, the pure-Python datetime implementation

[issue34482] datetime: Tests for potential crashes due to non-UTF-8-encodable strings

2018-08-23 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : This is a follow-up of #34454. 'datetime' extension module attempts to encode input strings into UTF-8 in several places, which requires special care because some valid Python strings can't be represented in UTF-8. It makes sense to add more tests

[issue34477] Objects/typeobject.c: Missing NULL check in type_init()

2018-08-23 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8351 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34477> ___ ___ Py

[issue34477] Objects/typeobject.c: Missing NULL check in type_init()

2018-08-23 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : The return value of PyTuple_GetSlice() at https://github.com/python/cpython/blob/48ce4897f8f8d91d948ecd1241ffab002df2be9e/Objects/typeobject.c#L2297 is not checked for NULL and then dereferenced. Reported by Svace static analyzer. Currently

[issue34474] Python/bltinmodule.c: Missing NULL check in builtin_sum_impl()

2018-08-23 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8350 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34474> ___ ___ Py

[issue34474] Python/bltinmodule.c: Missing NULL check in builtin_sum_impl()

2018-08-23 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : The return value of PyFloat_FromDouble() at https://github.com/python/cpython/blob/48ce4897f8f8d91d948ecd1241ffab002df2be9e/Python/bltinmodule.c#L2403 is not checked for NULL and then dereferenced. Reported by Svace static analyzer. A similar issue

[issue34471] _datetime: Missing NULL check in tzinfo_from_isoformat_results()

2018-08-23 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8345 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34471> ___ ___ Py

[issue34471] _datetime: Missing NULL check in tzinfo_from_isoformat_results()

2018-08-23 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : The return value of new_delta() is not checked for NULL at https://github.com/python/cpython/blob/ccd99752675042bd5f67d332c5b0ed85ba1f2da3/Modules/_datetimemodule.c#L1292 and then dereferenced. Reported by Svace static analyzer. -- components

[issue34436] Overallocation is never disabled in _PyBytes_FormatEx()

2018-08-23 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Thank you for benchmarking and merging, Victor! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue34468] An always-false condition in range_repr() from Objects/rangeobject.c

2018-08-22 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : range_repr() contains the following snippet: /* Check for special case values for printing. We don't always need the step value. We don't care about errors (it means overflow), so clear the errors. */ istep = PyNumber_AsSsize_t(r

[issue34462] _xxsubinterpreters: Wrong NULL check in _copy_raw_string()

2018-08-22 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8337 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34462> ___ ___ Py

[issue34462] _xxsubinterpreters: Wrong NULL check in _copy_raw_string()

2018-08-22 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : The code at https://github.com/python/cpython/blob/28853a249b1d0c890b7e9ca345290bb8c1756446/Modules/_xxsubinterpretersmodule.c#L18 checks a wrong variable for NULL: const char *str = PyUnicode_AsUTF8(strobj); if (str == NULL) { return

[issue34456] pickle: Missing NULL check in save_global()

2018-08-22 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: No, I couldn't find any similar calls in save_global() in 2.7. However, there is Py_BuildValue() call in initcPickle(), and its result is passed unchecked to PyDict_SetItemString(), where it's eventually dereferenced. In fact, all PyDict_SetItemString

[issue34456] pickle: Missing NULL check in save_global()

2018-08-22 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: -Python 3.5 ___ Python tracker <https://bugs.python.or

[issue34457] Missing NULL check in alias_for_import_name() from Python/ast.c

2018-08-22 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- pull_requests: +8329 ___ Python tracker <https://bugs.python.org/issue34457> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34457] Missing NULL check in alias_for_import_name() from Python/ast.c

2018-08-21 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8324 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34457> ___ ___ Py

[issue34457] Missing NULL check in alias_for_import_name() from Python/ast.c

2018-08-21 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: The NULL dereference seems to be hard to trigger due to caching for one-character Latin-1 strings, but being safe probably won't hurt. -- ___ Python tracker <https://bugs.python.org/issue34

[issue34457] Missing NULL check in alias_for_import_name() from Python/ast.c

2018-08-21 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : The return value of PyUnicode_InternFromString() is dereferenced without checking at https://github.com/python/cpython/blob/ef8861c112ed1dac9351958c121bc24ca4ecdb08/Python/ast.c#L3256 Reported by Svace static analyzer. -- components: Interpreter

[issue34456] pickle: Missing NULL check in save_global()

2018-08-21 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8323 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34456> ___ ___ Py

[issue34456] pickle: Missing NULL check in save_global()

2018-08-21 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : The return value of Py_BuildValue() is dereferenced without checking at https://github.com/python/cpython/blob/ef8861c112ed1dac9351958c121bc24ca4ecdb08/Modules/_pickle.c#L3457 Reported by Svace static analyzer. -- components: Extension Modules

[issue34454] datetime: NULL dereference in fromisoformat() on PyUnicode_AsUTF8AndSize() failure

2018-08-21 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: I will be glad to rebase my PR and remove the try/except from the test if you remove the dependency of separator searching code on PyUnicode_AsUTF8AndSize() as you suggest. Or we can go the other way and merge mine first -- whatever you prefer. Note

[issue34454] datetime: NULL dereference in fromisoformat() on PyUnicode_AsUTF8AndSize() failure

2018-08-21 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8322 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34454> ___ ___ Py

[issue34454] datetime: NULL dereference in fromisoformat() on PyUnicode_AsUTF8AndSize() failure

2018-08-21 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : A failure of PyUnicode_AsUTF8AndSize() in various fromisoformat() functions in Modules/_datetimemodule.c leads to NULL dereference due to the missing check, e.g.: >>> from datetime import date >>> date.fromisoformat('\ud800') Segmen

[issue34441] NULL dereference when issubclass() is called on a class with bogus __subclasses__

2018-08-20 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue34441] NULL dereference when issubclass() is called on a class with bogus __subclasses__

2018-08-20 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8310 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34441> ___ ___ Py

[issue34441] NULL dereference when issubclass() is called on a class with bogus __subclasses__

2018-08-20 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : >>> from abc import ABCMeta >>> class S(metaclass=ABCMeta): ... __subclasses__ = None ... >>> issubclass(int, S) Segmentation fault (core dumped) This is the result of missing NULL check for 'subclasses' in _abc__abc_subclas

[issue34435] Missing NULL check in unicode_encode_ucs1()

2018-08-19 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Thank you for merging! -- resolution: -> fixed ___ Python tracker <https://bugs.python.org/issue34435> ___ ___ Python-

[issue34436] Overallocation is never disabled in _PyBytes_FormatEx()

2018-08-19 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8305 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34436> ___ ___ Py

[issue34436] Overallocation is never disabled in _PyBytes_FormatEx()

2018-08-19 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : The condition for disabling overallocation at 225b055/Objects/bytesobject.c:822 is always false. Reported by Svace static analyzer. -- components: Interpreter Core messages: 323763 nosy: inada.naoki, izbyshev, serhiy.storchaka, vstinner priority

[issue34435] Missing NULL check in unicode_encode_ucs1()

2018-08-19 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +8302 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34435> ___ ___ Py

[issue34435] Missing NULL check in unicode_encode_ucs1()

2018-08-19 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : A possible NULL return on out-of-memory condition at Objects/unicodeobject.c:6835 is not handled. Reported by Svace static analyzer. -- components: Interpreter Core messages: 323762 nosy: inada.naoki, izbyshev, serhiy.storchaka, vstinner priority

[issue32270] subprocess closes redirected fds even if they are in pass_fds

2018-04-11 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: An alternative fix is here: https://github.com/izbyshev/cpython/commit/b89b52f28490b69142d5c061604b3a3989cec66c Feel free to use the test if you don't like the approach :) -- ___

[issue32844] subprocess may incorrectly redirect a low fd to stderr if another low fd is closed

2018-03-26 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <https://bu

[issue32270] subprocess closes redirected fds even if they are in pass_fds

2018-03-25 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: Actually I've started to work on this with #32844, but got no feedback. This issue may of course be fixed independently, but the problems with descriptor ownership for fds <= 2 will remain unless all ownership problems are fixed

[issue33018] Improve issubclass() error checking and message

2018-03-10 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: I agree except that I'd like to see it in 3.7 too. -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue33018] Improve issubclass() error checking and message

2018-03-09 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: Regarding status quo (expanding the examples of @inada.naoki and @jab): >>> import typing >>> import collections.abc as cabc >>> issubclass(typing.Mapping, cabc.Mapping) Traceback (most recent call las

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: > We know that the path is valid because we have a handle (in this case the > file system ensures that no parent directory in the path can be unlinked or > renamed). Thank you for pointing this out. I erroneously stated

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: > unless users are not prepared to deal with it ARE prepared > What do you think about handling this failure by calling GetFullPathName > instead (e.g. "C:\Temp\NUL" => "\\.\NUL")? I think it w

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: > Because we only try VOLUME_NAME_DOS, this function always fails for a volume > that's not mounted as either a drive letter or a junction mount point. If a volume is not mounted, users have to use \\?\ or \\.\ eit

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: Copying the comment of @eryksun from PR 6010 for reference. Because we only try VOLUME_NAME_DOS, this function always fails for a volume that's not mounted as either a drive letter or a junction mount point. The error in thi

[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: @eryksun Very interesting! BTW, I looked at CreateFile docs, and the fact that it may set the last error to zero is even documented there. @steve.dower > maybe we don't have to preserve errno on Windows? There are still pla

[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: > Ideally, if we don't have to do any work to reacquire the GIL, we shouldn't > do any work to preserve the error code either. Before take_gil() knows whether it has to do any work, it calls MUTEX_LOCK(_PyRuntime.ceval.gil.m

[issue29871] Enable optimized locks on Windows

2018-03-08 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- nosy: +izbyshev ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue29871> ___ _

[issue32592] Drop support of Windows Vista in Python 3.7

2018-03-08 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- nosy: +izbyshev ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32592> ___ _

[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: FWIW, GetLastError() docs[1] officially scare us: Most functions that set the thread's last-error code set it when they fail. However, some functions also set the last-error code when they succeed. If the function is not docu

[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: PR 5944 changes ABC.__subclasscheck__ (not issubclass) to check its first argument, so if it's merged there will be no crash even with the revert. -- ___ Python tracker <rep...@bugs.p

[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: > Isn't it just a limitation? > Most Python-implemented objects supports weakref. I don't think "requiring > weakref support implies it must be type object". Formally, there is no implication. It is the ab

[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: I do not see any point in allowing non-types in ABCMeta.__subclasscheck__. Currently, ABCs are clearly not designed to support non-types: 1. ABCMeta.register() accepts types only. 2. ABCMeta.__subclasscheck__ implicitly requir

[issue33018] Improve issubclass() error checking and message

2018-03-07 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: ABC.register() has an explicit check, and it is mentioned in PEP 3119. The point here is not to change issubclass(), but to change ABC.__subclasscheck__(). It may conceivably have stricter requirements than issubclass

[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-07 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: Sorry for status update, this was due to a concurrent modification. -- nosy: +jab resolution: -> fixed status: open -> closed ___ Python tracker <rep...@bugs.pyt

[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-07 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: @inada.naoki: I don't question your change. My point is the same as in #33018 (I've discovered that PR only after I commented). The error message is misleading, and it's just a coincidence that a TypeError and not some other

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-06 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- keywords: +patch pull_requests: +5775 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-06 Thread Alexey Izbyshev
New submission from Alexey Izbyshev <izbys...@ispras.ru>: The first call of GetFinalPathNameByHandleW requests the required buffer size for the NT path (VOLUME_NAME_NT), while the second call receives the DOS path (VOLUME_NAME_DOS) in the allocated buffer. Usually, NT paths are longe

[issue33010] os.path.isdir() returns True for broken directory symlinks or junctions

2018-03-06 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: Hmm, actually, my NFS example is probably bad. I've run an experiment, and stat() simply hangs in the case if the NFS server is down. -- ___ Python tracker <rep...@bugs.python.or

[issue33010] os.path.isdir() returns True for broken directory symlinks or junctions

2018-03-06 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: Thank you for the detailed response, Eryk! > A mount point is always a directory, even if the volume isn't currently > available. Do I understand correctly that you propose to additionally change os.path.exists() to

[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: OK, making a new implementation behave as the old one is fine with me too. BTW, do TypeErrors related to weak references deserve any treatment? Isn't it a kind of coincidence that the error raised due to usage of WeakSet in issu

[issue33010] os.path.isdir() returns True for broken directory symlinks or junctions

2018-03-06 Thread Alexey Izbyshev
New submission from Alexey Izbyshev <izbys...@ispras.ru>: os.path.isdir() violates its own documentation by returning True for broken directory symlinks or junctions, for which os.path.exists() returns False: >>> os.mkdir('b') >>> import _winapi >&

[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-05 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- versions: +Python 3.7 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32999> ___

[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-05 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: I've also checked that ABC.register() doesn't allow non-classes (and PEP 3119 mentions that). Looking at PyObject_IsSubclass in Objects/abstract.c, the only case in which its check_class() could be avoided is if there is a

[issue33001] Buffer overflow vulnerability in os.symlink on Windows

2018-03-05 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: > As os.symlink requires administrative privileges on most versions of Windows The current implementation requires SeCreateSymbolicLinkPrivilege on ALL versions of Windows because users must pass an additional flag to CreateSym

[issue33001] Buffer overflow vulnerability in os.symlink on Windows

2018-03-05 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: While judging by the source code it seems that bytes in 3.5 should be fine, I've got a crash with the latest binary from python.org: Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32 Type

[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-05 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: > Is there any sense in accepting non-types as the first argument of > issubclass()? No, though it is not (clearly) documented. The docs mention TypeError, but only for the second argument if my reading is correct.

[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-05 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: In debug mode, the following assertion fails: python: ./Modules/_abc.c:642: _abc__abc_subclasscheck_impl: Assertion `((PyObject*)(mro))->ob_type))->tp_flags & ((1UL <&l

[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-05 Thread Alexey Izbyshev
New submission from Alexey Izbyshev <izbys...@ispras.ru>: Demo: >>> from abc import ABC >>> issubclass(1, ABC) Segmentation fault (core dumped) The stack trace is attached. Before reimplementation of abc in C, the result was confusing too: Python 3.6.4 (v3.6.4:d48ece

[issue32871] Interrupt .communicate() on SIGTERM/INT

2018-03-04 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: @ajk225 It may be useful to look at #25942 before working on this. -- nosy: +izbyshev ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue32903] os.chdir() may leak memory on Windows

2018-03-01 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- pull_requests: +5715 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32903> ___

[issue31512] Add non-elevated symlink support for dev mode Windows 10

2018-02-27 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- nosy: +izbyshev ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31512> ___ _

[issue23808] Symlink to directory on Windows 8

2018-02-26 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: This behavior is not specific to just Windows 8. Symlinks to directories are treated as directories on Windows, in particular, they should be removed with RemoveDirectory, not DeleteFile. Is there any reason this issue is stil

[issue32920] Implement PEP 529 for os.getcwdb on Windows

2018-02-23 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- nosy: +izbyshev ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32920> ___ _

[issue32907] pathlib: test_resolve_common fails on Windows

2018-02-22 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- keywords: +patch pull_requests: +5587 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue32907] pathlib: test_resolve_common fails on Windows

2018-02-22 Thread Alexey Izbyshev
New submission from Alexey Izbyshev <izbys...@ispras.ru>: == FAIL: test_resolve_common (test.test_pathlib.PathTest) -- Traceback (most recent call last):

[issue32904] os.chdir(), os.getcwd() may crash on Windows in presence of races

2018-02-21 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: The same issue applies to os.getcwd(). -- title: os.chdir() may crash on Windows in presence of races -> os.chdir(), os.getcwd() may crash on Windows in presence of races ___ Pytho

[issue32903] os.chdir() may leak memory on Windows

2018-02-21 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- versions: +Python 2.7 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32903> ___

[issue32904] os.chdir() may crash on Windows in presence of races

2018-02-21 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- keywords: +patch pull_requests: +5580 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue32904] os.chdir() may crash on Windows in presence of races

2018-02-21 Thread Alexey Izbyshev
New submission from Alexey Izbyshev <izbys...@ispras.ru>: win32_wchdir() retries GetCurrentDirectory() with a larger buffer if necessary, but doesn't check whether the new buffer is large enough. Another thread could change the current directory in meanwhile, so the buffer could tu

[issue32903] os.chdir() may leak memory on Windows

2018-02-21 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- keywords: +patch pull_requests: +5579 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue32903] os.chdir() may leak memory on Windows

2018-02-21 Thread Alexey Izbyshev
New submission from Alexey Izbyshev <izbys...@ispras.ru>: 'new_path' is not freed if the new directory is a UNC path longer than MAX_PATH. -- components: Extension Modules, Windows messages: 312522 nosy: izbyshev, paul.moore, steve.dower, tim.golden, vstinner, zach.ware priority:

[issue31106] os.posix_fallocate() generate exception with errno 0

2018-02-20 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: The failed test is test_posix_fallocate, not test_posix_fallocate_errno. The former special-cases Solaris for EINVAL already, and the latter merely passes an invalid descriptor. It seems that this particular issue is still ope

[issue32890] os: Some functions may report bogus errors on Windows

2018-02-20 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- keywords: +patch pull_requests: +5565 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue32890] os: Some functions may report bogus errors on Windows

2018-02-20 Thread Alexey Izbyshev
New submission from Alexey Izbyshev <izbys...@ispras.ru>: Demo: >>> os.execve('', ['a'], {}) Traceback (most recent call last): File "", line 1, in OSError: [WinError 0] The operation completed successfully: '' The reason is that path_error() used through

[issue32887] os: Users of path_converter don't handle fd == -1 properly

2018-02-20 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- nosy: +larry ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32887> ___ __

[issue32887] os: Users of path_converter don't handle fd == -1 properly

2018-02-20 Thread Alexey Izbyshev
New submission from Alexey Izbyshev <izbys...@ispras.ru>: Demo: >>> import os >>> os.chdir(-1) Traceback (most recent call last): File "", line 1, in OSError: [Errno 14] Bad address: -1 >>> os.chdir(-2) Traceback (most recent call last): File

[issue32849] Fatal Python error: Py_Initialize: can't initialize sys standard streams

2018-02-20 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- keywords: +patch pull_requests: +5552 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue32849] Fatal Python error: Py_Initialize: can't initialize sys standard streams

2018-02-20 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: > But I'm not sure why it can be solved, sometimes, by restarting the the > daemon. Could it be simply because daemon is respawned from a process that does have a valid stdin at the time of respawn? Note that daemon h

[issue32849] Fatal Python error: Py_Initialize: can't initialize sys standard streams

2018-02-19 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: OK, never mind with the test. I've finally got to a FreeBSD box and reproduced the problem. It has to do with 'revoke' feature of *BSD. When revoke is called on a terminal device (as part of logout process, for example), all descr

[issue32849] Fatal Python error: Py_Initialize: can't initialize sys standard streams

2018-02-19 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: > I think that we can even drop dup-based validation from is_valid_fd() For POSIX, that is. There is no fstat on Windows, and dup is probably OK there (or, even better, dup2(fd, fd) -- no need

[issue32849] Fatal Python error: Py_Initialize: can't initialize sys standard streams

2018-02-19 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: Thank you for checking. If this issue happens even when Python is run manually from an ordinary shell, fixing it in the same way as in #30225 is probably not what you want because while the error message will be gone the corresp

[issue32869] Incorrect dst buffer size for MultiByteToWideChar in _Py_fopen_obj

2018-02-18 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <https://bu

[issue32869] Incorrect dst buffer size for MultiByteToWideChar in _Py_fopen_obj

2018-02-18 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- keywords: +patch pull_requests: +5517 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue32869] Incorrect dst buffer size for MultiByteToWideChar in _Py_fopen_obj

2018-02-18 Thread Alexey Izbyshev
New submission from Alexey Izbyshev <izbys...@ispras.ru>: MultiByteToWideChar expects the destination buffer size to be given in wide characters, not bytes. This is currently not a real issue since _Py_fopen_obj is only used internally with mode being a short constant string in all call

[issue32862] os.dup2(fd, fd, inheritable=False) behaves inconsistently

2018-02-17 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: @eryksun: Thank you for the note! I've commented on #32865. This adds even more inconsistency to this corner case. -- ___ Python tracker <rep...@bugs.python.org> <https://

[issue32865] os.pipe creates inheritable FDs with a bad internal state on Windows

2018-02-17 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: >Also, it has to skip this check if the FD is flagged as a pipe, because a pipe >is likely opened in synchronous mode and blocked on a read in the parent, in >which case calling GetFileType would deadlock. Does an

[issue32849] Fatal Python error: Py_Initialize: can't initialize sys standard streams

2018-02-17 Thread Alexey Izbyshev
Alexey Izbyshev <izbys...@ispras.ru> added the comment: ktrace shows that dup(0) succeeded but fstat(0) failed. The symptom is the same as in #30225. Could you check whether any of the following quick tests produces the same error? python3 -c 'import os, subprocess, sys; r, w = o

[issue32862] os.dup2(fd, fd, inheritable=False) behaves inconsistently

2018-02-16 Thread Alexey Izbyshev
Change by Alexey Izbyshev <izbys...@ispras.ru>: -- keywords: +patch pull_requests: +5503 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

<    1   2   3   4   >