[issue35823] Use vfork() in subprocess on Linux

2019-01-24 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch, patch, patch pull_requests: +11484, 11485, 11486 stage: -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue35823] Use vfork() in subprocess on Linux

2019-01-24 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +11484 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35823> ___ _

[issue35823] Use vfork() in subprocess on Linux

2019-01-24 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch, patch pull_requests: +11484, 11485 stage: -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue35537] use os.posix_spawn in subprocess

2019-01-24 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: > Is sys.platform equal to 'linux' on WSL? Sorry, I don't know WSL. If it's > equal, is it possible to explicitly exclude WSL in the subprocess test, > _use_posix_spawn()? I don't have immediate access to WSL righ

[issue35823] Use vfork() in subprocess on Linux

2019-01-25 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: > W.r.t. closing all file descriptors > 2: posix_spawn_file_actions_addclose > can do this when using posix_spawn. That would have a performance cost, you'd > basically have to resort to closing all possible file descriptors and cannot

[issue35823] Use vfork() in subprocess on Linux

2019-01-26 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: I've checked subprocess.Popen() error reporting in QEMU user-mode and WSL and confirm that it works both with my patch (vfork/exec) and the traditional fork/exec, but doesn't work with glibc's posix_spawn. The first command below u

[issue35823] Use vfork() in subprocess on Linux

2019-01-29 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Thank you for the review and your thoughts, Gregory. > With this in place we may want to make the _use_posix_spawn() logic in > subprocess.py stricter? That could be its own followup PR. Yes, I think we can always use vfork() on Linux unless we fin

[issue35823] Use vfork() in subprocess on Linux

2019-01-30 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: I've been struggling with fixing spurious -Wclobbered GCC warnings. Originally, I've got the following: /scratch2/izbyshev/cpython/Modules/_posixsubprocess.c: In function ‘subprocess_fork_exec’: /scratch2/izbyshev/cpython/Modules/_posixsubproces

[issue35972] _xxsubinterpreters: channel_send() may truncate ints on 32-bit platforms

2019-02-11 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : Victor Stinner pointed out that on x86 Gentoo Installed with X 3.x buildbot, there is a compiler warning: Python/pystate.c:1483:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] (https://buildbot.python.org/all

[issue35972] _xxsubinterpreters: channel_send() may truncate ints on 32-bit platforms

2019-02-11 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +11852 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35972> ___ _

[issue35972] _xxsubinterpreters: channel_send() may truncate ints on 32-bit platforms

2019-02-12 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: "long long" is mandated to be at least 64-bit by C99 (5.2.4.2.1 Sizes of integer types). If it were 32-bit, no warnings would have been issued. -- ___ Python tracker <https://bugs.python.o

[issue35984] test__xxsubinterpreters leaked [3, 4, 3] memory blocks, sum=1

2019-02-13 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: I'll look into it later today. An obvious guess is that my test simply exposed an existing leak because the exception code path wasn't tested before AFAIK, but I need to check it. -- assignee: -

[issue35984] test__xxsubinterpreters leaked [3, 4, 3] memory blocks, sum=1

2019-02-13 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +11876 stage: test needed -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue35984] test__xxsubinterpreters leaked [3, 4, 3] memory blocks, sum=1

2019-02-13 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Thank you for your introduction about _xxsubinterpreters, Eric. This particular leak is easy: it's right in _channel_send(). I've submitted a PR. I've also done a quick scan of neighboring code, and it seems there are other lea

[issue36034] Suprise halt caused by -Werror=implicit-function-declaration in ./Modules/posixmodule.c

2019-02-19 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: I don't know what you mean by "in-line" pre-processing output, but you can use -E option to get the normal preprocessor output. Line directives will tell you where those functions come from on a system where there is no compilation error.

[issue36046] support dropping privileges when running subprocesses

2019-02-20 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- nosy: +izbyshev ___ Python tracker <https://bugs.python.org/issue36046> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36067] subprocess terminate() "invalid handle" error when process is gone

2019-02-22 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: > Interesting. Because both errors/conditions are mapped to > ERROR_INVALID_HANDLE we need the creation time. I can work on a patch for > that. I don't understand why any patch for CPython is needed at all. Using invalid handles is a serio

[issue36046] support dropping privileges when running subprocesses

2019-02-22 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- assignee: -> gregory.p.smith ___ Python tracker <https://bugs.python.org/issue36046> ___ ___ Python-bugs-list mailing list Un

[issue36046] support dropping privileges when running subprocesses

2019-02-22 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Patrick, could you provide more background that would explain your choice of setreuid/setregid functions and the desired handling of supplementary groups? I'm not a security expert, so I may not have sufficient expertise to judge on that, but may

[issue36046] support dropping privileges when running subprocesses

2019-02-26 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: > 1) This is intentional, this is for dropping privileges before running some > (possibly untrusted) command, we do not want to leave a path for the > subprocess to gain root back. If there is a subprocess that needs root for > some operatio

