[issue35686] BufferError with memory.release()

2019-01-08 Thread Eryk Sun
Eryk Sun added the comment: > Or, obviously: > > with open(fn, 'rb') as fd: > with mmap.mmap(fd.fileno(), 0, access=mmap.ACCESS_READ) as mm: > with memoryview(mm)[:2] as data: > print(data) Doesn't this rely on the immediate finalizati

[issue29734] os.stat handle leak

2019-01-11 Thread Eryk Sun
Eryk Sun added the comment: The os__getfinalpathname_impl handle leak and VOLUME_NAME_NT problems were fixed in another issue. However, PR 740 also includes fixes for handle leaks in os.stat, specifically in win32_xstat_impl and get_target_path. -- stage: -> patch review title:

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

2019-01-15 Thread Eryk Sun
Eryk Sun added the comment: > (sidenote: what os.path operation does Path.resolve() match? > Path('nonexistent').resolve() returns a relative path on Python > 3.7.1, whereas Path().resolve() returns an absolute path.) pathlib should resolve 'nonexistent' in Win

[issue35692] pathlib.Path.exists() on non-existent drive raises WinError instead of returning False

2019-01-15 Thread Eryk Sun
Eryk Sun added the comment: > There's no reason a non-existing drive should fail differently than > a non-existing parent directory. The drive exists (or should) if we're getting ERROR_NOT_READY (21). It's likely a removable media device, such as an optical disc or car

[issue35750] process finished with exit code -1073740940 (0xc0000374)

2019-01-16 Thread Eryk Sun
Eryk Sun added the comment: A crash with the code STATUS_HEAP_CORRUPTION (0xC374) is due to a bug, not memory exhaustion. The bug may not be the fault of the interpreter or standard library if you're working with extension modules or ctypes. It's easy to corrupt the internal

[issue35754] When writing/closing a closed Popen.stdin, I get OSError vs. BrokenPipeError randomly or depending on bufsize

2019-01-16 Thread Eryk Sun
Eryk Sun added the comment: If I'm right, we can reduce your example down as follows: import os import subprocess import time import ctypes RtlGetLastNtStatus = ctypes.WinDLL('ntdll').RtlGetLastNtStatus RtlGetLastNtStatus.restype = ctypes.c_

[issue35754] When writing/closing a closed Popen.stdin, I get OSError vs. BrokenPipeError randomly or depending on bufsize

2019-01-16 Thread Eryk Sun
Change by Eryk Sun : -- components: +IO, Interpreter Core, Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware type: -> behavior versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issu

[issue35750] process finished with exit code -1073740940 (0xc0000374)

2019-01-17 Thread Eryk Sun
Change by Eryk Sun : -- resolution: fixed -> third party stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue26414] os.defpath too permissive

2019-01-17 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Remove current directory from posixpath.defpath to enhance security ___ Python tracker <https://bugs.python

