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

2021-03-02 Thread Eryk Sun
Eryk Sun added the comment: > But on this particular issue, making the unconditional wait be > interruptable by signals shouldn't be impossible. PyThread_acquire_lock_timed() in Python/thread_nt.h currently ignores intr_flag. The current implementation calls EnterNonRecursiveMutex(),

[issue43364] Add shortcut to enable UTF-8 mode in start menu.

2021-03-02 Thread Eryk Sun
Eryk Sun added the comment: > `cmd.exe /c "SETX PYTHONUTF8 1 You can run "[WindowsFolder]System32\setx.exe" directly. It's not a shell command. -- nosy: +eryksun ___ Python tracker <https://bugs.

[issue33515] subprocess.Popen on a Windows batch file always acts as if shell=True

2021-03-01 Thread Eryk Sun
Change by Eryk Sun : -- stage: patch review -> versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.org/issu

[issue19050] [Windows] fflush called on pointer to potentially closed file

2021-03-01 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue19050> ___ ___

[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2021-03-01 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: needs patch -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue8036] raise ValueError for empty `path` in os.spawnv[e]

2021-03-01 Thread Eryk Sun
Eryk Sun added the comment: The internal spawn function in ucrt, common_spawnv(), verifies its parameters as follows: _VALIDATE_RETURN(file_name != nullptr, EINVAL, -1); _VALIDATE_RETURN(file_name[0]!= '\0',EINVAL, -1); _VALIDATE_RETURN(arguments != nullptr

[issue34064] subprocess functions with shell=1 pass wrong command to win32 shell

2021-03-01 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> third party stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue33245] Unable to send CTRL_BREAK_EVENT

2021-03-01 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT) ___ Python tracker <https://bugs.python

[issue14597] Cannot unload dll in ctypes until script exits

2021-03-01 Thread Eryk Sun
Eryk Sun added the comment: Automatically decrementing the reference count of a shared library (e.g. via WinAPI FreeLibrary or POSIX dlclose) when a CDLL instance is finalized would require significant design changes to ensure that all ctypes pointers, scalars, and aggregates that reference

[issue33105] os.path.isfile returns false on Windows when file path is longer than 260 characters

2021-03-01 Thread Eryk Sun
Eryk Sun added the comment: I'm closing this as not a bug. If the process limits DOS paths to MAX_PATH, then checking os.path.isfile() should not be special cased to support longer DOS paths because calling open() on such a path will raise FileNotFoundError. My suggestion in msg314126

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

2021-03-01 Thread Eryk Sun
Eryk Sun added the comment: I'm changing this to a documentation issue and removing the Windows component. The documentation doesn't make it clear that communicate() may block indefinitely (in both POSIX and Windows) even after the process has terminated. As currently implemented

[issue43346] subprocess.run() sometimes ignores timeout in Windows

2021-02-28 Thread Eryk Sun
Eryk Sun added the comment: Demo Popen() methods, for discussion: def _read_output(self, fileobj): handle = msvcrt.get_osfhandle(fileobj.fileno()) output = self._fileobj2output[fileobj] while True: try: size

[issue43346] subprocess.run() sometimes ignores timeout in Windows

2021-02-28 Thread Eryk Sun
New submission from Eryk Sun : subprocess.run() handles TimeoutExpired by terminating the process and waiting on it. In POSIX, the exception object contains the partially read stdout and stderr bytes. For example: cmd = 'echo spam; echo eggs >&2; sleep 2' try: p = subprocess.

[issue31030] sys.executable can be not normalized

2021-02-27 Thread Eryk Sun
Eryk Sun added the comment: > If it was the tests, they seem to have been fixed elsewhere. The cited tests haven't been changed to work with non-normalized sys.executable, sys.prefix, etc. But it's not common to run the test suite with a non-normalized path such as "Lib/../buil

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

2021-02-27 Thread Eryk Sun
Change by Eryk Sun : -- components: +Library (Lib), Windows -Interpreter Core nosy: +paul.moore, steve.dower, tim.golden, zach.ware versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.

[issue32795] subprocess.check_output() with timeout does not exit if child process does not generate output after timeout

2021-02-27 Thread Eryk Sun
Eryk Sun added the comment: Issue 37424 fixed this for Python 3.7+ in POSIX. It's still broken in Windows, for which I'm leaving issue 31447 open. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed superseder: -> subprocess.run timeout does

[issue31030] sys.executable can be not normalized

2021-02-27 Thread Eryk Sun
Eryk Sun added the comment: In Python 3.10 in POSIX, it's still the case that executable, prefix, exec_prefix, base_prefix, and base_exec_prefix in the sys module do not get normalized. For example, in Linux: $ .local/bin/../bin/python3.10 -c "import sys; print(sys.execu

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

2021-02-26 Thread Eryk Sun
Eryk Sun added the comment: This problem can be addressed most easily in _get_handles() by combining the case of an invalid standard handle with that of a NULL standard handle, for which a file handle is validated via GetFileType(). However, that leaves a small window for the handle

[issue29045] Outdated C api doc about Windows error

2021-02-26 Thread Eryk Sun
Eryk Sun added the comment: The documentation still has two references to PyErr_SetFromWindowsErrWithFilenameObject, which is not a defined function in the C API. https://docs.python.org/3.10/c-api/exceptions.html#c.PyErr_SetFromWindowsErrWithFilename -- components: +Windows nosy

[issue28474] WinError(): Python int too large to convert to C long

2021-02-26 Thread Eryk Sun
Eryk Sun added the comment: format_error() can use format "L" (long long) and then check for a value in the accepted range `value >= LONG_MIN && value <= ULONG_MAX`. If the value is out of range, raise OverflowError. Otherwise assign the value to DWORD `code`.

[issue28462] subprocess pipe can't see EOF from a child in case of a few children run with subprocess

2021-02-26 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue28462> ___ ___

[issue24045] Behavior of large returncodes (sys.exit(nn))

2021-02-26 Thread Eryk Sun
Eryk Sun added the comment: It's still the case in 3.10 that unsigned status codes are limited to 0x7FFF_, and any larger value gets mapped to -1 (0x_). For example: >>> rc = subprocess.call([sys.executable, '-c', 'raise SystemExit(0x7FFF_)']) &

[issue27612] socket.gethostbyname resolving octal IP addresses incorrectly

2021-02-26 Thread Eryk Sun
Eryk Sun added the comment: Update from my previous comment in 2016: in Python 3.7+, the socket module's setipaddr() function calls Winsock inet_pton() instead of inet_addr(), and falls back on getaddrinfo(). Neither supports octal addresses. At least using octal fails instead of mistakenly

[issue27496] unicodedata.name() doesn't have names for control characters

2021-02-26 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.5, Python 3.6 ___ Python tracker <https://bugs.python.org/issue27

[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-02-26 Thread Eryk Sun
Eryk Sun added the comment: El Samuko, is that a Windows (Win32), Cygwin, MSYS2, WSL, or some other version of bash? The same for Python, and which version of Python is it. With these details, I can tell you what `os.kill($WINPID, signal.CTRL_C_EVENT)"` is probably

