[issue22790] some class attributes missing from dir(Class)

2021-03-07 Thread Eryk Sun
Eryk Sun added the comment: >> Why are __flags__, __basicsize__, __itemsize__, >>__dictoffset__, and __weakrefoffset__ interesting? > > I haven't said they are, but on the other hand I don't see > why consistency is a bad thing. IMO, they're not intere

[issue24800] exec docs should note that the no argument form in a local scope is really the two argument form

2021-03-07 Thread Eryk Sun
Eryk Sun added the comment: So there are a couple things to clarify here. When the documentation says "if the optional parts are omitted, the code is executed in the current scope", I think it should explicitly state that this is equivalent to calling exec(object, globals(), local

[issue43431] Subprocess timeout causes output to be returned as bytes in text mode

2021-03-08 Thread Eryk Sun
Eryk Sun added the comment: communicate() is incomplete, so decoding the output may fail. For example, say the encoding is UTF-8, and the last multibyte character sequence (2-4 bytes) is incomplete. Maybe communicate() should always set `stdout_bytes` and `stderr_bytes` attributes on the

[issue43432] Add function `clear` to the `os` module

2021-03-08 Thread Eryk Sun
Eryk Sun added the comment: The idea of adding some kind of clear_screen() function in the os or shutil module was discussed extensively on python-ideas a few months ago: https://mail.python.org/archives/list/python-id...@python.org/thread/EWQ2BOL3WVZAU2V2MT3HLXN3AEBHANNZ https

[issue8304] time.strftime() and Unicode characters on Windows

2021-03-08 Thread Eryk Sun
Eryk Sun added the comment: > I'm not sure of what you mean. The function is implemented: My comment was limited to Windows, for which time.tzset() has never been implemented. Since Python has its own implementation of time.tzname in Windows, it should also implement time.tzset()

[issue10653] test_time test_strptime fails on windows

2021-03-08 Thread Eryk Sun
Eryk Sun added the comment: > Eryk Sun: This issue is now closed. If you want to enhance > the time module, please open a new issue. I was aware of that at the time, Victor. The problem can be worked on in a new issue, or in the older issue bpo-8304, which remains open. The two me

[issue43437] venv activate bash script has wrong line endings on windows

2021-03-08 Thread Eryk Sun
Eryk Sun added the comment: venv copies the scripts in binary mode, but apparently the Unix "activate" script already has CRLF line endings when Python is installed in Windows. Probably the POSIX "Lib/venv/scripts/common/activate" script needs a line-ending exceptio

[issue28356] [easy doc] Document os.rename() behavior on Windows when src and dst are on different filesystems

2021-03-08 Thread Eryk Sun
Eryk Sun added the comment: T-VEy, this is a documentation-only issue for versions of Python that are under active development for bug fixes and enhancements -- 3.8, 3.9, and 3.10. -- versions: +Python 3.10, Python 3.8 ___ Python tracker <ht

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

2021-03-08 Thread Eryk Sun
Eryk Sun added the comment: >> PEP 443 > > I guess that you mean the PEP 446 ;-) Yes, that's why I meant :$ -- ___ Python tracker <https://bugs.p

[issue42658] os.path.normcase() is inconsistent with Windows file system

2021-03-09 Thread Eryk Sun
Change by Eryk Sun : -- components: +Library (Lib), Unicode nosy: +ezio.melotti, vstinner versions: +Python 3.10, Python 3.8 ___ Python tracker <https://bugs.python.org/issue42

[issue43397] Incorrect conversion path case with german character

2021-03-09 Thread Eryk Sun
Eryk Sun added the comment: ntpath.normcase() needs a platform-dependent implementation that calls LCMapStringEx() in Windows, in order to properly agree with case-insensitive Windows filesystems. See bpo-42658. -- nosy: +eryksun resolution: -> duplicate stage: -> resolved

[issue43448] exec() ignores scope.

2021-03-09 Thread Eryk Sun
Eryk Sun added the comment: exec(obj, globals(), locals()) is the same as exec(obj). Also, locals in a function scope are optimized, so the locals() dict is a snapshot. Modifying the snapshot dict doesn't modify the optimized local variables. At most I think this issue is a duplicate o

[issue43455] pathlib mistakenly assumes os.getcwd() is a resolved path in Windows

