[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-06-23 Thread Eryk Sun
Eryk Sun added the comment: > 1) disable _cleanup, _active, and remove _internal_poll() for windows _active only gets appended to in __del__. We can skip the entire body of __del__. Also, calling _cleanup can be skipped in __init__. _internal_poll is required for poll(). 2) ignore EB

[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-06-25 Thread Eryk Sun
Eryk Sun added the comment: > One issue on Linux is that the zombie process keeps the pid used until > the parent reads the child exit status, and Linux pids are limited to > 32768 by default. Windows allocates Process and Thread IDs out of a kernel handle table, which can grow t

[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-06-26 Thread Eryk Sun
Eryk Sun added the comment: > The process is not polled to be able to emit the warning in more > cases, again, to ease debug. It emits an incorrect warning if the process has already exited: "subprocess %s is still running". This can be rectified. Here's my current un

[issue37412] os.getcwdb() doesn't implement PEP 528 (UTF-8) on Windows

2019-06-26 Thread Eryk Sun
Eryk Sun added the comment: This update breaks long-path support in Windows. It includes the following unnecessary check, which is using the wrong comparison operator: if (len >= PY_SSIZE_T_MAX / sizeof(wchar_t)) PyMem_RawMalloc already checks this and returns NULL if s

[issue37426] getpass.getpass not working with on windows when ctrl+v is used to enter the string

2019-06-27 Thread Eryk Sun
Eryk Sun added the comment: getpass() reads from the console via msvcrt.getwch(). This is a raw console read, so Ctrl+V is read as the SYN (0x16) control character. Only the following keys are handled specially by getpass: * Ctrl+C - raise KeyboardInterrupt * Ctrl+H (backspace) - delete

[issue37369] Issue with pip in venv on Powershell in Windows

2019-06-27 Thread Eryk Sun
Eryk Sun added the comment: > you should go through your current user's apps directory > (C:\Users\name\AppData\Local\Microsoft\WindowsApps\, > which contains only symlinks to the actual executables). "%LocalAppData%\Microsoft\WindowsApps" contains IO_REPARSE_TAG_APP

[issue37452] Microsoft store package has an invalid ExecutablePath registry entry

2019-06-30 Thread Eryk Sun
Eryk Sun added the comment: > The expected behavior would be to have it point to > "%LOCALAPPDATA%\Microsoft\WindowsApps\Python37.exe" (or something > else that's reasonable) since PEP514 requires it to be an actual > executable. This appears to be a duplicate

[issue37453] Symlink creation on Windows should work without privilege escalation

2019-06-30 Thread Eryk Sun
Eryk Sun added the comment: FYI, this only works when the system is in developer mode. If you want authenticated users and non-elevated administrators to have symlink rights in applications that haven't been updated to use this flag, or without enabling developer mode, grant the rig

[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-07-01 Thread Eryk Sun
Eryk Sun added the comment: >> If one of the processes in that list is gone, then (...) "The handle >> is invalid" (...) will prevent you from creating any new processes >> with Popen after that > > It's the first time that I see such bug report. I

[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-07-01 Thread Eryk Sun
Eryk Sun added the comment: >> subprocess._active[0]._handle.Close() > > Why would you do that? You should not access the private _active list, > nor access the private _handle attribute. I understand that it's a way > to trigger such bug, but is it possible to t

[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-07-01 Thread Eryk Sun
Eryk Sun added the comment: > Without accessing private attributes, I don't see how someone can > discover the private handle. So for me, it's more a serious bug in an > application, no? Blindly closing random handles doesn't sound like a > good idea to me. Say a

[issue22107] tempfile module misinterprets access denied error on Windows

2019-07-01 Thread Eryk Sun
Eryk Sun added the comment: CanAccessFolder is incomplete for the following reasons: (1) It doesn't account for SeBackupPrivilege (read and execute access) and SeRestorePrivilege (write and delete access). If a create or open call requests backup semantics, these two privileges are ch

[issue36085] Enable better DLL resolution

2019-07-05 Thread Eryk Sun
Eryk Sun added the comment: Steve, in what's new and the installer, you've referenced KB2533625 instead of KB2533623. Do we have to open a new issue for this minor search and replace fix? -- ___ Python tracker <https://bugs.python.o

[issue37515] `open("aux.txt", "w")` fails unexpectedly with FileNotFoundError on Windows

2019-07-06 Thread Eryk Sun
Eryk Sun added the comment: DOS device names are reserved in the final component of DOS drive-letter paths. "AUX" (plus an optional colon, spaces, or extension) becomes "\\.\AUX", which is "\??\AUX" in the NT object namespace. By default, "\??\AUX"

[issue37517] Improve error messages for Windows reserved file names

2019-07-06 Thread Eryk Sun
Eryk Sun added the comment: > Perhaps Windows builds can check for reserved file names and give a > more descriptive error message in the event of IO error? An operation on a reserved DOS device name can also succeed with unexpected results. For example, a script may unintentionally wr

[issue37528] test_tarfile: test_extractall_symlinks() fails on Windows with: [WinError 206] The filename or extension is too long

2019-07-09 Thread Eryk Sun
Eryk Sun added the comment: If you want to harden the test for Windows, you could transform TEMPDIR into an extended path. os.path._getfinalpathname always returns an extended path. For example: >>> os.path._getfinalpathname('C:/Temp') '?\\C:

[issue37536] ctypes.create_string_buffer fails on windows with non-BMP characters

2019-07-09 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> create_unicode_buffer() fails on non-BMP strings on Windows ___ Python tracker <https://bugs.python

[issue37517] Improve error messages for Windows reserved file names

2019-07-10 Thread Eryk Sun
Eryk Sun added the comment: > if the operation succeeds, no error/message is displayed Some errors pass silently and may be confusing later on. For example, CreateDirectoryW calls NtCreateFile with the disposition FILE_CREATE and the option FILE_DIRECTORY_FILE (i.e. the call *must* creat

[issue37549] os.dup() fails for standard streams on Windows 7

2019-07-10 Thread Eryk Sun
Eryk Sun added the comment: > OSError: [WinError 87] The parameter is incorrect This error didn't originate from the C dup() call, since that would be based on errno, like `OSError: [Errno 9] Bad file descriptor`. It must come from _Py_set_inheritable. The only WINAPI call

[issue37549] os.dup() fails for standard streams on Windows 7

2019-07-11 Thread Eryk Sun
Eryk Sun added the comment: > os.dup() doc says: "On Windows, when duplicating a standard stream > (0: stdin, 1: stdout, 2: stderr), the new file descriptor is > inheritable." That's not necessarily correct. For example, if stdout is a pipe or disk file: C:\>

[issue37609] support "UNC" device paths in ntpath.splitdrive

2019-07-17 Thread Eryk Sun
New submission from Eryk Sun : Windows Python includes UNC shares such as "//server/spam" in its definition of a drive. This is natural because Windows supports setting a UNC path as the working directory and handles the share component as the working drive when resolving rooted

[issue37612] os.link(..., follow_symlinks=True) broken on Linux

2019-07-18 Thread Eryk Sun
Eryk Sun added the comment: > on Windows (where there is no linkat()) os.link() creates a new link > to the symbolic link itself. Yes, CreateHardLinkW opens the source file by calling NtOpenFile with the option FILE_OPEN_REPARSE_POINT. So the behavior is follow_symlinks=False.

[issue37659] subprocess.list2cmdline() should not escape wrapping single/double quotes

2019-07-23 Thread Eryk Sun
Eryk Sun added the comment: The behavior of list2cmdline with double quotes is intentional. It supports passing literal quote characters in the command line for applications that use VC++ argv parsing, WINAPI CommandLineToArgvW, or in general any application that adheres to these rules when

[issue19809] Doc: subprocess should warn uses on race conditions when multiple threads spawn child processes

2019-07-24 Thread Eryk Sun
Eryk Sun added the comment: > This is still the case on windows as the pipes created to talk to the > process might be inherited by two or more simultaneous CreateProcess > calls. subprocess already uses PROC_THREAD_ATTRIBUTE_HANDLE_LIST to address this problem, at least betwee

[issue37686] No error message in joining two root directories

2019-07-25 Thread Eryk Sun
Eryk Sun added the comment: The behavior in question is documented as follows: "If a component is an absolute path, all previous components are thrown away and joining continues from the absolute path component." In Windows, this is extended to support drives and the six file-

[issue37705] winerror_to_errno implementation

2019-07-29 Thread Eryk Sun
New submission from Eryk Sun : OSError and _Py_fstat_noraise rely on winerror_to_errno() in PC/errmap.h in order to translate a Windows system error code into a POSIX errno value. PC/errmap.h is supposed to be generated by PC/generrmap.c, which is based on the old CRT's _dosma

[issue37549] os.dup() fails for standard streams on Windows 7

2019-07-29 Thread Eryk Sun
Eryk Sun added the comment: > It sounds like we should probably revert to the middle ground, and > skip _raising the error_ if _Py_set_inheritable for files of type > FILE_TYPE_CHAR. The problem is just console pseudohandles in Windows 7 and earlier. Maybe it should just check

[issue37705] winerror_to_errno implementation

2019-07-30 Thread Eryk Sun
Eryk Sun added the comment: Special casing of Winsock error codes should be handled in winerror_to_errno rather than in oserror_parse_args, so it's consistently applied everywhere. And it should use the proper range for Winsock, 1-11999 -- not 1-2147483647. Codes above the Wi

[issue37728] 'is' behaving differently in script and interactive shel

2019-07-31 Thread Eryk Sun
Eryk Sun added the comment: The CPython interpreter doesn't centrally cache and reuse float objects, and even if it did that would be an implementation detail, like what it does with small int objects and strings. What you're seeing at the module level is a compilation side e

[issue2920] Patch to print symbolic value of errno in OSError.__str__()

2019-07-31 Thread Eryk Sun
Eryk Sun added the comment: How about doing something similar for Windows when winerror is set? This is a common case since many os functions use the Windows API directly. Showing the symbolic error name will help to disambiguate exceptions, such as FileNotFoundError (ENOENT) from

[issue37746] Provide Windows predefined access type constants

2019-08-02 Thread Eryk Sun
Eryk Sun added the comment: The STANDARD_RIGHTS_* and SPECIFIC_RIGHTS_ALL constants aren't used much in practice. Do you have a particular case that needs them? I don't think we have direct use for the standard rights constants in winreg. For example, deleting a key via winreg.D

[issue37746] Provide Windows predefined access type constants

2019-08-02 Thread Eryk Sun
Eryk Sun added the comment: > Perhaps _winapi is the best place? It already includes CreateFile and > OpenProcess, both of which also use these flags and already have some > of the "preconstructed" values exposed. I'd like to see an os.windows namespace, with

[issue37769] Windows Store installer should warn user about MAX_PATH

2019-08-05 Thread Eryk Sun
Eryk Sun added the comment: > First it seems the error is being raised incorrectly - winerror 2 is > for file not found, but it's being passed as errno 2. I think this only happens with open(). The _io module could use the CRT's _doserr

[issue37769] Windows Store installer should warn user about MAX_PATH

2019-08-05 Thread Eryk Sun
Eryk Sun added the comment: > I think this only happens with open(). Well, and everything else that calls a CRT function and relies on errno, such as C read() and write(). Though we'd have to look through on a case-by-case basis to ensure that _doserrno is valid in each case, i

[issue31226] shutil.rmtree fails when target has an internal directory junction (Windows)

2019-08-06 Thread Eryk Sun
Eryk Sun added the comment: > Junctions are sometimes used as links (e.g. mklink /j) and sometimes > as volume mount points (e.g. mountvol.exe). That people sometimes use junctions as if they're symlinks doesn't mean that we should pretend it's tru

[issue31226] shutil.rmtree fails when target has an internal directory junction (Windows)

2019-08-09 Thread Eryk Sun
Eryk Sun added the comment: > Thanks for the detailed explanation Eryk. While it is a little > annoying that it comes 2 years after the initial proposed > solution, I'll happily take that if the end result is a better fix :) Mea culpa. I am sorry about that. I do respect you

[issue37801] Compilation on MINGW64 fails (CODESET,wcstok,...)

2019-08-09 Thread Eryk Sun
Eryk Sun added the comment: I wasn't aware that CPython builds for MSYS2 out of the box, since it's a POSIX-on-Windows platform like Cygwin. Apparently there are patches that enable it to build, since MSYS2 has Python available. For Windows, WCSTOK expands to wcstok_s, which takes

[issue37756] Error 0x80070643 when installing

2019-08-10 Thread Eryk Sun
Eryk Sun added the comment: If we see 0x8XXX_, it's either an NTSTATUS [1] warning, which is unlikely, or and HRESULT [2] error, which is very likely. One of the more common facility codes for HRESULT is the Windows API, 0x007. If we see 0x8007, then is a Windows system

[issue37834] readlink on Windows cannot read app exec links

2019-08-12 Thread Eryk Sun
Eryk Sun added the comment: Symlinks are specially interpreted by the file API, I/O manager, and network redirector. So I think they should remain a separate category. readlink() and is_link() should be reserved for POSIX symlinks, i.e. only IO_REPARSE_TAG_SYMLINK. These app-exec reparse

[issue37834] readlink on Windows cannot read app exec links

2019-08-12 Thread Eryk Sun
Eryk Sun added the comment: > How about adding a separate function such as nt.read_reparse_point() If we support reading junctions, this should be using the substitute name (with \??\ replaced by \\?\) instead of the print name. For both symlinks and junctions, [MS-FSCC] 2.1.2 states t

[issue37831] bool(~True) == True

2019-08-12 Thread Eryk Sun
Eryk Sun added the comment: We could extend bool with shades of grey that close the 2-bit, signed set over the complement: {-2, -1, 0, 1}. For example, the bitwise complement of False could be RealNews (-1, 0x11) and the bitwise complement of True could be FakeNews (-2, 0x10). The bool

[issue30641] No way to specify "File name too long" error in except statement.

2017-06-12 Thread Eryk Sun
Eryk Sun added the comment: An exception specifically for ENAMETOOLONG would be limited to Unix systems. The Windows CRT defines ENAMETOOLONG but doesn't use it. Windows file systems do not return a specific status code for a filename that's too long. Per MS-FSA 2.1.5.1 [1], a reque

[issue30684] datetime.fromtimestamp raises OSError on first day after epoch on Windows

2017-06-16 Thread Eryk Sun
Eryk Sun added the comment: This is due to computing the PEP 495 fold in the function datetime_from_timet_and_us in Modules/_datetimemodule.c. It computes the local time for (timet - max_fold_seconds), which is negative for timestamps less than max_fold_seconds (86400). It's documented

[issue29702] Error 0x80070003: Failed to launch elevated child process

2017-06-17 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: out of date -> third party stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.or

[issue29366] os.listdir has inconsistent behavior when run on a non-directory

2017-06-18 Thread Eryk Sun
Eryk Sun added the comment: Yes, I think this issue should be closed. But for the record I'd like to note a not uncommon case in which listdir() raise FileNotFoundError on Windows. According to MS-FSA [1], if a request to open a directory resolves to a file, the operation should fail

[issue30725] Windows installer for 2.7.13 doesn't install pip when installing to C:\Program Files

2017-06-22 Thread Eryk Sun
Eryk Sun added the comment: Issue 27888 switched to using WiX CAQuietExec task to hide the console, but it also changed the action flags to no longer include msidbCustomActionTypeNoImpersonate (2048). Without this flag, the installer impersonates the user for these custom actions: UpdatePip

[issue30725] Windows installer for 2.7.13 doesn't install pip when installing to C:\Program Files

2017-06-22 Thread Eryk Sun
Eryk Sun added the comment: You can still create and use virtual environments (virtualenv) without requiring administrator access. -- ___ Python tracker <http://bugs.python.org/issue30

[issue30738] __next__() method in iterators 9.9

2017-06-22 Thread Eryk Sun
Eryk Sun added the comment: Did you try the example in Python 2? Did you click on the "next" link in the preceding paragraph? Please read the following: https://docs.python.org/2/library/stdtypes.html#iterator.next iterator.next() Return the next item from the contain

[issue30783] Spawned subprocesses don't respect environment

2017-06-26 Thread Eryk Sun
Eryk Sun added the comment: subprocess.Popen calls CreateProcess on Windows, which searches for an unqualified executable in the command line as follows: 1. The directory from which the application loaded. 2. The current directory for the parent process. (Starting with Vista

[issue30783] Spawned subprocesses don't respect environment

2017-06-26 Thread Eryk Sun
Eryk Sun added the comment: cmd.exe implements its own search, like shutil.which, and uses the CreateProcess lpApplicationName parameter that corresponds to the Popen executable parameter. But in general (not always) it's better to use shutil.which because you don't have to worry

[issue14094] ntpath.realpath() should use GetFinalPathNameByHandle()

2017-06-27 Thread Eryk Sun
Eryk Sun added the comment: I assume by nt.realpath we're talking about ntpath.realpath. In that case nothing was done to fix this. It's still an alias for ntpath.abspath, which calls GetFullPathNameW. -- nosy: +eryksun resolution: fixed -> stage: resolved -> ne

[issue29926] IDLE: in shell, time.sleep ignores _thread.interrupt_main()

2017-06-29 Thread Eryk Sun
Eryk Sun added the comment: > interrupt_main is now equivalent to the user having hit control-C. That's true on a POSIX system with pthread_kill, but not really for a Windows process that's attached to a console. A real Ctrl+C executes the registered control handlers fo

[issue29926] IDLE: in shell, time.sleep ignores _thread.interrupt_main()

2017-06-29 Thread Eryk Sun
Eryk Sun added the comment: Terry, I assume you ran IDLE via pyw.exe or pythonw.exe, which won't inherit the console of its parent. You have to use py.exe or python.exe. In this case you can also use sys.__stdout__.write('spam\n'). If you run via pythonw.exe or pyw.exe from a

[issue29926] IDLE: in shell, time.sleep ignores _thread.interrupt_main()

2017-06-29 Thread Eryk Sun
Eryk Sun added the comment: The strong claim that "interrupt_main is now equivalent to the user having hit control-C" is the reason I suggested broadcasting CTRL_C_EVENT via GenerateConsoleCtrlEvent. That operation isn't buggy on its own to my knowledge. There is a glitch due t

[issue30859] Can't install Python for Windows 3.6.1 on multiple profiles

2017-07-05 Thread Eryk Sun
Eryk Sun added the comment: In Windows 10, I have 32-bit 3.6.1 installed for both an administrator and a standard user, both per-user installations. Maybe the logs from the failed attempt will help clarify what went wrong. If they still exist in the account's %temp% folder, please zip th

[issue30906] os.path.join misjoins paths

2017-07-11 Thread Eryk Sun
Eryk Sun added the comment: This differs slightly from WinAPI PathCchCombineEx, which fails the example case as an invalid parameter. If the second path is rooted but without a drive or UNC share, then if the first path is relative it must be at least drive relative (e.g. "C:dir1"

[issue30906] os.path.join misjoins paths

2017-07-13 Thread Eryk Sun
Eryk Sun added the comment: The difference compared to PathCchCombineEx stems from the following snippet in ntpath.join: if p_path and p_path[0] in seps: # Second path is absolute if p_drive or not result_drive: result_drive

[issue30906] os.path.join misjoins paths

2017-07-13 Thread Eryk Sun
Eryk Sun added the comment: BTW, I don't see why one would expect join(r"C:\dir1", "D:dir2") to return r"D:\dir1\dir2" instead of "D:dir2". Python's result is in agreement with Windows PathCchCombineEx. Paths on different drives should

[issue30979] the winapi fails to run shortcuts (because considers a shortcut not a valid Win32App)

2017-07-20 Thread Eryk Sun
Eryk Sun added the comment: subprocess.Popen calls WinAPI CreateProcess, which can execute PE/COFF executables and .BAT/.CMD batch scripts. It doesn't know anything about .LNK shell shortcuts. If CreateProcess fails, a Windows shell (e.g. CMD or PowerShell) tries ShellExecuteEx, which

[issue30979] the winapi fails to run shortcuts (because considers a shortcut not a valid Win32App)

2017-07-21 Thread Eryk Sun
Eryk Sun added the comment: That depends on the shortcut. I have some shortcuts that are designed to be run from the command line (e.g. python.lnk), which take arguments and inherit the working directory of the parent process. I add .LNK to PATHEXT so I can run them as commands without a

[issue31047] Windows: os.path.isabs(os.path.abspath(" ")) == False

2017-07-26 Thread Eryk Sun
Eryk Sun added the comment: The generic abspath implementation could be moved into the genericpath module, where it will be common to both posixpath and ntpath: def abspath(path): """Return an absolute path.""" path = os.fspath(p

[issue31030] sys.executable can be not normalized

2017-07-28 Thread Eryk Sun
Eryk Sun added the comment: Terry, the Windows implementation calls GetModuleFileNameW to get the executable's fully-qualified path from the loader. However, depending on how Python is started, this could be a \\?\ path, which leads to a bug in the startup code that determines the prefix

[issue31074] Startup failure if executable is a \\?\ path on Windows

2017-07-28 Thread Eryk Sun
New submission from Eryk Sun: search_for_prefix in PC/getpathp.c sets the wrong path when Python is started with a \\?\ path on Windows, which results in the following crash: >>> subprocess.call(r'"\\?\C:\Program Files\Python36\python.exe"') Fatal Python er

[issue31103] Windows Installer Product Version 3.6.2150.0 Offset By 0.0.150.0

2017-08-02 Thread Eryk Sun
Eryk Sun added the comment: The docs [1] are clear that this property must be of the form major.minor.build. It can include at least one additional field, which the installer ignores. The major and minor version numbers can be up to 255, and the build number can be up to 65535. Python&#

[issue31112] cannot run module with double quotes

2017-08-02 Thread Eryk Sun
Eryk Sun added the comment: Python uses the C runtime wmain entry point, which parses the commandline string into an argument array using documented rules [1]. The quoted string "-m locust.main -V" is passed as a single argument instead of the expected three arguments: ["-m

[issue31126] dict comprehension shouldn't raise UnboundLocalError

2017-08-06 Thread Eryk Sun
Eryk Sun added the comment: Comprehensions evaluate the iterator for the outermost loop in the surrounding scope. The iterators for all inner loops are evaluated in the local scope of the comprehension itself. -- nosy: +eryksun resolution: -> not a bug stage: -> resolved

[issue31126] dict comprehension shouldn't raise UnboundLocalError

2017-08-06 Thread Eryk Sun
Eryk Sun added the comment: It's consistent with the behavior of generator expressions: Variables used in the generator expression are evaluated lazily when the __next__() method is called for the generator object (in the same fashion as normal generators). However, the lef

[issue31134] python not added to path

2017-08-07 Thread Eryk Sun
Eryk Sun added the comment: A WM_SETTINGCHANGE message gets broadcasted to top-level windows, so Explorer should reload its environment from the registry. Did you start a new command prompt from Explorer? -- nosy: +eryksun ___ Python tracker <h

[issue31134] python not added to path

2017-08-07 Thread Eryk Sun
Changes by Eryk Sun : -- stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue31134> ___ ___ Python-bugs-list

[issue31113] Stack overflow with large program

2017-08-07 Thread Eryk Sun
Eryk Sun added the comment: Here are a couple of workarounds for the crash in Windows. The default stack reservation size is a field in the PE/COFF header, which you can edit using editbin.exe, e.g.: editbin /stack:[size_in_bytes] "path\to\python.exe" The distributed python

[issue31210] Can not import site from sys.prefix containing DELIM

2017-08-16 Thread Eryk Sun
Eryk Sun added the comment: > Is this post wrong then? No, it's not wrong that semicolon is a valid character in Windows NTFS and FAT32 filesystems. However, the answer by Kevin Edwards that recommends using double quotes needs qualification. It only works in CMD. It doesn&#

[issue31210] Can not import modules if sys.prefix contains DELIM

2017-08-16 Thread Eryk Sun
Eryk Sun added the comment: It's simple to work around using a junction or symbolic link, so is this worth pursuing? -- ___ Python tracker <http://bugs.python.org/is

[issue31226] shutil.rmtree fails when target has an internal directory junction (Windows)

2017-08-17 Thread Eryk Sun
Eryk Sun added the comment: Junctions are sometimes used as links (e.g. mklink /j) and sometimes as volume mount points (e.g. mountvol.exe). GetVolumePathName can be called to distinguish these cases. If a junction is a volume mount point, then its absolute path and volume path are the same

[issue31226] shutil.rmtree fails when target has an internal directory junction (Windows)

2017-08-17 Thread Eryk Sun
Changes by Eryk Sun : -- components: -IO stage: -> test needed type: -> behavior versions: +Python 3.7 -Python 3.3 ___ Python tracker <http://bugs.python.org/i

[issue31228] Subprocess.Popen crash w/ Win10, debug32, bad file, and PIPE

2017-08-17 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> duplicate stage: needs patch -> resolved status: open -> closed superseder: -> Windows: subprocess debug assertion on failure to execute the process ___ Python tracker <http://bugs.python

[issue23057] [Windows] asyncio: support signal handlers on Windows (feature request)

2017-09-01 Thread Eryk Sun
Changes by Eryk Sun : -- stage: -> needs patch versions: +Python 3.6, Python 3.7 -Python 3.4, Python 3.5 ___ Python tracker <http://bugs.python.org/issu

[issue31427] Proposed addition to Windows FAQ

2017-09-12 Thread Eryk Sun
Changes by Eryk Sun : -- versions: +Python 3.5 ___ Python tracker <https://bugs.python.org/issue31427> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31427] Proposed addition to Windows FAQ

2017-09-12 Thread Eryk Sun
Eryk Sun added the comment: The FAQ could instead link to the more recent update, KB3118401. https://support.microsoft.com/en-us/help/3118401/update-for-universal-c-runtime-in-windows -- nosy: +eryksun ___ Python tracker <https://bugs.python.

[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-13 Thread Eryk Sun
Eryk Sun added the comment: I don't see a bug here. The inner run() kills cmd.exe after 4 seconds. But the waitfor.exe process waits for 200 seconds and has handles for the pipes. The OS won't close out the pipes as long as there are potential writers, so the outer communicate()

[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-13 Thread Eryk Sun
Eryk Sun added the comment: > the process terminates, but "communicate" doesn't exit. It doesn't > say "communicate will hang as long as the pipes are open". I think the problem with leaked handles does warrant a note. It can be a difficult problem to

[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-14 Thread Eryk Sun
Eryk Sun added the comment: > Now I can read from the "R" pipes with 0 problems (getting the error > and output streams) The pipe handles are inherited by waitfor.exe, just as before. You'll find that reading to EOF will block just as it does when using subprocess.P

[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-15 Thread Eryk Sun
Eryk Sun added the comment: > I tried with stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, > stderr=subprocess.DEVNULL As I said previously, you also need to make the current standard handles non-inheritable. Pending issue 19764, in 3.7 you'll be able to override stdin,

[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2017-09-18 Thread Eryk Sun
Eryk Sun added the comment: > when I said "also with close_fds=True", I meant that I tried > WITHOUT overriding stdin, stdout, and stderr AND setting > close_fds=True, but it didn't work. Console applications (e.g. python.exe) duplicate their standard handles into

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

2017-09-18 Thread Eryk Sun
Eryk Sun added the comment: Py_CreateSymbolicLinkW can be removed in 3.5+ because Windows XP is no longer supported and calling enable_symlink() is pointless. The Windows API uses some privileges simply to determine which security principals can access a capability. Whether the privilege is

[issue35306] OSError [WinError 123] when testing if pathlib.Path('*') (asterisks) exists

2018-11-25 Thread Eryk Sun
Eryk Sun added the comment: Path.exists should ignore all OSError exceptions, as os.path.exists does. Barring that, I suppose for Windows we could add EINVAL to IGNORED_ERROS. The problem with ValueError was already addressed in issue 33721. -- components: +Windows nosy: +eryksun

[issue35326] ctypes cast and from_address cause crash on Windows 10

2018-11-27 Thread Eryk Sun
Eryk Sun added the comment: The default function result type is c_int, which truncates a 64-bit pointer to 32-bit. The attribute that needs to be set is singular restype, not plural restypes. Unfortunately ctypes objects have a dict, so you're not catching the typo in an obviou

[issue35217] REPL history is broken when python is invoked with cmd /c

2018-11-29 Thread Eryk Sun
Eryk Sun added the comment: The Windows console has a fixed number of history buffers. In Windows 7 the default maximum is four history buffers. In this case, if we run a script via cmd.exe -> py.exe -> python.exe, then only one history buffer remains for a child process. As you'

[issue35367] FileExistsError During os.symlink() Displays Arrow in the Wrong Direction

2018-11-30 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> os.symlink: FileExistsError shows wrong message ___ Python tracker <https://bugs.python

[issue35374] Windows doc build does not find autodetected hhc.exe

2018-12-02 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +eryksun ___ Python tracker <https://bugs.python.org/issue35374> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35390] ctypes not possible to pass NULL c_void_p in structure by reference

2018-12-03 Thread Eryk Sun
Eryk Sun added the comment: Your example uses POINTER(c_double), not c_void_p. There's no problem with an actual pointer object (i.e. subclass of ctypes._Pointer). The problem is with simple types (i.e. immediate subclasses of ctypes._SimpleCData), including simple pointer types

[issue35418] python hung or stuck somtimes randomly on windows server 2008R2

2018-12-05 Thread Eryk Sun
Eryk Sun added the comment: > This traceback doesn't make sense Enable the installer options for the debug binaries and symbol files. Ensure that this installs the *_d.[exe|dll] debug binaries and also the *.pdb symbol files for the release and debug builds. Run the debug b

[issue35418] python hung or stuck somtimes randomly on windows server 2008R2

2018-12-05 Thread Eryk Sun
Eryk Sun added the comment: > I don't see how PyNamespace_New() can call LookupPrivilegeValueA() For the record, in the 3.7.1 release build, `PyNamespace_New + d4` is in enable_symlink (Modules/posixmodule.c), which gets called when the nt (aka posix) module gets initialized.

[issue35440] Setup failed 0x80072f7d - Unspecified error

2018-12-08 Thread Eryk Sun
Eryk Sun added the comment: For what it's worth, 0x8007 indicates a Windows error, which in this case is ERROR_INTERNET_SECURITY_CHANNEL_ERROR (12157 or 0x2f7d) [1]: "the application experienced an internal error loading the SSL libraries". [1]: https://docs.microsoft.co

[issue29707] os.path.ismount() always returns false for mount --bind on same filesystem

2018-12-15 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +eryksun stage: -> needs patch versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue29707> ___ ___ Python-

[issue29707] os.path.ismount() always returns false for mount --bind on same filesystem

2018-12-15 Thread Eryk Sun
Eryk Sun added the comment: It's also inconsistent. ismount() is true for a bind mount to the parent directory (e.g. dir/mount -> dir). -- ___ Python tracker <https://bugs.python.org

[issue29707] os.path.ismount() always returns false for mount --bind on same filesystem

2018-12-15 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue29707> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue29707] os.path.ismount() always returns false for mount --bind on same filesystem

2018-12-16 Thread Eryk Sun
Eryk Sun added the comment: > what is the problem with getting False for bind mounts > on the same filesystem? Probably there's no problem if it's consistently false for all bind mounts on the same file system, but ismount() is true for a bind mount to the parent directory

[issue35541] CLI error when .python_history contains unicode characters

2018-12-19 Thread Eryk Sun
Eryk Sun added the comment: pyreadline is a third-party package. Refer to issue 55 at its GitHub repo: https://github.com/pyreadline/pyreadline/issues/55 -- nosy: +eryksun resolution: -> third party stage: -> resolved status: open -&g

[issue35596] Fatal Python error: initfsencoding: unable to load the file system codec zipimport.ZipImportError: can't find module 'encodings'

2018-12-27 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +serhiy.storchaka stage: patch review -> test needed type: -> crash ___ Python tracker <https://bugs.python.org/i

[issue35667] activate for venv containing apostrophe doesn't work in powershell

2019-01-06 Thread Eryk Sun
Eryk Sun added the comment: > I am not sure about the difference in semantics between powershell and > command prompt with respect to quoting since CMD only uses single quotes in `for /f` loops, in which it's either a command or a literal string (w/ the "usebackq" o

<    8   9   10   11   12   13   14   15   16   17   >