[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Eryk Sun
Eryk Sun added the comment: The launchers have inheritance enabled (for the duplicated standard handles, which should be made inheritable via SetHandleInformation instead, but that's a separate issue). However, multiprocessing doesn't use inheritable handles. Spawning proc

[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Eryk Sun
Eryk Sun added the comment: multiprocessing could be redesigned to make the child process responsible for duplicating all handles from its logical parent (by PID passed on the command line -- regardless of whatever its real parent is). That avoids the problem of the parent mistakenly

[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-22 Thread Eryk Sun
Eryk Sun added the comment: > The current solution is the simplest one that ensures the most > compatibility for the least amount of risk, even though that > was not zero risk, as we've seen. How about making the py[w].exe launcher unset __PYVENV_LAUNCHER__ whenever it run

[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-23 Thread Eryk Sun
New submission from Eryk Sun : In 3.7.2 on Windows, venv now uses a redirecting launcher 'script' for python[w].exe. This replaces (on Windows only) the setup requirement to copy or symlink the interpreter binaries (i.e. python[w].exe, python37.dll, and vcruntime140.dll). Apparent

[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-23 Thread Eryk Sun
Eryk Sun added the comment: It's worth noting the consequences of changing the application directory (i.e. the "%__APPDIR__%" dynamic variable from GetEnvironmentVariableW). This is the first directory checked in most cases when Windows searches for a file, including the Creat

[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-24 Thread Eryk Sun
Eryk Sun added the comment: > 1. Is there a possibility that 3rd party applications like pip > could see bugs with Python 3.7.2? A bug occurs when running an entry-point script, such as pip.exe, for a system- or user-installed Python 3.7.2+ from the context of a virtual environme

[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-24 Thread Eryk Sun
Eryk Sun added the comment: > But if I understood what Steve said, only if path\to\python.exe is > a *relative* pathname? I believe Steve is referring to behavior changes for applications that relied on a virtual environment's "Scripts" directory always being in the EXE

[issue35854] EnvBuilder and venv symlinks do not work on Windows on 3.7.2

2019-01-29 Thread Eryk Sun
Eryk Sun added the comment: > Actually, it seems like venv symlinks are so far from working > that they haven't worked (on Windows) since 3.5 or possibly > earlier. I use venv with --symlinks prior to 3.7.2. It works fine as far as I can tell. Perhaps you could elaborate.

[issue35854] EnvBuilder and venv symlinks do not work on Windows on 3.7.2

2019-01-30 Thread Eryk Sun
Eryk Sun added the comment: > Okay, testing more thoroughly on 3.5, symlinks are fine from the > console but not via Explorer. I gave up on using EXE symlinks with Explorer and ShellExecute[Ex]. The shell handles symlinks like shortcuts instead of leaving it up to the file syst

[issue35862] Change the environment for a new process

2019-02-01 Thread Eryk Sun
Eryk Sun added the comment: > Because sometimes when a process is implicitly started by some 3rd > party library (i.e. COM via pythonwin here) the "old", unchanged > environment is retained as the process itself doesn't care if > os.environ was changed or no

[issue35872] Creating venv from venv no longer works in 3.7.2

2019-02-01 Thread Eryk Sun
Eryk Sun added the comment: The __PYVENV_LAUNCHER__ variable gets set by each launcher instance. We get one launcher process for every level of nesting, and the last launcher to run sets the final value that will be seen by the real python.exe. Possibly the launcher could resolve the home

[issue35883] Change invalid unicode characters to replacement characters in argv

2019-02-01 Thread Eryk Sun
Eryk Sun added the comment: In Unix, Python 3.6 decodes the char * command line arguments via mbstowcs. In Linux, I see the following misbehavior of mbstowcs when decoding an overlong UTF-8 sequence: >>> mbstowcs = ctypes.CDLL(None, use_errno=True).mbstowcs >>> a

[issue32560] [EASY C] inherit the py launcher's STARTUPINFO

2019-02-02 Thread Eryk Sun
Eryk Sun added the comment: It should be fine. If the docs don't require initializing cb, we can assume it's done for us. For example, msvcrt.dll calls GetStartupInfo without initializing this field: 0:000> kc 3 Call Site KERNELBASE!GetStartupInfoW msvcrt!ioin

[issue32560] [EASY C] inherit the py launcher's STARTUPINFO

2019-02-02 Thread Eryk Sun
Eryk Sun added the comment: Oops, I forgot the check: 0:000> ?? sizeof(test!_STARTUPINFOW) unsigned int64 0x68 -- ___ Python tracker <https://bugs.python.org/issu

[issue29734] os.stat handle leak

2019-02-02 Thread Eryk Sun
Eryk Sun added the comment: Steve, can you review and merge PR 740? Mark updated it to fix the handle leaks in win32_xstat_impl as mentioned in my previous message. They're unlikely but still should be fixed. In particular, iIt's unlikely that win32_get_reparse

[issue35872] Creating venv from venv no longer works in 3.7.2

2019-02-02 Thread Eryk Sun
Eryk Sun added the comment: > This scenario should work, as running the other venv's redirector > will update the variable. The order gets reversed. In the simple case where we have two launchers, the launcher for the nested virtual environment executes the launcher for the oute

[issue35872] Creating venv from venv no longer works in 3.7.2

2019-02-02 Thread Eryk Sun
Eryk Sun added the comment: > You can't actually nest virtual environments, at least with venv Yes, they can't be nested in terms of inheriting site-packages. But the "home" value in this case references the creating environment, which hasn't changed from previou

[issue35872] Creating venv from venv no longer works in 3.7.2

2019-02-02 Thread Eryk Sun
Eryk Sun added the comment: > Is there any reason to not resolve the base executable on creation and > make it relative to that? So the second pyvenv.cfg would have the same > home directory as the first? I was trying to avoid changing the existing behavior of `home` from how it

[issue35896] sysconfig.get_platform returns wrong value when Python 32b is running under Windows 64b

2019-02-06 Thread Eryk Sun
Eryk Sun added the comment: > Correct, though the examples I'd give are Win32 vs. WinRT vs. Cygwin, > which are fundamentally different API surfaces for interacting with > the operating system. Cygwin and MSYS are presented as more than APIs; they're separate platform

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

2019-02-07 Thread Eryk Sun
Change by Eryk Sun : -- components: -Windows ___ Python tracker <https://bugs.python.org/issue14094> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2019-02-07 Thread Eryk Sun
Change by Eryk Sun : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker <https://bugs.python.org/issue14

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

2019-02-07 Thread Eryk Sun
Eryk Sun added the comment: Ping on PR 11248. It would be nice to get this into 3.8. -- ___ Python tracker <https://bugs.python.org/issue14094> ___ ___ Pytho

[issue35935] threading.Event().wait() not interruptable with Ctrl-C on Windows

2019-02-07 Thread Eryk Sun
Eryk Sun added the comment: Python's C signal handler sets a flag and returns, and the signal is eventually handled in the main thread. In Windows, this means the Python SIGINT handler won't be called so long as the main thread is blocked. (In Unix the signal is delivered on the m

[issue35875] Crash by Pandas - algos.cp36-win_amd64.pyd join.cp36-win_amd64.pyd

2019-02-08 Thread Eryk Sun
Eryk Sun added the comment: The access violation (exception code 0xC005) occurs in algos.cp36-win_amd64.pyd, which is a Pandas extension module, so I'm closing this issue as third party. You can open an issue with the Pandas project at their GitHub repo: https://github.com/panda

[issue1054041] Python doesn't exit with proper resultcode on SIGINT

2019-02-13 Thread Eryk Sun
Eryk Sun added the comment: For Windows, the default console control handler calls ExitProcess(STATUS_CONTROL_C_EXIT). If CMD is waiting on an application that exits with STATUS_CONTROL_C_EXIT, it prints "^C" to indicate the process was killed by Ctrl+C. F

[issue25737] array is not a Sequence

2019-02-14 Thread Eryk Sun
Eryk Sun added the comment: I had closed this issue because I thought issue 23864 would be resolved by extending the existing behavior. Three years later, still with no resolution, Guido commented on that issue that the current behavior shouldn't be extended and only the document

[issue1054041] Python doesn't exit with proper resultcode on SIGINT

2019-02-14 Thread Eryk Sun
Eryk Sun added the comment: Gregory's last example reminded me that CMD checks for STATUS_CONTROL_C_EXIT for more than simply printing "^C". It also breaks out of a FOR loop when interactive and prompts to continue when executing a batch script. Normally CMD also gets a

[issue1054041] Python doesn't exit with proper resultcode on SIGINT

2019-02-14 Thread Eryk Sun
Change by Eryk Sun : Added file: https://bugs.python.org/file48142/winsig.py ___ Python tracker <https://bugs.python.org/issue1054041> ___ ___ Python-bugs-list mailin

[issue35688] "pip install --user numpy" fails on Python from the Windows Store

2019-02-15 Thread Eryk Sun
Eryk Sun added the comment: It may suit the needs of NumPy and SciPy to use an assembly for DLL dependencies. With an assembly it's possible for two DLLs with the same name to load in a process and possible for a DLL to extend the assembly search path with up to nine relative paths at

[issue35688] "pip install --user numpy" fails on Python from the Windows Store

2019-02-16 Thread Eryk Sun
Eryk Sun added the comment: > I didn't realize assemblyBinding was supported by the generic runtime > framework, the documentation https://docs.microsoft.com/en-us/dotnet/ > framework/deployment/how-the-runtime-locates-assemblies seems to > suggest it is a dotnet feature

[issue33935] shutil.copyfile throws incorrect SameFileError on Google Drive File Stream

2019-02-18 Thread Eryk Sun
Eryk Sun added the comment: Here's a WebDAV example: net use Z: \\live.sysinternals.com\tools Both st_dev (volume serial number) and st_ino (file number) are 0 for all files on this drive. _getfinalpathname also fails since WebDAV doesn't support the default FILE_NAME_NORMA

[issue33935] shutil.copyfile throws incorrect SameFileError on Google Drive File Stream

2019-02-19 Thread Eryk Sun
Eryk Sun added the comment: > I don't see any value in testing the drive name separately. If the file number is non-zero, then the volume is the only question. I limited the comparison to just the drives in case the volume supports hardlinks. We can change the check to `s1.st_in

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-19 Thread Eryk Sun
Eryk Sun added the comment: > os.access(path, os.X_OK) is specific to Unix. It doesn't make sense > on Windows. It doesn't make sense with the current implementation of os.access, and not as Stéphane used it. Even if we completely implemented os.access, the problem is that

[issue36021] [Security][Windows] webbrowser: WindowsDefault uses os.startfile() and so can be abused to run arbitrary commands

2019-02-20 Thread Eryk Sun
Eryk Sun added the comment: > Windows has the GetBinaryTypeW function ShellExecute[Ex] doesn't check for a PE image. It uses the file extension, and a tangled web of registry settings to determine what to execute. If a file should run directly via CreateProcess, you'll find

[issue36035] pathlib.Path().rglob() breaks with broken symlinks

2019-02-20 Thread Eryk Sun
Eryk Sun added the comment: In Windows, the error for a path reparse (e.g. symlink or junction) that can't be resolved is ERROR_CANT_RESOLVE_FILENAME. Another common error is ERROR_INVALID_REPARSE_DATA. This can occur if the reparse data is malformed or if the target device is invali

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

2019-02-21 Thread Eryk Sun
Eryk Sun added the comment: The subprocess Handle object is never finalized explicitly, so the Process handle should always be valid as long as we have a reference to the Popen instance. We can call TerminateProcess as many times as we want, and the handle will still be valid. If it&#

[issue36085] Enable better DLL resolution

2019-02-22 Thread Eryk Sun
Eryk Sun added the comment: > Proposal #1: CPython calls SetDefaultDllDirectories() [2] on startup SetDefaultDllDirectories() affects the entire process, so it would needlessly break the world -- especially for embedding applications and ctypes users that have relied on adding director

[issue36085] Enable better DLL resolution

2019-02-22 Thread Eryk Sun
Eryk Sun added the comment: > I'm very against doing magic to extract the names from the DLL, but > but maybe we could have a search path in the parent package? Then > add/remove it around importing the module. That works, too. I'm happy either way. We still can't

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

2017-03-03 Thread Eryk Sun
Eryk Sun added the comment: When run directly from the temp directory path that's reported in the log, does the new log say that the installer is trying to run python-3.5.3-amd64.exe from that same path, or is it trying to run it from a new dire

[issue29657] os.symlink: FileExistsError shows wrong message

2017-03-03 Thread Eryk Sun
Eryk Sun added the comment: A symbolic link is typically represented the other way around, from the point of view of the link pointing at the target. However, Python conceptualizes linking as something like a copy or rename operation, with source and destination filenames, and the current

[issue29657] os.symlink: FileExistsError shows wrong message

2017-03-03 Thread Eryk Sun
Eryk Sun added the comment: To me the error message is in the model of a source -> destination operation, in which the arrow indicates the operation's information flow (e.g. of the target path or inode number) from the source file to the destination file. I've never viewed it sup

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Eryk Sun
Eryk Sun added the comment: That's not the current directory. It's the 'script' directory (i.e. the parent of main361), as set by PySys_SetArgv when Py_IsolatedFlag isn't set. The old behavior was for RunMainFromImporter to unconditionally replace this directory in

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-05 Thread Eryk Sun
Eryk Sun added the comment: > I don't have a specific problem that it causes. Adding an arbitrary directory ahead of the standard library in sys.path is a problem waiting to happen. This also happens when the import source is a zip file, e.g. a

[issue29734] nt._getfinalpathname handle leak

2017-03-06 Thread Eryk Sun
New submission from Eryk Sun: The implementation of nt._getfinalpathname leaks a File handle if calling GetFinalPathNameByHandle fails. The latter function is practically guaranteed to fail when resolving the path for a non-file-system device. It also fails when VOLUME_NAME_DOS is requested

[issue25996] Add support of file descriptor in os.scandir()

2017-03-06 Thread Eryk Sun
Eryk Sun added the comment: > There is no similar function taking a directory handle In 3.5+ the CRT has O_OBTAIN_DIR (0x2000) for opening a directory, i.e. to call CreateFile with backup semantics. A directory can be read via GetFileInformationByHandleEx [1] using the information clas

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-07 Thread Eryk Sun
Eryk Sun added the comment: > It's actually "adding" the current directory It's the script directory, which gets added on all platforms when PySys_SetArgv is called with Py_IsolatedFlag == 0. In this case we're running "__main__.py" from a directory or

[issue29753] Ctypes Packing Incorrectly - Linux

2017-03-07 Thread Eryk Sun
Eryk Sun added the comment: To make it simpler to diagram the fields, I've rewritten your structure using field names A-J: import ctypes class MyStructure(ctypes.Structure): _pack_ = 1 _fields_ = (('A', ctypes.c_uint16), # 2 bytes

[issue29753] Ctypes Packing Incorrectly - Linux

2017-03-07 Thread Eryk Sun
Changes by Eryk Sun : -- versions: +Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <http://bugs.python.org/issue29753> ___ ___ Python-bugs-list mailin

[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Eryk Sun
Eryk Sun added the comment: main361 can be run as a package from the current directory via -m because an empty string is in sys.path, i.e. the current directory. It imports the package, executing __init__.py and then __main__.py. In this case, the main361 directory/zip import source is not

[issue29761] Wrong size of c_ulong in linux, windows version is fine

2017-03-08 Thread Eryk Sun
Eryk Sun added the comment: ctypes is correct. 64-bit Linux uses an LP64 data model, and 64-bit Windows uses LLP64. https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models -- nosy: +eryksun resolution: -> not a bug stage: -> resolved status: open -&g

[issue26744] print() function hangs on MS-Windows 10

2017-03-09 Thread Eryk Sun
Eryk Sun added the comment: > After enabling `QuickEdit Mode`, then click the console will > suspend the program. That's not suspending the entire process. It's blocking the thread that writes to the console. The user-mode WriteConsole function is implemented b

[issue29688] Document Path.absolute

2017-03-10 Thread Eryk Sun
Eryk Sun added the comment: resolve() can't replace absolute(). They serve different purposes. Sometimes one wants an absolute path, but without resolving symbolic links. absolute() processes a path as a string, which will continue to be true if it's updated to call nt._getfu

[issue29688] Add support for Path.absolute()

2017-03-11 Thread Eryk Sun
Eryk Sun added the comment: What's the rationale for not calling self._flavour.pathmod.abspath() to implement absolute()? For example: >>> p = pathlib.Path('C:/con') >>> p._flavour.pathmod.abspath(p) '.\\con' >>> p._fro

[issue28685] Optimizing list.sort() by performing safety checks in advance

2017-03-11 Thread Eryk Sun
Eryk Sun added the comment: > assignment of "__lt__" change the value of the tp_richcompare slot? Yes. CPython doesn't implement individual dispatching of the rich-comparison functions. There's a single tp_richcompare slot, so overriding one rich compa

[issue29797] Deadlock with multiprocessing.Queue()

2017-03-12 Thread Eryk Sun
Eryk Sun added the comment: On Windows the "QueueFeederThread" in each child process is blocked in WaitForMultipleObjects in PipeConnection._send_bytes. The pipe buffer size is 8 KiB, and each pickled int is 5-6 bytes. With 2 processes the pipe is full after sending (256 + 469) *

[issue29688] Add support for Path.absolute()

2017-03-12 Thread Eryk Sun
Eryk Sun added the comment: It's the same with ntpath.abspath since the underlying GetFullPathName function processes the path only as a string. OK, so it seems we're requiring that p.absolute().resolve() is the same as p.resolve(). Consider the following example: >&

[issue29805] Pathlib.replace cannot move file to a different drive on Windows if filename different

2017-03-13 Thread Eryk Sun
Eryk Sun added the comment: Moving a file across volumes isn't atomic. Getting an exception in this case can be useful. There could be a "strict" keyword-only parameter that defaults to False. If it's true, then replace() won't try to move the file.

[issue29815] Fail at divide a negative integer number for a positive integer number

2017-03-15 Thread Eryk Sun
Eryk Sun added the comment: > -7 divided by 2 is -3, not -4 Integer division in Python is floor division, and it's self-consistent with the implementation of the modulo operation such that the following identity is satisfied: (a % n) == a - n * (a // n). For example: (-7 % 2) =

[issue29817] File IO r+ read, write, read causes garbage data write.

2017-03-15 Thread Eryk Sun
Eryk Sun added the comment: This is a bug in the C runtime's handling of "r+" mode with buffering. The CRT FILE stream's internal _cnt field, from the POV of the write() call, is the number of bytes that can be written to the internal buffer before it's full. The de

[issue29821] importing module shutil executes file 'copy.py'

2017-03-15 Thread Eryk Sun
Eryk Sun added the comment: > Run "python3 -I script.py" to not insert '' (current directory) > at the first position of sys.path. That should be "script directory", not "current directory". We only add the current directory to sys.path in in

[issue29827] os.path.exists() returns False for certain file name

2017-03-16 Thread Eryk Sun
Eryk Sun added the comment: In a string literal, '\t' represents a tab character (ordinal 9). Windows filenames cannot contain control characters [1], i.e. ordinals 1-31. For path literals I recommend using forward slashes and normalizing via os.path.normpath, e.g

[issue29829] Documentation lacks clear warning of subprocess issue with pythonw

2017-03-16 Thread Eryk Sun
Eryk Sun added the comment: An exception (not a crash) is possible if a standard handle is invalid and a Popen call tries to replace one or two of the other standard handles (e.g. stdin is invalid and you pass the argument stdout=PIPE). Note that subprocess uses the standard handles directly

[issue29844] Windows Python installers not installing DLL to System32/SysWOW64

2017-03-18 Thread Eryk Sun
Eryk Sun added the comment: 3.5+ doesn't install files to system directories -- except the py launcher in %SystemRoot%. This was an intentional change, so I'm flagging this as a documentation issue. -- assignee: -> docs@python components: +Documentation, Windows keyword

[issue29850] file access, other drives

2017-03-18 Thread Eryk Sun
Eryk Sun added the comment: When you say "to be precise...C:/Windows/...System32", do you mean that this is the only directory that you've tested? If so, what you're seeing may be WOW64 file-system redirection, if your 2.7 installation is 64-bit and 3.6 installation is 3

[issue29844] Windows Python installers not installing DLL to System32/SysWOW64

2017-03-20 Thread Eryk Sun
Eryk Sun added the comment: > It's inconsistent with the Linux experience of an all-users > installation Yes, if you build with --enable-shared on Linux, then the shared libraries libpython3.X.so.1.0 and libpython3.so are installed in /usr/local/lib. Currently there's no d

[issue29898] PYTHONLEGACYWINDOWSIOENCODING isn't implemented

2017-03-24 Thread Eryk Sun
New submission from Eryk Sun: The environment variable PYTHONLEGACYWINDOWSIOENCODING is documented here: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSIOENCODING but not actually implemented. Also, I think setting PYTHONIOENCODING to anything except UTF-8 should

[issue29898] PYTHONLEGACYWINDOWSIOENCODING isn't implemented

2017-03-25 Thread Eryk Sun
Eryk Sun added the comment: I prefer the name PYTHONLEGACYWINDOWSIOENCODING for symmetry with both PYTHONIOENCODING and PYTHONLEGACYWINDOWSFSENCODING, but I suppose you changed it to make it more visually distinguished from the latter. I discovered this issue due to the modified behavior of

[issue27827] pathlib is_reserved fails for some reserved paths on Windows

2017-03-26 Thread Eryk Sun
Eryk Sun added the comment: For COM[n] and LPT[n], only ASCII 1-9 and superscript 1-3 (U+00b9, U+00b2, and U+00b3) are handled as decimal digits. For example: >>> print(*(ascii(chr(c)) for c in range(1, 65536) ... if _getfullpathname('COM%s' % chr(c))[0] == 

[issue29907] Unicode encoding failure

2017-03-26 Thread Eryk Sun
Eryk Sun added the comment: I'm closing this issue since Python's encodings in this case -- 852 (OEM) and 1250 (ANSI) -- both correctly map U+0159: >>> u'\u0159'.encode('852') '\xfd' >>> u'\u0159'.encode('125

[issue29908] Inconsistent crashing with an access violation

2017-03-26 Thread Eryk Sun
Eryk Sun added the comment: The offset in ucrtbase.dll where it's crashing may hint at the culprit. The following command should print the full event log for the most recent crash: wevtutil qe application /rd:true /c:1 /format:text /q:"*[System[Provider[@Name='Application Erro

[issue29908] Inconsistent crashing with an access violation

2017-03-26 Thread Eryk Sun
Eryk Sun added the comment: Steve, I added 3.5 because the crash involved ucrtbase.dll. I'll remove it for now since the problem is only confirmed in 3.6. Offset 0x3bd9e in 32-bit ucrtbase.dll is in wdupenv_s [1]. It's probably from calling new_spawnve in pydev_monkey.py, as sh

[issue29926] time.sleep ignores _thread.interrupt_main()

2017-03-27 Thread Eryk Sun
Eryk Sun added the comment: It's simple to fix this in Python 3 on Windows. PyErr_SetInterrupt in Modules/signalmodule.c needs the following addition: #ifdef MS_WINDOWS SetEvent(sigint_event); #endif In the main thread on Windows, time.sleep() waits on this event. On

[issue29908] Inconsistent crashing with an access violation

2017-03-28 Thread Eryk Sun
Eryk Sun added the comment: I can confirm that the CRT function construct_environment_block() does cause an access violation sometimes when no "=x:" shell variables are defined in the current environment. These "=x:" environment variables are the way that Windows em

[issue29926] time.sleep ignores _thread.interrupt_main()

2017-03-28 Thread Eryk Sun
Eryk Sun added the comment: For Windows the event should be set after trip_signal(SIGINT). That way the flag is guaranteed to be tripped when PyErr_CheckSignals is called from the time module's pysleep() function. This in turn calls the default SIGINT handler that raises a KeyboardInte

[issue29926] time.sleep ignores _thread.interrupt_main()

2017-03-28 Thread Eryk Sun
Eryk Sun added the comment: Nathaniel's suggestion to update the implementation to work with raise(SIGINT) sounds like a good idea. Fpr Windows, GenerateConsoleCtrlEvent is definitely a non-starter. PyErr_SetInterrupt shouldn't depend on having an attached console. IDLE gene

[issue29926] time.sleep ignores _thread.interrupt_main()

2017-03-28 Thread Eryk Sun
Eryk Sun added the comment: > Even is IDLE is started from a console, the user execution process > is not attached to one. Actually, the execution process is attached to a console, but it doesn't use it for sys.std*. Try open('con', 'w').write('s

[issue29938] subprocess.run calling bash on windows10 cause 0x80070057 error when capture stdout with PIPE

2017-03-29 Thread Eryk Sun
Eryk Sun added the comment: The initial release of WSL doesn't support passing non-console standard handles from Windows to Linux, or vice versa. It will work if you switch to a Windows Insider preview build. Otherwise you'll have to wait for the Windows 10 Creators Update.

[issue29938] subprocess.run calling bash on windows10 cause 0x80070057 error when capture stdout with PIPE

2017-03-29 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: not a bug -> third party ___ Python tracker <http://bugs.python.org/issue29938> ___ ___ Python-bugs-list mailing list Un

[issue29945] decode string:u"\ufffd" UnicodeEncodeError

2017-03-30 Thread Eryk Sun
Eryk Sun added the comment: > windows version run success! Trying to decode a non-ASCII unicode string should raise an exception on any platform: Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyri

[issue5906] Risk of confusion in multiprocessing module - daemonic processes

2017-04-01 Thread Eryk Sun
Eryk Sun added the comment: > I've personally found this `multiprocessing` restriction (daemonic > processes can't have children) to be nothing but a pain in the ass To make that reliable on Windows you could create a silent-breakaway, kill-on-close Job object in each proces

[issue5906] Risk of confusion in multiprocessing module - daemonic processes

2017-04-01 Thread Eryk Sun
Eryk Sun added the comment: > e.g., a Pool worker dies with an assert(!) error if it tries to create > its own Pool for something A daemon process could create a child daemon when the OS can ensure that no orphans are left behind (e.g. call Linux prctl to set PR_SET_PDEATHSIG as S

[issue29971] Lock.acquire() not interruptible on Windows

2017-04-03 Thread Eryk Sun
Eryk Sun added the comment: >From the linked issue: > proc.send_signal(CTRL_C_EVENT) raises the KeyboardInterrupt > in both the original and subprocess on Windows GenerateConsoleCtrlEvent takes process group IDs, so it should have been used to implement os.killpg, not os.kill. If yo

[issue29971] Lock.acquire() not interruptible on Windows

2017-04-03 Thread Eryk Sun
Eryk Sun added the comment: Alternatively we could use the SleepEx and WaitFor*Ex functions with alertable waits (i.e. using APCs) instead of the SIGINT Event. This avoids having to replace all single-object waits with multiple-object waits, and would even allow calling SleepEx in pysleep

[issue29982] tempfile.TemporaryDirectory fails to delete itself

2017-04-04 Thread Eryk Sun
Changes by Eryk Sun : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware versions: +Python 3.7 ___ Python tracker <http://bugs.python.org/issue29

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Eryk Sun
Eryk Sun added the comment: > Though I don't have any idea if it works on Windows, but it seems > properly factored. Generally it should. However, os.get_terminal_size is unnecessarily limited to the standard handles with a hard-coded mapping 0 => StandardInput, 1 => Stan

[issue30009] Integer conversion failure

2017-04-06 Thread Eryk Sun
Eryk Sun added the comment: Use %r instead of %s to show the repr. Hopefully that should clear things up for you. int() truncates toward 0. The float in this case is slightly less than 1. -- nosy: +eryksun resolution: -> not a bug stage: -> resolved status: open -&g

[issue30015] Windows also treats full-width spaces as a delimiter when parsing arguments

2017-04-07 Thread Eryk Sun
Eryk Sun added the comment: > Windows also treats full-width spaces as a delimiter when parsing > command line arguments. CreateProcess has to parse the beginning of the command-line string if the lpApplicationName parameter is omitted. According to the documentation, it treats "

[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Eryk Sun
Eryk Sun added the comment: In Python 3, gzip.open(filename, "rt") returns a TextIOWrapper using the system's default encoding. The decoded output is potentially very different from the byte string returned by 'text mode' in Python 2, even if using "rt" mo

[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Eryk Sun
Eryk Sun added the comment: You want to hack a fake text mode, which won't do new-line translation or treat ^Z (0x1a) as EOF like a normal 2.x text mode on Windows. Can't you just use io.TextIOWrapper(gzip.open(filename))? This rea

[issue30019] IDLE freezes when opening a file with astral characters

2017-04-07 Thread Eryk Sun
Eryk Sun added the comment: In Windows IDLE 3.x, you should still be able to print a surrogate transcoding, which sneaks the native UTF-16LE encoding around tkinter: def transurrogate(s): b = s.encode('utf-16le') return ''.join(b[i:i+2].decode('

[issue30075] Printing ANSI Escape Sequences on Windows 10

2017-04-15 Thread Eryk Sun
Eryk Sun added the comment: cmd.exe enables virtual terminal mode, but only for itself. It disables VT mode before starting other programs, and also at shutdown. It appears you've found a bug in the case of "cmd.exe /c ...". You can get the same result via os.system('

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