[issue31904] Python should support VxWorks RTOS

2019-03-02 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- nosy: +izbyshev ___ Python tracker <https://bugs.python.org/issue31904> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32236] open() shouldn't silently ignore buffering=1 in binary mode

2018-01-25 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Any feedback on the updated PR? -- ___ Python tracker <https://bugs.python.org/issue32236> ___ ___ Python-bugs-list mailin

[issue32256] Make patchcheck.py work for out-of-tree builds

2018-01-25 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Any objections to the PR? -- nosy: +belopolsky, eric.araujo ___ Python tracker <https://bugs.python.org/issue32256> ___ ___

[issue32777] subprocess: child_exec() uses _Py_set_inheritable() which is not async-signal-safe

2018-02-05 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : _Py_set_inheritable() raises a Python-level exception on error and thus is not async-signal-safe, but child_exec() must use only async-signal-safe functions because it's executed between fork() and exec(). Since a non-raising version is al

[issue32777] subprocess: child_exec() uses _Py_set_inheritable() which is not async-signal-safe

2018-02-05 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +5382 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32777> ___ ___ Py

[issue32777] subprocess: child_exec() uses _Py_set_inheritable() which is not async-signal-safe

2018-02-05 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: > out of curiosity, did you actually diagnose a process deadlocked due to this > or was it noted via code inspection? The latter. I noted it while working on another issue. While it was easy to trigger a malloc() in child_exec() by e.g. specify

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

2018-02-14 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : When redirecting, subprocess attempts to achieve the following state: each fd to be redirected to is less than or equal to the fd it is redirected from, which is necessary because redirection occurs in the ascending order of destination descriptors. It

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

2018-02-14 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +5482 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32844> ___ ___ Py

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

2018-02-14 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Note that the PR doesn't attempt to fix leaking of low dup'ed fds to the child. I'll file a separate report for that in a while. -- ___ Python tracker <https://bugs.pyt

[issue32859] os.dup2() tests dup3() availability on each call

2018-02-16 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : os.dup2() tests for dup3() system call availability at runtime, but doesn't remember the result across calls, repeating the test on each call with inheritable=False even if the test fails. Judging by the code, 'dup3_works' was intended to

[issue32859] os.dup2() tests dup3() availability on each call

2018-02-16 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +5497 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32859> ___ ___ Py

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

2018-02-16 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : os.dup2(fd, fd, inheritable=False) may fail or change fd inheritability in following ways: 1) POSIX without F_DUP2FD_CLOEXEC 1.1) dup3() is available (a common case for Linux): OSError (EINVAL, dup3() doesn't allow equal descriptors) 1.2) dup3() i

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

2018-02-16 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +5503 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32862> ___ ___ Py

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

2018-02-17 Thread Alexey Izbyshev
Alexey Izbyshev 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 = os.pipe(); os.cl

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

2018-02-17 Thread Alexey Izbyshev
Alexey Izbyshev 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 FD get flagged as a pipe b

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

2018-02-17 Thread Alexey Izbyshev
Alexey Izbyshev 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 <https://bugs.python.org/is

[issue32869] Incorrect dst buffer size for MultiByteToWideChar in _Py_fopen_obj

2018-02-18 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : 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 sites I've

[issue32869] Incorrect dst buffer size for MultiByteToWideChar in _Py_fopen_obj

2018-02-18 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +5517 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32869> ___ ___ Py

[issue32869] Incorrect dst buffer size for MultiByteToWideChar in _Py_fopen_obj

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

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

2018-02-19 Thread Alexey Izbyshev
Alexey Izbyshev 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 corresponding std stream will be

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

2018-02-19 Thread Alexey Izbyshev
Alexey Izbyshev 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 to cl

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

2018-02-19 Thread Alexey Izbyshev
Alexey Izbyshev 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 descriptors ass

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

2018-02-20 Thread Alexey Izbyshev
Alexey Izbyshev 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 has an option to redirect std

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

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

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

2018-02-20 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : 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 "", line 1,

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

2018-02-20 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- nosy: +larry ___ Python tracker <https://bugs.python.org/issue32887> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2018-02-20 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : 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 throughout

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

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

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

2018-02-20 Thread Alexey Izbyshev
Alexey Izbyshev 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 open only because there is no NEWS

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

2018-02-21 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : '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: normal severi

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

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

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

2018-02-21 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : 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 turn out to be still not

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

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

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

2018-02-21 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- versions: +Python 2.7 ___ Python tracker <https://bugs.python.org/issue32903> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2018-02-21 Thread Alexey Izbyshev
Alexey Izbyshev 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 ___ Python tracker <

[issue32907] pathlib: test_resolve_common fails on Windows

2018-02-22 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : == FAIL: test_resolve_common (test.test_pathlib.PathTest) -- Traceback (most recent call last): File "C:\work

[issue32907] pathlib: test_resolve_common fails on Windows

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

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

2018-02-23 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- nosy: +izbyshev ___ Python tracker <https://bugs.python.org/issue32920> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23808] Symlink to directory on Windows 8

2018-02-26 Thread Alexey Izbyshev
Alexey Izbyshev 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 still open? -- nosy

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

2018-02-27 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- nosy: +izbyshev ___ Python tracker <https://bugs.python.org/issue31512> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2018-03-01 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- pull_requests: +5715 ___ Python tracker <https://bugs.python.org/issue32903> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

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

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

2018-03-05 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : 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:d48eceb, Dec 19 2017, 06:54:40)

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