[issue27263] Tkinter sets the HOME environment variable, breaking scripts

2021-02-26 Thread Eryk Sun
Eryk Sun added the comment: ntpath.expanduser() no longer uses HOME (though the doc string still refers to $HOME), so at least that problem is resolved. I suppose IDLE could work around the HOME issue in Windows by passing env=os.environ.copy() in the subprocess.Popen() call that creates

[issue26565] [ctypes] Add value attribute to non basic pointers.

2021-02-26 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.6 ___ Python tracker <https://bugs.python.org/issue26565> ___ ___

[issue20010] time.strftime('%z') didn't make +HHMM return in windows xp

2021-02-26 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue20010> ___ ___

[issue11361] suggestion for os.kill(pid,CTRL_C_EVENT) in tests

2021-02-26 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker <https://bugs.python.org/issue11

[issue26158] File truncate() not defaulting to current position as documented

2021-02-26 Thread Eryk Sun
Change by Eryk Sun : -- type: -> behavior versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.5, Python 3.6 ___ Python tracker <https://bugs.python.org/issu

[issue20503] super behaviour and abstract base classes (either implementation or documentation/error message is wrong)

2021-02-26 Thread Eryk Sun
Eryk Sun added the comment: The docs still need to clarified that isinstance(obj, type) is a necessary but not sufficient condition for success. It would also be helpful if the error message were less confusing in the case of registered subclasses such as numbers.Number. -- type