2021-03-09 Thread Eryk Sun
New submission from Eryk Sun : pathlib._WindowsFlavour.resolve() mistakenly assume that os.getcwd() returns a resolved path in Windows: s = str(path) if not s: return os.getcwd() I don't think this is a practical problem since `str(path)` should never be an empty string

[issue38671] pathlib.Path.resolve(strict=False) returns relative path on Windows if the entry does not exist

2021-03-10 Thread Eryk Sun
Change by Eryk Sun : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware type: -> behavior versions: +Python 3.10, Python 3.9 -Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.org/issu

[issue40667] [Windows] Add global python and python3 commands

2020-05-19 Thread Eryk Sun
Eryk Sun added the comment: If .py files are associated with py.exe, handling the shebang "#!/usr/bin/env python[3]" might spawn the python[3].exe launcher recursively if it handles shebangs (see bpo-40687). To avoid this, process() can set a flag based on the image name tha

[issue40654] shutil.copyfile mutates symlink for absolute path

2020-05-28 Thread Eryk Sun
Eryk Sun added the comment: Modifying readlink() to return an str subclass that preserves the print name is an interesting idea, but not on topic here. For the cases where os.readlink is used to manually follow links (*), such as ntpath.realpath, using the substitute name is the most

[issue40827] os.readlink should support getting the target's printname in Windows

2020-05-30 Thread Eryk Sun
New submission from Eryk Sun : As discussed in issue 40654, os.readlink should provide a way to get the print name of a symlink target. This is the target path that was actually passed to WinAPI CreateSymbolicLinkW (except for drive-relative paths) and is what a shell would display as the

[issue13702] relative symlinks in tarfile.extract broken (windows)

2020-05-30 Thread Eryk Sun
Eryk Sun added the comment: This is still a problem with WinAPI CreateSymbolicLinkW. It fails to replace slashes with backslashes in the substitute path if it's a relative path, which creates a broken link. As a workaround, os.symlink should replace slashes with backslashes in rel

[issue40851] subprocess.Popen: impossible to show console window when shell=True

2020-06-02 Thread Eryk Sun
Eryk Sun added the comment: I think you have the right idea for improving the behavior here. It should skip setting wShowWindow if startupinfo already has the flag STARTF_USESHOWWINDOW. For example: if shell: comspec = os.environ.get("COMSPEC", "cmd.exe")

[issue40858] ntpath.realpath fails for broken symlinks with rooted target paths