2018-03-05 Thread Alexey Izbyshev
Alexey Izbyshev 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 << 26))) != 0)' failed. -- _

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

2018-03-05 Thread Alexey Izbyshev
Alexey Izbyshev 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. In practice, issubclass() ra

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

2018-03-05 Thread Alexey Izbyshev
Alexey Izbyshev 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 "help", "

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

2018-03-05 Thread Alexey Izbyshev
Alexey Izbyshev 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 CreateSymbolicLink to enable

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

2018-03-05 Thread Alexey Izbyshev
Alexey Izbyshev 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 custom __subcl

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

2018-03-05 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- versions: +Python 3.7 ___ Python tracker <https://bugs.python.org/issue32999> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2018-03-06 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : 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 >>> _winapi.Cre

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

2018-03-06 Thread Alexey Izbyshev
Alexey Izbyshev 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 issubclass(obj, ABC) is wh

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

2018-03-06 Thread Alexey Izbyshev
Alexey Izbyshev 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 return True for mount

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

2018-03-06 Thread Alexey Izbyshev
Alexey Izbyshev 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 <https://bugs.python.org/is

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-06 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : 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 longer than DOS ones, for example

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-06 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +5775 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue33016> ___ ___ Py

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

2018-03-07 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Sorry for status update, this was due to a concurrent modification. -- nosy: +jab resolution: -> fixed status: open -> closed ___ Python tracker <https://bugs.python.org/i

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

2018-03-07 Thread Alexey Izbyshev
Alexey Izbyshev 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 error is

[issue33018] Improve issubclass() error checking and message

2018-03-07 Thread Alexey Izbyshev
Alexey Izbyshev 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() has. But certainly an advice from

[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev 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 requires its arguments to support weak

[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev 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 abc module authors who

[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev 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 <https://bugs.python.org/is

[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev 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 documented to set the last-

[issue32592] Drop support of Windows Vista in Python 3.7

2018-03-08 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- nosy: +izbyshev ___ Python tracker <https://bugs.python.org/issue32592> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue29871] Enable optimized locks on Windows

2018-03-08 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- nosy: +izbyshev ___ Python tracker <https://bugs.python.org/issue29871> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev 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.mutex),

[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev 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 places where errno is relied

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev 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 this case is ERROR_PATH_NOT_

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev 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 \\.\ either directly or indirectly via a

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev 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 would indeed be nice if pathlib h

[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev
Alexey Izbyshev 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 that the length of the p

[issue33018] Improve issubclass() error checking and message

2018-03-09 Thread Alexey Izbyshev
Alexey Izbyshev 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 last): File ""

[issue33018] Improve issubclass() error checking and message

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

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

2018-03-25 Thread Alexey Izbyshev
Alexey Izbyshev 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

[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 : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

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

2018-04-11 Thread Alexey Izbyshev
Alexey Izbyshev 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 :) -- ___ Python tracker &

[issue13322] buffered read() and write() does not raise BlockingIOError

2017-12-06 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: For added fun: at least one part of the standard library doesn't expect None returns from read() in the buffering layer. >>> import os >>> r, w = os.pipe2(os.O_NONBLOCK) >>> f = os.fdopen(r, 'r') >>>

[issue13322] buffered read() and write() does not raise BlockingIOError

2017-12-06 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Yes, your claim is confirmed by the fact that there have been little interest in this issue since 2011. Still, non-blocking behavior is incorrectly specified in the docs and is inconsistent (as investigated by Martin). And obscure errors like in my example

[issue32236] open() shouldn't silently ignore buffering=1 in binary mode

2017-12-06 Thread Alexey Izbyshev
New submission from Alexey Izbyshev : The fact that "buffering=1" is usable only in text mode is documented for open(). In binary mode, setting buffering to 1 is silently ignored and equivalent to using default buffer size. I argue that such behavior is: 1. Inconsistent For example

[issue30718] open builtin function: specifying the size of buffer has no effect for text files

2017-12-06 Thread Alexey Izbyshev
Alexey Izbyshev added the comment: Yes, clarifying buffering for text mode in open() would be nice. @direprobs: just in case you didn't know, you can achieve what you want with something like the following in pre-3.7: with open("/dev/null", "wb&quo

[issue32256] Make patchcheck.py work for out-of-tree builds

2017-12-08 Thread Alexey Izbyshev
Change by Alexey Izbyshev : -- keywords: +patch pull_requests: +4663 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32256> ___ ___ Py

<    1   2   3   4   >