[issue24747] ctypes silently truncates ints larger than C int

2021-02-26 Thread Eryk Sun
Change by Eryk Sun : -- type: -> behavior versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker <https://bugs.python.org/issu

[issue23425] Windows getlocale unix-like with french, german, portuguese, spanish

2021-02-26 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue23425> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23425] Windows getlocale unix-like with french, german, portuguese, spanish

2021-02-26 Thread Eryk Sun
Change by Eryk Sun : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.3, Python 3.4 ___ Python tracker <https://bugs.python.org/issue23

[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: > I'm not sure we ever meant for LoadLibrary("python3.dll") to > actively load the concrete python3X.dll. IIRC, Paul Moore was doing something like this to create a script runner that loads "python3.dll", which runs as a regular appl

[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg387686 ___ Python tracker <https://bugs.python.org/issue29399> ___ ___ Python-bugs-list mailin

[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: > The APIs are the same, so you can (should) LoadLibrary the one > that you want. The issue is that python3.dll doesn't depend on python3x.dll in the normal way. For example, LoadLibraryExW("path/to/python3.dll", NULL, LOAD_WITH_ALTERED_SEAR

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

2021-02-25 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> works for me stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue30979> ___ ___

[issue30460] file opened for updating cannot write after read

2021-02-25 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue30460> ___ ___

[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: This issue affects Windows 7 and earlier, so I'm changing the affected version to Python 3.8, the last version to support Windows 7. I don't have access to Windows 7 currently. If someone has access to an updated Windows 7 installation (all required and optional

[issue22302] Windows os.path.isabs UNC path bug

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: > figure out whether to do `Path.cwd() / path` Thus a UNC path is absolute, i.e. any path that starts with 2 or more slashes, and all other paths are relative unless they have both a drive and a root. For example: def isabs(s): """T

[issue28708] Low FD_SETSIZE limit on Windows

2021-02-25 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg387680 ___ Python tracker <https://bugs.python.org/issue28708> ___ ___ Python-bugs-list mailin

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

2021-02-25 Thread Eryk Sun
Change by Eryk Sun : Removed file: https://bugs.python.org/file48607/splitdrive.py ___ Python tracker <https://bugs.python.org/issue37609> ___ ___ Python-bugs-list mailin

[issue28824] os.environ should preserve the case of the OS keys ?

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: In Windows, maybe the os.environ mapping could use a case-insensitive subclass of str for its keys, such as the following: @total_ordering class _CaseInsensitiveString(str): def __eq__(self, other): if not isinstance(other, str

[issue28654] sys.stdout.isatty() returns True even if redirected to NUL

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: Here's an example of how to change the isatty() method in Modules/_io/fileio.c to check for a console in Windows: _io_FileIO_isatty_impl(fileio *self) { long res; if (self->fd < 0) return err_

[issue28364] Windows - Popen (subprocess.py) does not call _handle.Close() at all

2021-02-25 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue28364> ___ ___

[issue28356] Windows: os.rename different in python 2.7.12 and python 3.5.2

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: The documentation of os.rename() should mention that on Windows the "operation will fail if src and dst are on different filesystems". For POSIX, instead of "will" it says "may", but the failure is a certainty in Windows since MO

[issue27889] ctypes interfers with signal handling

2021-02-25 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue27889> ___ ___

[issue20140] UnicodeDecodeError in ntpath.py when home dir contains non-ascii signs

2021-02-25 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: needs patch -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue17213] ctypes loads wrong version of C runtime, leading to error message box from system

2021-02-25 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: needs patch -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue26968] glob.glob incorrect results under windows when pathname exists but interpreter does not have access permissions to pathname

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: Issue 28075 extended the os.stat() and os.lstat() implementation to query basic stat informatiom from the parent directory if opening the file fails with ERROR_ACCESS_DENIED. This change first became available in Python 3.5.3. Previously it was only querying

[issue26866] Inconsistent environment in Windows using "Open With"

2021-02-25 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> third party stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue26866> ___ ___

[issue26658] test_os fails when run on Windows ramdisk

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: os.stat() was redesigned in issue 37834, which entailed extensive updates across the standard library to improve support for Windows reparse points. As part of this, Win32JunctionTests.tearDown() was changed to use a more reliable lexists() check, which resolves

[issue25585] Bad path leads to: ImportError: DLL load failed: %1 is not a valid Win32 application.

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: In 3.8+, the DLL search path for dependent DLLs when importing extension modules excludes PATH and the current working directory. So it's far less likely for an import to fail with ERROR_BAD_EXE_FORMAT. Currently the error message in Python 3 includes the base

[issue26111] On Windows, os.scandir will keep a handle on the directory until the iterator is exhausted

2021-02-24 Thread Eryk Sun
Eryk Sun added the comment: Issue 25994 added support for the context-manager protocol and close() method in 3.6. So it's at least much easier to ensure that the handle gets closed. The documentation of scandir() links to WinAPI FindFirstFile and FindNextFile, which at least mentions

[issue13368] Possible problem in documentation of module subprocess, method send_signal

2021-02-24 Thread Eryk Sun
Eryk Sun added the comment: Popen.send_signal() documents that sending CTRL_C_EVENT (cancel) to a process group is possible, which is clearly a true statement and easily demonstrated. OTOH, the Windows documentation of GenerateConsoleCtrlEvent() claims it's not possible. If you know what

[issue24493] subprocess with env=os.environ doesn't preserve environment variables when calling a 32bit process on Windows 8.1

2021-02-24 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> third party stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue24493> ___ ___

[issue24977] shutil copy to non-existant directory

2021-02-24 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> shutil.copy raises IsADirectoryError when the directory does not actually exist ___ Python tracker <https://bugs.python

[issue22080] Add windows_helper module helper

2021-02-24 Thread Eryk Sun
Eryk Sun added the comment: I rewrote windows_helper.py with cleaner ctypes code, better error handling, the correct implementation of restoring the previous privilege state, and without leaking the handle for the process token. It's kind of limited as a "Windows helper" module.

[issue23634] os.fdopen reopening a read-only fd on windows

2021-02-24 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue23634> ___ ___

[issue43115] locale.getlocale fails if locale is set

2021-02-23 Thread Eryk Sun
Eryk Sun added the comment: > All getlocale is used for in _strptime.py is comparing the value > returned to the previous value returned. Which is why _strptime should be calling setlocale(LC_TIME), the same as the calendar module. That's not to say that I don't think get

[issue37198] _parse_localename fail to parse 'en_IL'

2021-02-23 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg345454 ___ Python tracker <https://bugs.python.org/issue37198> ___ ___ Python-bugs-list mailin

[issue22673] document the special features (eg: fdclose=False) of the standard streams

2021-02-23 Thread Eryk Sun
Change by Eryk Sun : -- components: +IO versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python 3.5 ___ Python tracker <https://bugs.python.org/issue22

[issue22976] multiprocessing Queue empty() is broken on Windows

2021-02-23 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue22976> ___ ___

[issue22961] ctypes.WinError & OSError

2021-02-23 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue22961> ___

[issue22299] resolve() on Windows makes some pathological paths unusable

2021-02-23 Thread Eryk Sun
Eryk Sun added the comment: ntpath.realpath() has since been implemented, and it addresses the problem by keeping the extended (verbatim) path prefix in the result if the input argument has it, and otherwise removing the prefix if the final path resolves correctly without

[issue43298] Windows build cannot detect missing Windows SDK

2021-02-22 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg387522 ___ Python tracker <https://bugs.python.org/issue43298> ___ ___ Python-bugs-list mailin

[issue43298] Windows build cannot detect missing Windows SDK

2021-02-22 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg387525 ___ Python tracker <https://bugs.python.org/issue43298> ___ ___ Python-bugs-list mailin

[issue43298] Windows build cannot detect missing Windows SDK

2021-02-22 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg387521 ___ Python tracker <https://bugs.python.org/issue43298> ___ ___ Python-bugs-list mailin

[issue43302] spam

2021-02-22 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> not a bug stage: -> resolved status: open -> closed title: shutil. copy file throws incorrect SameFileError on Google Drive File Stream -> spam ___ Python tracker <https://bugs.python

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

2021-02-22 Thread Eryk Sun
Eryk Sun added the comment: On second thought, I think it's cleaner and avoids potential race conditions to implement ntpath.sameopenfile(). Then use that to implement ntpath.samefile(). Here's a summary of suggested changes, with sample code to flesh out the concepts: * Extend nt

[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2021-02-21 Thread Eryk Sun
Eryk Sun added the comment: Here's an implementation of attributes_from_dir() that strips trailing slashes (e.g. "C:/spam///" -> "C:/spam"), which entails copying the const string up to the last character that's not a slash. Rooted paths and drive paths that ref

[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Eryk Sun
Eryk Sun added the comment: > Isn't `PyUnicode_GET_LENGTH(text) < self->chunk_size` enough? Yes, that's simpler, except with `<=`" instead of `<`, since the maximum count is chunk_size when pending_bytes is a list or ASCII string. When I wrote the more complex

[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Eryk Sun
Eryk Sun added the comment: > In your code, huge data passed to .write(huge) may be > remained in the internal buffer. If you mean the buffered writer, then I don't see the problem. A large bytes object in pending_bytes gets temporarily referenced by _textiowrapper_writeflush(), an

[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Eryk Sun
Eryk Sun added the comment: > stdout.write("small text") > stdout.write("very large text") # Calls writeflush, but can not allocate > buffer. Without the optimization, in most cases this will likely fail in _io_TextIOWrapper_write_impl() at the line `b =

[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Eryk Sun
Eryk Sun added the comment: Issue 36748 added the ASCII optimization in write(), so I'm adding Inada Naoki to the nosy list. -- nosy: +methane ___ Python tracker <https://bugs.python.org/issue43

[issue43260] Never release buffer when MemoryError in print()

2021-02-19 Thread Eryk Sun
Eryk Sun added the comment: The sys.stdout TextIOWrapper is stuck in a bad state. When the write() method is called with an ASCII string, it implements an optimization that stores a reference to the str() object in the internal pending_bytes instead of immediately encoding the string

[issue41847] Update "install launcher for all users" installer option

2021-02-18 Thread Eryk Sun
Eryk Sun added the comment: > but at least for clean installs of 3.10 we can avoid the need > for admin completely Except updating PATHEXT always requires admin access. I do this manually by setting a user PATHEXT variable with %PATHEXT% as the first item and append the extensions

[issue43115] locale.getlocale fails if locale is set

2021-02-18 Thread Eryk Sun
Eryk Sun added the comment: > The APIs were written at a time where locale modifiers > simply did mot exist. Technically, locale modifiers did exist circa 2000, but I suppose you mean that they were uncommon to the point of being unheard of at the time. The modifier field was spe

[issue43115] locale.getlocale fails if locale is set

2021-02-18 Thread Eryk Sun
Eryk Sun added the comment: > Is this the same as the other issue where get_locale is normalising > the result according to some particular glibc logic and isn't at > all portable? If I understand Anders' immediate problem correctly, I think it can be addressed by using setlocale(

[issue43115] locale.getlocale fails if locale is set

2021-02-17 Thread Eryk Sun
Eryk Sun added the comment: > What does use getlocale is time.strptime and datetime.datetime.strptime calendar.LocaleTextCalendar also uses getlocale() and getdefaultlocale(). The result from getdefaultlocale() cannot be set via setlocale() in Windows, which also breaks resetloc

[issue43219] shutil.copy raises IsADirectoryError when the directory does not actually exist

2021-02-16 Thread Eryk Sun
Eryk Sun added the comment: I left this open in case someone wants to modify shutil.copy() and shutil.copy2() to raise a less misleading exception when `dst` names a non-existing directory such as 'not_a_dir/'. Failing with IsADirectoryError (errno EISDIR) is confusing since shutil.copy

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread Eryk Sun
Eryk Sun added the comment: Can't there be a library named "libc" with the shared module "liblibc.so"? It seems to me that the _is_elf() function added in issue 41976 is breaking the contract that "[i]f no library can be found, returns None". It's not supposed

[issue42580] ctypes.util.find_library("libc") fails

2021-02-16 Thread Eryk Sun
Eryk Sun added the comment: Issue 41976 added ctypes.util._is_elf() to filter out linker scripts such as "libc.so". The PR was backported to 3.7. _is_elf() assumes the trace result has absolute paths that can be opened, but Matthias is getting the relative filename "liblibc.a

[issue43175] filecmp is not working for UTF-8 BOM file.

2021-02-16 Thread Eryk Sun
Eryk Sun added the comment: The two files in "files.zip" have the same contents: >>> open('source.css', 'rb').read() == open('destination.css', 'rb').read() True Maybe there's something peculiar about the stat results. Check that they're both reported as regular

[issue43236] Windows IDLE taskbar icon jump list fails to open recent files

2021-02-16 Thread Eryk Sun
Eryk Sun added the comment: The IDLE shortcut that's installed by the development distribution runs `"\pythonw.exe" "\Lib\idlelib\idle.pyw"`. Thus opening a file that's pinned to the jumplist will execute it as a script via "pythonw.exe". To integrate bette

[issue35026] Winreg's documentation lacks mentioning required permission at some points

2021-02-15 Thread Eryk Sun
Eryk Sun added the comment: winreg.DeleteKey[Ex] does not require any particular access on the `key` handle. This handle is used only as the native NT API RootDirectory [1] when opening `subkey` with DELETE access via NtOpenKeyEx [2]. The extra access with winreg.DeleteKeyEx [3] is just

Re: Venv behaviour change py3.9

2021-02-15 Thread Eryk Sun
On 2/15/21, Abdur-Rahmaan Janhangeer wrote: > > I downloaded Python 3.9 yesterday, added the root folder to path > renamed python.exe to py39.exe and did > py39 -m venv venv > the output was > No such file or directory but i dont remember the exact phrase Probably you downloaded the embedded

[issue43221] German Text Conversion Using Upper() and Lower()

2021-02-13 Thread Eryk Sun
Eryk Sun added the comment: Python uses standard Unicode character properties, as defined by the Unicode Consortium. This issue is discussed in their FAQ [1]: Q: Why does ß (U+00DF LATIN SMALL LETTER SHARP S) not uppercase to U+1E9E LATIN CAPITAL LETTER SHARP S by default

[issue43219] shutil.copy raises IsADirectoryError when the directory does not actually exist

2021-02-13 Thread Eryk Sun
Eryk Sun added the comment: > IsADirectoryError: [Errno 21] Is a directory: 'not_a_dir/' The trailing slash forces the OS to handle "not_a_dir" as a directory [1]. A pathname that contains at least one non- character and that ends with one or more trailing cha

[issue43105] Can't import extension modules resolved via relative paths in sys.path on Windows

2021-02-12 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.7 ___ Python tracker <https://bugs.python.org/issue43105> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43105] Can't import extension modules resolved via relative paths in sys.path on Windows

2021-02-12 Thread Eryk Sun
Eryk Sun added the comment: > and it happens that "pkg" is found in a folder that is > given in sys.path as a relative path I'd prefer that Python disallowed relative paths in sys.path [1]. But since they're allowed, I think importlib at least could try to resolve relative

[issue43208] Ctypes._FuncPtr.restype doesn't handle NoneType correctly

2021-02-12 Thread Eryk Sun
Eryk Sun added the comment: NoneType would have to be replaced with None in make_funcptrtype_dict() and PyCFuncPtr_set_restype() in Modules/_ctypes/_ctypes.c. In the C API, NoneType is (PyObject *)&_PyNone_Type. -- nosy: +eryksun ___ Py

[issue43140] built-in open() doesn't use locale.getpreferredencoding() as the default encoding

2021-02-12 Thread Eryk Sun
Eryk Sun added the comment: > If my understanding is right, the open() will invoke > locale.getpreferredencoding() by setting the do_setlocale=False > -- i.e. locale.getpreferredencoding(False) -- to avoid invoking > setlocale(LC_CTYPE, ""). Yes, that's the

[issue43195] Same userbase for 32bit and 64bit install on Windows causing conflicts

2021-02-10 Thread Eryk Sun
Eryk Sun added the comment: The conflict between 32-bit and 64-bit user site-packages was resolved in issue 41627, starting with Python 3.10. It's not practical to backport this change to existing 3.9 installations. The "nt_user" install scheme was changed to use the confi

[issue43173] Python Windows DLL search paths

2021-02-08 Thread Eryk Sun
Eryk Sun added the comment: > What's the correct way to set the DLL search path when running a python > script? If possible, the simplest approach is to put dependent DLLs in the same directory as the extension module. In 3.8+, the search path for the dependent DLLs of a normally im

[issue43170] wintypes.SIZE is 8bytes on 32 bit machines

2021-02-08 Thread Eryk Sun
Eryk Sun added the comment: The SIZE [1] type for a rectangle has nothing to do with SIZE_T [2], the integer type that's returned by C sizeof(). SIZE_T isn't defined in wintypes. A new issue can be opened to add more of the common data types to wintypes. Here's an example for defining

[issue43140] built-in open() doesn't use locale.getpreferredencoding() as the default encoding

2021-02-05 Thread Eryk Sun
Change by Eryk Sun : -- components: +IO, Library (Lib) title: build-in open() doesn't use whatever locale.getpreferredencoding() returns as default encoding. -> built-in open() doesn't use locale.getpreferredencoding() as the default encoding versions: +Python 3

[issue43140] build-in open() doesn't use whatever locale.getpreferredencoding() returns as default encoding.

2021-02-05 Thread Eryk Sun
Eryk Sun added the comment: On most platforms, unless UTF-8 mode is enabled, locale.getpreferredencoding(False) returns the LC_CTYPE encoding of the current locale. For example, in Linux: >>> locale.setlocale(locale.LC_CTYPE, 'en_US.UTF-8') 'en

[issue42464] Pathlib resolve() resolves non-existent ".." components with strict=False

2021-02-01 Thread Eryk Sun
Eryk Sun added the comment: I'd prefer to leave ".." in the path, at least with PosixPath. (It doesn't matter with WindowsPath.) The "there" component may be a symlink that's currently inaccessible. That said, Python's os.path.realpath() has a long history

<    4   5   6   7   8   9   10   11   12   13   >