2020-06-03 Thread Eryk Sun
New submission from Eryk Sun : ntpath.realpath fails to resolve the non-strict path of a broken relative symlink if the target is a rooted path. For example: >>> os.readlink('symlink') '\\broken\\link' >>> os.path.realpath('symlink'

[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-04 Thread Eryk Sun
Eryk Sun added the comment: > Perhaps the child interpreter used by test_repl doesn't inherit > that behavior. The OS error mode is inherited, unless the child is created with CREATE_DEFAULT_ERROR_MODE flag. But the CRT error mode isn't inherited. (For the spawn* family,

[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-04 Thread Eryk Sun
Eryk Sun added the comment: > The purpose of _Py_BEGIN_SUPPRESS_IPH is to suppress such popup, no? That macro suppresses the CRT's invalid parameter handler, which by default terminates abnormally with a fastfail (status code 0xC409), even in a release build. In a debug b

[issue40863] bytes.decode changes/destroys line endings on windows

2020-06-04 Thread Eryk Sun
Change by Eryk Sun : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue40863> ___ ___ Python-bugs-list

[issue40882] memory leak in multiprocessing.shared_memory.SharedMemory in Windows

2020-06-05 Thread Eryk Sun
New submission from Eryk Sun : mmap.mmap in Windows doesn't support an exist_ok parameter and doesn't correctly handle the combination fileno=-1, length=0, and tagname with an existing file mapping. SharedMemory has to work around these limitations. Part of the workaround for

[issue40882] memory leak in multiprocessing.shared_memory.SharedMemory in Windows

2020-06-07 Thread Eryk Sun
Eryk Sun added the comment: Thanks for working on the PR, Zackery. Would you be interested in working on improvements to mmap for 3.10? With support in mmap, the Windows-specific initialization of SharedMemory could be as simple as the following: # Windows Named Shared Memory while

[issue40915] muultiple problems with mmap.resize() in Windows

2020-06-08 Thread Eryk Sun
New submission from Eryk Sun : In Windows, mmap.resize() unmaps the view of the section [1], closes the section handle, resizes the file (without error checking), creates a new section (without checking for ERROR_ALREADY_EXISTS), and maps a new view. This code has several problems. Case 1

[issue40915] multiple problems with mmap.resize() in Windows

2020-06-08 Thread Eryk Sun
Change by Eryk Sun : -- title: muultiple problems with mmap.resize() in Windows -> multiple problems with mmap.resize() in Windows ___ Python tracker <https://bugs.python.org/issu

[issue40882] memory leak in multiprocessing.shared_memory.SharedMemory in Windows

2020-06-09 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +christian.heimes ___ Python tracker <https://bugs.python.org/issue40882> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40915] multiple problems with mmap.resize() in Windows

2020-06-09 Thread Eryk Sun
Eryk Sun added the comment: For a concrete example, here's a rewrite of the Windows implementation that incorporates the suggested changes. #include #ifdef MS_WINDOWS /* a named file mapping that's open more than once can't be resized */ /* this check coul

[issue40915] multiple problems with mmap.resize() in Windows

2020-06-09 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg371153 ___ Python tracker <https://bugs.python.org/issue40915> ___ ___ Python-bugs-list mailin

[issue40915] multiple problems with mmap.resize() in Windows

2020-06-09 Thread Eryk Sun
Eryk Sun added the comment: For a concrete example, here's a rewrite of the Windows implementation that incorporates the suggested changes. #include #ifdef MS_WINDOWS /* a named file mapping that's open more than once can't be resized */ /* this check coul

[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-10 Thread Eryk Sun
Eryk Sun added the comment: Why doesn't SuppressCrashReport suppress the hard error dialog (i.e. SEM_FAILCRITICALERRORS)? This dialog gets created by the NtRaiseHardError system call. For example: >>> NtRaiseHardError = ctypes.windll.ntdll.NtRaiseHardError

[issue40913] time.sleep ignores errors on Windows

2020-06-10 Thread Eryk Sun
Eryk Sun added the comment: > is there any straightforward way to cause WaitForSingleObjectEx to fail? The wait can fail for ERROR_INVALID_HANDLE or ERROR_ACCESS_DENIED (i.e. the handle lacks SYNCHRONIZE access). If _PyOS_SigintEvent were replaced with get/set functions, then a non-waita

[issue40946] SuppressCrashReport should set SEM_FAILCRITICALERRORS in Windows

2020-06-10 Thread Eryk Sun
New submission from Eryk Sun : In test.support, suppress_msvcrt_asserts sets the process error mode to include SEM_FAILCRITICALERRORS, SEM_NOGPFAULTERRORBOX, SEM_NOALIGNMENTFAULTEXCEPT, and SEM_NOOPENFILEERRORBOX. In contrast, the SuppressCrashReport context manager in the same module only

[issue40946] SuppressCrashReport should set SEM_FAILCRITICALERRORS in Windows

2020-06-10 Thread Eryk Sun
Change by Eryk Sun : -- keywords: +easy ___ Python tracker <https://bugs.python.org/issue40946> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40913] time.sleep ignores errors on Windows

2020-06-12 Thread Eryk Sun
Eryk Sun added the comment: If WaitForSingleObjectEx fails, do you think the system error code should be raised as an OSError? Probably an invalid-handle or access-denied error is too cryptic here. It may be better to raise something like RuntimeError('time.sleep(): invalid SIGINT

[issue27729] Provide a better error message when the file path is too long on Windows

2020-06-12 Thread Eryk Sun
Eryk Sun added the comment: Thanks for working on a PR, Zackery. Note that we can't rely on GetLastError() in PyErr_SetFromErrnoWithFilenameObjects. It may be called in contexts where the thread's LastErrorValue is no longer related to the C errno value. My suggestion in msg

[issue41021] Ctype callback with Structures crashes on python 3.8 on windows.

2020-06-18 Thread Eryk Sun
Eryk Sun added the comment: Please provide complete code that can be compiled as is, and the required build environment. I wrote a similar example in C, compiled for x64 with MSVC, and it worked fine for me. Also, please provide more details about the error -- a traceback in a native

[issue41021] ctypes callback with structure crashes in Python 3.8 on Windows

2020-06-18 Thread Eryk Sun
Change by Eryk Sun : -- stage: -> test needed title: Ctype callback with Structures crashes on python 3.8 on windows. -> ctypes callback with structure crashes in Python 3.8 on Windows ___ Python tracker <https://bugs.python.org/i

[issue41021] ctypes callback with structure crashes in Python 3.8 on Windows x86

2020-06-19 Thread Eryk Sun
Eryk Sun added the comment: I can reproduce a crash with an x86 build that uses a stdcall callback with a 32-bit argument followed by any ffi_type_sint64 argument (FILETIME, long long, etc). Apparently this is a bug in libffi's ffi_prep_cif. Given the 2nd argument has a size of 8 byte

[issue41053] open() fails to read app exec links

2020-06-20 Thread Eryk Sun
Eryk Sun added the comment: By design, appexec links (i.e. app execution aliases) cannot be followed automatically. There is no handler for them in the kernel. WinAPI CreateFileW fails with ERROR_CANT_ACCESS_FILE (1920), and the underlying NT status value is

[issue41053] open() fails to read app exec links

2020-06-21 Thread Eryk Sun
Eryk Sun added the comment: Where the POSIX specification uses the term "symbolic link" [1], it means one and only one type of symlink, not multiple types of symlink with divergent behavior depending on the context. To be consistent, only one type of Windows reparse point [2] is

[issue41021] ctypes callback with structure crashes in Python 3.8 on Windows x86

2020-06-23 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +vinay.sajip versions: +Python 3.10, Python 3.9 ___ Python tracker <https://bugs.python.org/issue41021> ___ ___ Python-bugs-list m

[issue41106] os.scandir() Windows bug dir_entry.stat() not works on file during writing.

2020-06-24 Thread Eryk Sun
Eryk Sun added the comment: In FSBO [1] section 6 "Time Stamps", note that the LastWriteTime value gets updated when an IRP_MJ_FLUSH_BUFFERS is processed. In the Windows API, this is a FlushFileBuffers [2] call. In the C runtime, it's a _commit [3] call, which is an os.fs

[issue41106] os.scandir() Windows bug dir_entry.stat() not works on file during writing.

2020-06-25 Thread Eryk Sun
Eryk Sun added the comment: > Does it make the most sense for us to make .flush() also do an > implicit .fsync() (when it's actually a file object)? Standard I/O in the Windows C runtime supports a "c" commit mode that causes fflush to call _commit() on the underlying f

[issue41106] os.scandir() Windows bug dir_entry.stat() not works on file during writing.

2020-06-25 Thread Eryk Sun
Eryk Sun added the comment: > What it also means is that the "file still in use by another app" > scenario will probably have to manually use os.stat(). We can't > detect it, and it's the same race condition as calling os.stat() > shortly before the update

[issue41151] Support for new Windows pseudoterminals in the subprocess module

2020-06-28 Thread Eryk Sun
Eryk Sun added the comment: > However, the API is a bit weird. Unlike Unix, when you create a > Windows pty, there's no way to directly get access to the "slave" > handle. Instead, you first call CreatePseudoConsole to get a > special "HPCON" object,

[issue41106] os.scandir() Windows bug dir_entry.stat() not works on file during writing.

2020-07-01 Thread Eryk Sun
Eryk Sun added the comment: > As far as I know os.stat() resets d.stat() maybe should be added > some option to d.stat() to force update(). d.stat(nt_force_update=True). It depends on the filesystem. NTFS will update the directory entry as soon as the link is accessed by CreateFile

[issue41196] APPDATA directory is different in store installed python

2020-07-02 Thread Eryk Sun
Eryk Sun added the comment: > What it really means for apps that are trying to share state across > different Python runtimes is that they're not going to have such a > great time. I tried impersonating the token of Explorer in the current thread (i.e.

[issue26205] Better specify number of nested scopes

2020-07-06 Thread Eryk Sun
Eryk Sun added the comment: > There is one local namespace for each class and function. There is one > nonlocal namespace for each nested function. In the first sentence, replace "class" with "class statement" and "function" with "function cal

[issue41221] io.TextIOWrapper ignores silently partial write if buffer is unbuffered

2020-07-08 Thread Eryk Sun
Eryk Sun added the comment: > it’s probably an even bigger problem on Windows, where writes might be > limited to 32767 bytes: This check and workaround in _Py_write_impl doesn't affect disk files and pipes. It only affects character devices for which isatty is true, and really

[issue30044] shutil.copystat should (allow to) copy ownership, and other attributes

2020-07-10 Thread Eryk Sun
Eryk Sun added the comment: In Windows, I wouldn't expect shutil.copy2 to preserve the owner and ACLs. They change whenever a file gets copied via CopyFileExW [1]. Keeping them exactly as in the source file generally requires a privileged backup and restore operation, such as via Backu

[issue41298] Enable handling logoff and shutdown Windows console events

2020-07-14 Thread Eryk Sun
New submission from Eryk Sun : A console script should be able to handle Windows console logoff and shutdown events with relatively simple ctypes code, such as the following: import ctypes kernel32 = ctypes.WinDLL('kernel32', use_last_error=True) CTRL_C

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2020-07-15 Thread Eryk Sun
Eryk Sun added the comment: > On the smaller scale, it looks quantized to multiples of ~15ms (?), > but then it gets more accurate as the times get larger. I don't > think it's a measurement error since the first measurement manages > microseconds. NT's default

[issue41299] Python3 threading.Event().wait time is twice as large as Python27

2020-07-15 Thread Eryk Sun
Eryk Sun added the comment: > or 500 us with the undocumented NtSetSystemTime system call Umm... that should be NtSetTimerResolution. ;-) -- ___ Python tracker <https://bugs.python.org/issu

[issue29778] [CVE-2020-15523] _Py_CheckPython3 uses uninitialized dllpath when embedder sets module path with Py_SetPath

2020-07-18 Thread Eryk Sun
Eryk Sun added the comment: > If you can put files in the root of the hard drive where Windows was > installed, surely you have other, easier attack vectors. A rooted path is resolved relative to the process working directory, and Python can be started with any current working dir

[issue29778] [CVE-2020-15523] _Py_CheckPython3 uses uninitialized dllpath when embedder sets module path with Py_SetPath

2020-07-20 Thread Eryk Sun
Eryk Sun added the comment: > I still don't understand why this is considered a Python security problem. > If the user can put a malicious "python3.dll" at some arbitrary spot in > the filesystem (e.g. a USB flash drive), and fool Python.exe into loading > it, th

[issue30044] shutil.copystat should (allow to) copy ownership, and other attributes

2020-07-20 Thread Eryk Sun
Eryk Sun added the comment: > Since the need to copy file ownership is common, I think there could > be space for a new copy3() function which copies ownership + extended > attributes (where possible). FYI, Windows and POSIX have significantly different concepts about file (object)

[issue41327] Windows Store "stub" Python executables give confusing behaviour

2020-07-21 Thread Eryk Sun
Eryk Sun added the comment: > there would still be value in having a known reporting channel Windows 10 has a "Feedback Hub" to report problems and search for existing feedback that's similar. You could report a problem with the "AppInstaller" app. In this c

[issue41327] Windows Store "stub" Python executables give confusing behaviour

2020-07-21 Thread Eryk Sun
Eryk Sun added the comment: > This is exactly what it does. The fact that it is SUBSYSTEM:WINDOWS Sorry, I neglected to check: C:\>python3 script.py 2>&1 | more Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?l

[issue41365] Python Launcher is sorry to say... No pyvenv.cfg file

2020-07-22 Thread Eryk Sun
Eryk Sun added the comment: > "Python Launcher is sorry to say... No pyvenv.cfg file" As already mentioned, that it fails with this error means you're running a virtual-environment launcher instead of a base Python executable. That it displays a message box means you ran

[issue41365] Python Launcher is sorry to say... No pyvenv.cfg file

2020-07-23 Thread Eryk Sun
Eryk Sun added the comment: > The default association should go to pyw.exe, which is likely in > your C:\Windows directory. However, don't browse for pyw.exe. That will create a new progid that doesn't support command-line arguments or a shell drop handler. You should select

[issue41386] Popen.wait does not account for negative return codes

2020-07-24 Thread Eryk Sun
Eryk Sun added the comment: In the Windows API, errors and exit status codes are all unsigned 32-bit integers. See SetLastError, GetLastError, ExitThread, ExitProcess, GetExitCodeThread, and GetExitCodeProcess. Even signed NTSTATUS and HRESULT values are commonly displayed as non-negative

[issue41386] Popen.wait does not account for negative return codes

2020-07-27 Thread Eryk Sun
Eryk Sun added the comment: > in the windows API they seam to not know whether to use a ulong or a uint This usage requires C `long int` to be the same size as `int` in 64-bit Windows. -- resolution: -> not a bug ___ Python tracker

[issue41412] After installation on Windows7, 64bit Python 3.9.0b5 reports "api-ms-win-core-path-l1-1-0.dll" missing and doesn't start

2020-07-27 Thread Eryk Sun
Eryk Sun added the comment: > running python.exe results in an error message popup which tells me ... > that the "api-ms-win-core-path-l1-1-0.dll" is missing on the computer. > I googled for it and it seems that this dll is not a part of Windows 7. Microsoft ended e

[issue41355] os.link(..., follow_symlinks=False) without linkat(3)

2020-07-27 Thread Eryk Sun
Eryk Sun added the comment: I'm trying to give os.link() and follow_symlinks the benefit of the doubt, but the implementation just seems buggy to me. POSIX says that "[i]f path1 names a symbolic link, it is implementation-defined whether link() follows the symbolic link, or cre

[issue41355] os.link(..., follow_symlinks=False) without linkat(3)

2020-07-28 Thread Eryk Sun
Eryk Sun added the comment: > Isn't that a backwards-incompatible change? So, do you think it should just be documented that follow_symlinks is effectively ignored with os.link() on most platforms that claim to support it, unless either src_dir_fd or dst_dir_fd is used? I'd

[issue41437] SIGINT blocked by socket operations like recv on Windows

2020-07-29 Thread Eryk Sun
Eryk Sun added the comment: Winsock is inherently asynchronous. It implements synchronous functions by using an alertable wait for the completion of an asynchronous I/O request. Python doesn't implement anything for a console Ctrl+C event to alert the main thread when it's blo

[issue41448] pathlib behave differ between OS

2020-07-31 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> pathlib.Path.resolve(strict=False) returns relative path on Windows if the entry does not exist ___ Python tra

[issue41466] Windows installer: "Add to PATH" should be checked by default

2020-08-03 Thread Eryk Sun
Eryk Sun added the comment: Managing multiple Python installations in PATH is problematic, so by default the installer doesn't modify PATH. Instead, the "py.exe" launcher [1] is made available, which can run any registered installation of Python. Using a launcher f

[issue41466] Windows installer: "Add to PATH" should be checked by default

2020-08-03 Thread Eryk Sun
Change by Eryk Sun : -- components: +Installation status: open -> versions: +Python 3.10, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issu

[issue41303] perf_counter result does not count system sleep time in Mac OS

2020-08-06 Thread Eryk Sun
Eryk Sun added the comment: > Does the same apply for time.monotonic? I would argue that the > difference in behavior between Linux/macOS and Windows is > unreasonable; given that time.monotonic exists for measuring time > intervals For time.monotonic in Windows, Python cou

[issue41509] ntpath.relpath behaves differently on Windows with trailing spaces

2020-08-08 Thread Eryk Sun
Eryk Sun added the comment: > I suspect the Windows version is using some API that strips whitespace > from the filename before performing a relative path. When normalizing a path, the Windows API strips trailing dots and spaces from the final component. Apparently it also strips a

[issue41565] from os.path import join join('3', '{:3') return '{:3' in windows

2020-08-17 Thread Eryk Sun
Eryk Sun added the comment: > I'm not sure if "}" could ever be valid drive letter The Windows file API is designed in a way to support almost any Unicode BMP character in a DOS drive designation. For example, the following creates "{:" as a su

[issue41565] from os.path import join join('3', '{:3') return '{:3' in windows

2020-08-18 Thread Eryk Sun
Eryk Sun added the comment: > I mean,os.path.join('3', '{:3') return '{:3' in windows, However, > os.path.join('3', '{:3') return '3/{:3'in linux, output result not > '3' in windows, why? The implementation of

[issue41565] from os.path import join join('3', '{:3') return '{:3' in windows

2020-08-18 Thread Eryk Sun
Eryk Sun added the comment: It's worth mentioning that pathlib restricts the first character of a Windows drive name to the set of ASCII letters in pathlib._WindowsFlavour.drive_letters. For example: >>> Path('3') / 'C:3' WindowsPath(&#x

[issue41565] from os.path import join join('3', '{:3') return '{:3' in windows

2020-08-18 Thread Eryk Sun
Change by Eryk Sun : -- status: open -> closed type: compile error -> behavior ___ Python tracker <https://bugs.python.org/issue41565> ___ ___ Python-bugs-

[issue41619] Subprocesses created with DETACHED_PROCESS can pop up a console window

2020-08-23 Thread Eryk Sun
Eryk Sun added the comment: Creating the py.exe process with creationflags=DETACHED_PROCESS sets a special ConsoleHandle value in its ProcessParameters that makes the base API skip allocating a console session at process startup. However, the launcher itself spawns python.exe normally

[issue41619] Subprocesses created with DETACHED_PROCESS can pop up a console window

2020-08-23 Thread Eryk Sun
Eryk Sun added the comment: I suppose that, in addition to fixing the bug with si.dwFlags, code could be added to use DETACHED_PROCESS if GetConsoleCP() returns 0 (i.e. the launcher isn't attached to a console). -- ___ Python tracker &

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

2020-08-26 Thread Eryk Sun
Eryk Sun added the comment: Case-sensitive file access is potentially possible with FILE_FLAG_POSIX_SEMANTICS (CreateFileW) and FIND_FIRST_EX_CASE_SENSITIVE (FindFirstFileExW). These flags make the API omit the object-manager flag OBJ_CASE_INSENSITIVE in the NtCreateFile or NtOpenFile

[issue41686] C++ Embedded 'time.sleep()' is not working on Windows host due to 'Py_InitializeEx(0)'

2020-09-01 Thread Eryk Sun
Eryk Sun added the comment: The SIGINT event gets created when the _signal extension module is imported. Until then, _PyOS_SigintEvent() returns NULL. But currently all code that calls _PyOS_SigintEvent() assumes it returns a valid handle. This has to be fixed to support Py_InitializeEx(0

[issue41686] C++ Embedded 'time.sleep()' is not working on Windows host due to 'Py_InitializeEx(0)'

2020-09-02 Thread Eryk Sun
Eryk Sun added the comment: > Maybe in the time module? The SIGINT event is also needed by PyOS_Readline, _io (builtin), _winapi (builtin), and _multiprocessing (pyd). Is the time module guaranteed to be imported in 3.x? It appears to get imported incidentally via _PyImportZip_I

[issue41686] C++ Embedded 'time.sleep()' is not working on Windows host due to 'Py_InitializeEx(0)'

2020-09-02 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg376231 ___ Python tracker <https://bugs.python.org/issue41686> ___ ___ Python-bugs-list mailin

[issue41686] C++ Embedded 'time.sleep()' is not working on Windows host due to 'Py_InitializeEx(0)'

2020-09-02 Thread Eryk Sun
Eryk Sun added the comment: > Maybe in the time module? The SIGINT event is also needed by PyOS_Readline, _io (builtin), _winapi (builtin), and _multiprocessing (pyd). Is the time module guaranteed to be imported in 3.x? It appears to get imported incidentally via _PyImportZip_I

[issue41705] os.makedirs fails on long-path UNC-paths if it is the first sub-folder

2020-09-03 Thread Eryk Sun
Eryk Sun added the comment: This behavior is due to issue 37609, i.e. ntpath.splitdrive fails for "UNC" device paths. >>> ntpath.splitdrive('//?/UNC/server/share') ('//?/UNC', '/server/share') The result should be "//?/UNC/serve

[issue41729] test_winconsoleio fails and hangs on Windows

2020-09-06 Thread Eryk Sun
Eryk Sun added the comment: > ÄÄ^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z I don't know why Steve made write_input (PC/_testconsole.c) set wRepeatCount in each KeyEvent record to 10. Maybe it was a typo. Previous console implementations have ignored the repeat count, so it wasn't an issue.

[issue41737] Improper NotADirectoryError when opening a file under a fake directory

2020-09-07 Thread Eryk Sun
Eryk Sun added the comment: > if NotADirectoryError should be raised, it should mention '/path/to/file' > rather then '/path/to/file/somename.txt'. POSIX specifies that C open() should set errno to ENOTDIR when an existing path prefix component is neither a di

[issue41729] test_winconsoleio fails and hangs on Windows

2020-09-07 Thread Eryk Sun
Eryk Sun added the comment: > Is this line needed with a repeat of 1, or should it be removed? It's not documented what it means to write a key event with wRepeatCount set to 0. It happens to work, but I'd leave it set to 1, which means the key was pressed once. Ideally, ther

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Eryk Sun
Eryk Sun added the comment: > For this case, I think the best thing we can probably do is change the > default share mode for _all_ opens to include FILE_SHARE_DELETE. The C runtime doesn't provide a way to share delete access, except for the O_TEMPORARY flag, so Python would

[issue41753] subprocess.run on windows does not convert path to string

2020-09-09 Thread Eryk Sun
Eryk Sun added the comment: The underlying subprocess.Popen class was updated in 3.8 to support path-like objects in `args` (with shell=False) and `executable` on Windows [1]. This change was not backported to 3.6 and 3.7. --- [1] https://docs.python.org/3/library/subprocess.html

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Eryk Sun
Eryk Sun added the comment: > Why do we need to use this O_TEMPORARY flag at all? Using the O_TEMPORARY flag isn't necessary, but it's usually preferred because it ensures the file gets deleted even if the process is terminated abruptly. However, it opens the file with delet

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Eryk Sun
Eryk Sun added the comment: > Nothing preventing someone from contributing the flag on open as well. To be clear, supporting delete-access sharing would require re-implementing C _wopen in terms of CreateFileW, _open_osfhandle, etc. It could be implemented as _Py_wopen in Pyt

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-10 Thread Eryk Sun
Eryk Sun added the comment: > we'd have to reimplement the UCRT function using the system API. Could the implementation drop support for os.O_TEXT? I think Python 3 should have removed both os.O_TEXT and os.O_BINARY. 3.x has no need for the C runtime's ANSI text mode, wi

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-11 Thread Eryk Sun
Eryk Sun added the comment: > We'd CreateFile the file and then immediately pass it to > _open_osfhandle Unlike _wopen, _open_osfhandle doesn't truncate Ctrl+Z (0x1A) from the last byte when the flags value contains _O_TEXT | _O_RDWR. _wopen implements this to allow append

[issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy (pymain_run_module)

2020-09-16 Thread Eryk Sun
Eryk Sun added the comment: > The return code of python on linux when the program is ended with > a KeyboardInterrupt should be -2 In general, the exit status for an unhandled KeyboardInterrupt (i.e. _Py_UnhandledKeyboardInterrupt) should be the same as the default SIGINT handler. T

[issue41821] Printing specific Unicode characters causes unwanted beeping in Windows 7 console

2020-09-20 Thread Eryk Sun
Eryk Sun added the comment: If you've selected an OEM raster font in the console properties instead of a TrueType font (Consolas, Lucida Console, etc), then the console implements some magic to support the OEM character mapping in the raster font. The following shows that encodi

[issue41821] Printing specific Unicode characters causes unwanted beeping in Windows 7 console

2020-09-20 Thread Eryk Sun
Eryk Sun added the comment: > It is set to use an OEM raster font. Okay, then the issue can either be closed as third-party or changed to a documentation enhancement. It could be documented that Unicode support requires selecting a TrueType font in the console properties. "Raster Fon

[issue41821] Printing specific Unicode characters causes unwanted beeping in Windows 7 console

2020-09-21 Thread Eryk Sun
Eryk Sun added the comment: I've decided to close this issue since extending the "Using Python on Windows" section of the docs to recommend using a TrueType font in the console would only be generally useful for people using Python 3.8 with Windows 7. Python 3.9+ requi

[issue25655] Python errors related to failures loading DLL's lack information

2020-09-22 Thread Eryk Sun
Eryk Sun added the comment: > " OSError: [WinError 126] The specified module could not be found" is > raised when calling ctypes.CDLL(dll_path) even when this "dll_path" > exists... because the error comes from another DLL. That's the old error. bpo-360

[issue35144] TemporaryDirectory clean-up fails with unsearchable directories

2020-09-22 Thread Eryk Sun
Eryk Sun added the comment: It seems to me that if `path == name`, then resetperms(path) and possibly a recursive call are only needed on the first call. In subsequent calls, if `path == name`, then we know that resetperms(path) was already called, so it shouldn't handle PermissionErro

<    6   7   8   9   10   11   12   13   14   15   >