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

2020-05-18 Thread Eryk Sun
Eryk Sun added the comment: > For "python.exe", run as "py.exe", which is subject to shebangs, > VIRTUAL_ENV, and PY_PYTHON. Maybe in the "python[w].exe" case, it should skip shebang processing. That way only py[w].exe would handle shebangs, such as

[issue42481] Add to pathlib function to check permission similar to os.access

2020-11-27 Thread Eryk Sun
Eryk Sun added the comment: > os.access() is not a good and sufficient permission check. It > only checks DAC (discrete access control) permissions That's interesting. In Linux, for example, I would expect the access() and faccessat() system calls to also check mandatory per

[issue42493] pathlib.Path.__eq__ should test normalized path

2020-11-28 Thread Eryk Sun
Eryk Sun added the comment: The __eq__ method would have to do a full resolve(), which is expensive and may fail. One can't simply resolve "/foo/symlink/.." as "/foo", where "symlink" is a filesystem symlink. The target has to be resolved before &quo

[issue42493] pathlib.Path.__eq__ should test normalized path

2020-11-28 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> rejected type: behavior -> enhancement ___ Python tracker <https://bugs.python.org/issue42493> ___ ___ Python-bugs-

[issue42499] python not correctly processing double quotes in command line args in windows

2020-11-28 Thread Eryk Sun
Eryk Sun added the comment: Python uses the Windows C runtime to parse the command line into an argument array. By the CRT rules [1], you need to escape the embedded double quotes using backslashes. For example: PS C:\> python -c 's = \"fn main() {\"; s += \"\n\&q

[issue42497] New pathlib.Path attribute

2020-11-30 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Add to pathlib function to check permission similar to os.access ___ Python tracker <https://bugs.python

[issue42481] Add to pathlib function to check permission similar to os.access

2020-11-30 Thread Eryk Sun
Eryk Sun added the comment: > takes extended file attributes like immutable bit Just to clarify, immutable isn't an extended attribute. It's one of the flag values in a Linux inode, which is supported by some filesystems such as ext4. It's in the API as STATX_ATTR_IMMUTA

[issue42518] Error Message

2020-11-30 Thread Eryk Sun
Change by Eryk Sun : -- type: -> behavior ___ Python tracker <https://bugs.python.org/issue42518> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue42518] Error Message

2020-11-30 Thread Eryk Sun
Change by Eryk Sun : -- components: -Windows ___ Python tracker <https://bugs.python.org/issue42518> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23946] Invalid timestamps reported by os.stat() when Windows FILETIME structures are mistakenly reset.

2020-12-01 Thread Eryk Sun
Eryk Sun added the comment: > The code of posixmodule.c looks very different now. The conversion code was moved to FILE_TIME_to_time_t_nsec() in Python/fileutils.c. time_t is a signed 64-bit integer type, so there's no immediate problem storing 1601-01-01 as the negative (pre-epo

[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2020-12-04 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.10 ___ Python tracker <https://bugs.python.org/issue32381> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42568] Python can't run .pyc files with non-ASCII path on Windows

2020-12-04 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Python 3.6 cannot reopen .pyc file with non-ASCII path ___ Python tracker <https://bugs.python

[issue42569] Callers of _Py_fopen/_Py_wfopen may be broken after addition of audit hooks

2020-12-04 Thread Eryk Sun
Eryk Sun added the comment: > To implement PEP 446: create non-inheritable file descriptors. Side note. That aspect is still wonky in Windows, for which set_inheritable() cannot be implemented reliably since there's no way to change whether an existing CRT file descriptor is inh

[issue42648] subprocess: add a helper/parameter to catch exec() OSError exception

2020-12-15 Thread Eryk Sun
Eryk Sun added the comment: I suggesting changing the name to indicate that only OSError exceptions are suppressed, not SubprocessError exceptions. Maybe call it no_oserror. As to the status code to use, if you want a a common code that can't interfere, it has to be either a negative

[issue42529] CPython DLL initialization routine failed from PYC cache file

2020-12-18 Thread Eryk Sun
Eryk Sun added the comment: > ImportError: DLL load failed while importing _jpype: > A dynamic link library (DLL) initialization routine failed. With loader snaps enabled for python[_d].exe (i.e. loader debug messages), you can attach a debugger to discover which DLL's init

[issue42529] CPython DLL initialization routine failed from PYC cache file

2020-12-19 Thread Eryk Sun
Eryk Sun added the comment: I built JPype normally in release mode and was able to analyze the problem using the platform debugger (cdb or WinDbg). I think the issue is pretty straight forward. The static initializer for classMagic in "native\python\pyjp_class.cpp" is calling

[issue42707] Python uses ANSI CP for stdio on Windows console instead of using console or OEM CP

2020-12-22 Thread Eryk Sun
Eryk Sun added the comment: > I understand Python should be using reading the current CP (from > GetConsoleOutputCP > or using the default OEM CP, and not assuming ANSI CP for stdio A while ago I analyzed text encodings used by many of the legacy CLI programs in Windows. Some prog

[issue42707] Python uses ANSI CP for stdio on Windows console instead of using console or OEM CP

2020-12-22 Thread Eryk Sun
Eryk Sun added the comment: > How about treating only UTF-8 and leave legacy environment as-is? > * When GetConsoleCP() returns CP_UTF8, use UTF-8 for stdin. > Otherwise, use ANSI. Okay, and also when GetConsoleCP() fails because there's no console (e.g. python.exe w/ DE

[issue42707] Python uses ANSI CP for stdio on Windows console instead of using console or OEM CP

2020-12-22 Thread Eryk Sun
Eryk Sun added the comment: > When there is no console, stdio should use the default textio > encoding that is ANSI for now. stdin, stdout, and stderr are special and can be special cased because they're used implicitly for IPC. They've always been acknowledged as special b

[issue42730] TypeError/hang inside of Time.Sleep() when _thread.interrupt_main()

2020-12-24 Thread Eryk Sun
Eryk Sun added the comment: When a process executes in the background from a non-interactive bash script, the initial handler for SIGINT is SIG_IGN (ignore). Prior to 3.7, _thread.interrupt_main() tries to trip SIGINT even when the C handler is set to SIG_IGN. But Python uses an integer

[issue42738] subprocess: don't close all file descriptors by default (close_fds=False)

2020-12-28 Thread Eryk Sun
Eryk Sun added the comment: > Python 3.7 added the support for the PROC_THREAD_ATTRIBUTE_HANDLE_LIST > in subprocess.STARTUPINFO: lpAttributeList['handle_list'] parameter. The motivating reason to add support for the WinAPI handle list was to allow changing the default t

[issue42771] Implement interactive hotkey, Ctrl+L to clear the console in Windows.

2020-12-28 Thread Eryk Sun
Eryk Sun added the comment: > As the legacy cmd.exe can be easily replaced, that leaves python.exe. python.exe is a console application, which attaches to a console session. Since Windows 7, each console session is hosted by an instance of conhost.exe. The CMD shell (cmd.exe) is a cons

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

2020-12-29 Thread Eryk Sun
Eryk Sun added the comment: > "lowercase two strings by means of LCMapStringEx() and then wcscmp > the two" always gives the same result as "compare the two strings > with CompareStringOrdinal()" For checking case-insensitive equality, it shouldn't matt

[issue42796] tempfile doesn't seem to play nicely with os.chdir on Windows

2021-01-01 Thread Eryk Sun
Eryk Sun added the comment: > Windows doesn't let you remove files and directories that are used > by a process. Windows does allow deleting open files/directories, but read/execute, write/append, and delete/rename access have to be explicitly shared when opening a file o

[issue42796] tempfile doesn't seem to play nicely with os.chdir on Windows

2021-01-01 Thread Eryk Sun
Eryk Sun added the comment: > def test_chdir(): > with tempfile.TemporaryDirectory() as tempdir: > old = os.getcwd() > os.chdir(tempdir) > with open(os.path.join(tempdir, "delme")) as fout: > fout.write("Hello") &g

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

2021-01-06 Thread Eryk Sun
Eryk Sun added the comment: > For Windows though, I'm unsure. If copystat() gains the ability to copy the file's owner and group in POSIX, it is not a priority to mirror this capability in Windows, which doesn't implement anything like the Unix owner-group-other permissi

[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread Eryk Sun
Eryk Sun added the comment: > "http:" isn't a valid drive letter, I'd imagine. It's not a valid DOS drive, but that's not the problem. "http://w.org"; is parsed as a relative path. The double slashes are replaced by a single backslash, and the Win

[issue42855] pathlib.exists on Windows raises an exception on URL like/bad input

2021-01-07 Thread Eryk Sun
Eryk Sun added the comment: An alternative would be to add a "strict" parameter that defaults to False. In non-strict mode, map all OSError exceptions to a False return value. In strict mode, use _ignore_error(e) to determine whether to return False or propagate the exception. Th

[issue42872] Inconsistent exceptions thrown by pathlib.Path.mkdir on different OSes

2021-01-09 Thread Eryk Sun
Eryk Sun added the comment: NT filesystems are specified to fail with STATUS_OBJECT_PATH_NOT_FOUND (0xC03A) if a parent component in a path either does not exist or is not a directory. In the Windows API, this translates to ERROR_PATH_NOT_FOUND (3), which in the C runtime translates to

[issue42876] '''"""''' != '""""'

2021-01-09 Thread Eryk Sun
Eryk Sun added the comment: > assert '''"""''' == '""""' # Fails The left-hand side is a triple-quote string literal [1][2] that contains 3 double-quote characters. The right-hand side is a single-quote string

[issue42902] a python embedded program may load "C:\Lib\os.py" on windows system

2021-01-12 Thread Eryk Sun
Eryk Sun added the comment: > I still don't understand if the issue involves Py_SetPath() or not. It seems to me that this issue is concerned with the default behavior that looks for the "lib/os.py" landmark via search_for_prefix() in PC/getpathp.c. Starting at the image

[issue42929] On Windows, shutil.move doesn't raise FileExistsError if dst exists like os.rename

2021-01-14 Thread Eryk Sun
Eryk Sun added the comment: shutil.move() has always fallen back on copy/unlink if os.rename() fails. This used to be clearly documented to account for the behavior of os.rename() in Windows, but the details were obscured over multiple rewrites. Currently the documentation makes it seem

[issue42929] On Windows, shutil.move doesn't raise FileExistsError if dst exists like os.rename

2021-01-14 Thread Eryk Sun
Change by Eryk Sun : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware versions: +Python 3.10 ___ Python tracker <https://bugs.python.org/issue42

[issue42929] On Windows, shutil.move doesn't raise FileExistsError if dst exists like os.rename

2021-01-15 Thread Eryk Sun
Eryk Sun added the comment: I can help, but in this case there isn't much to do. Just replace os.rename() with os.replace(), make a minor doc change, and maybe add a test that ensures a junction can be moved over an existing file on the same filesystem. For example: >>>

[issue42957] os.readlink produces wrong result on windows

2021-01-18 Thread Eryk Sun
Eryk Sun added the comment: Symlinks and mountpoints (aka junctions) contain two forms of the target path. There's a path that's intended for display in the shell, and there's the actual substitute path to which the link resolves. os.readlink() was changed to return the

[issue42959] AttributeError: module 'signal' has no attribute 'SIGHUP'

2021-01-18 Thread Eryk Sun
Eryk Sun added the comment: FYI, Windows is not a POSIX operating system and does not implement Unix signals in the kernel. That said, the C language serves as a base level of cross-platform support for language runtimes across most operating systems, and there's significant cou

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

2021-01-18 Thread Eryk Sun
Eryk Sun added the comment: > 4. In console A, type the PID from console B and execute the command. In Windows, os.kill() is a rather confused function. In particular, it confuses a process ID (pid) with a process group ID (pgid). If the signal is CTRL_C_EVENT or CTRL_BREAK_EVENT, it fi

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

2021-01-19 Thread Eryk Sun
Eryk Sun added the comment: > I just reported it because the SystemError indicates that a C-API function > was returning non-NULL even after PyErr_Occurred() returns true Fixing the SystemError should be simple. Just clear an existing error if TerminateProcess() succeeds. > Window

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

2021-01-19 Thread Eryk Sun
Eryk Sun added the comment: > Should there be a `return NULL;` between these two lines? In 3.x, os.kill() has always fallen back on TerminateProcess() when GenerateConsoleCtrlEvent() fails, and I assumed that was intentional. But I misunderstood that it's not actually chaining the e

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

2021-01-19 Thread Eryk Sun
Eryk Sun added the comment: > That's what Lib/test/win_console_handler.py:39 does. No, that script is currently broken. SetConsoleCtrlHandler(None, False) clears the Ctrl+C ignore flag in the PEB ProcessParameters, which is normally inherited by child processes. But us

[issue42957] os.readlink produces wrong result on windows

2021-01-19 Thread Eryk Sun
Eryk Sun added the comment: os.readlink() was generalized to support mountpoints (junctions) as well as symlinks, and it's more common for mountpoints to lack the print name field in the reparse data buffer [1]. For example, PowerShell's new-item creates junctions that o

[issue42606] Support POSIX atomicity guarantee of O_APPEND on Windows

2021-01-19 Thread Eryk Sun
Eryk Sun added the comment: > os.write(fd) can't ... know that the fd was opened with O_APPEND It's possible to query the granted access of a kernel handle via NtQueryObject: ObjectBasicInformation -- not that I'm suggesting to use it. > the most serious one is rat

[issue42968] multiprocessing handle leak on Windows when child process is killed during startup/unpickling

2021-01-20 Thread Eryk Sun
Eryk Sun added the comment: I'm not fond of the way reduction.DupHandle() expects the receiving process to steal the duplicated handle. I'd prefer using the resource_sharer module, like reduction.DupFd() does in POSIX. Except spawning is a special case, for which reduction.DupHa

[issue42606] Support POSIX atomicity guarantee of O_APPEND on Windows

2021-01-21 Thread Eryk Sun
Eryk Sun added the comment: > can a new handle have non-default access rights? Or can the > default change at this point of Windows history? I don't know what you mean by default access rights. C open() requests generic access rights, which map to the standard and file-specifi

[issue42606] Support POSIX atomicity guarantee of O_APPEND on Windows

2021-01-21 Thread Eryk Sun
Eryk Sun added the comment: FYI, here are the access rights applicable to files, including their membership in generic (R)ead, (W)rite, and e(X)execute access: 0x0100_ --- ACCESS_SYSTEM_SECURITY 0x0010_ RWX SYNCHRONIZE 0x0008_ --- WRITE_OWNER 0x0004_

[issue42606] Support POSIX atomicity guarantee of O_APPEND on Windows

2021-01-22 Thread Eryk Sun
Eryk Sun added the comment: > I've found a catch via ProcessHacker: CreateFile() with > GENERIC_WRITE (or FILE_GENERIC_WRITE) additionally grants > FILE_READ_ATTRIBUTES for some reason. CreateFileW always requests at least SYNCHRONIZE and FILE_READ_ATTRIBUTES access. T

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

2021-01-23 Thread Eryk Sun
Eryk Sun added the comment: Thanks, Terry. I should have followed up with a short message asking for a core developer to sign off on that suggestion, in which case this is an "easy (C)" issue. -- ___ Python tracker <https://bu

[issue43022] Unable to dynamically load functions from python3.dll

2021-01-25 Thread Eryk Sun
Eryk Sun added the comment: "python3.dll" doesn't directly depend on "python39.dll", so the loader waits to load it until first accessed via GetProcAddress(). It should remember the activation context of "python3.dll", such as whether it was load

[issue43022] Unable to dynamically load functions from python3.dll

2021-01-25 Thread Eryk Sun
Eryk Sun added the comment: > So I need to dynamically load *both* python3.dll and python39.dll, > but if I do that I can get the functions from python3.dll? No, just load the fully-qualified name of "python3.dll", with the loader flags LOAD_LIBRARY_SEA

[issue43022] Unable to dynamically load functions from python3.dll

2021-01-25 Thread Eryk Sun
Eryk Sun added the comment: > h = LoadLibraryW(L"some/path/to/python3.dll") You should be using LoadLibraryExW(). It's a one-time call. You do not need to set the default flags via SetDefaultDllDirectories(). -- ___ Pyth

[issue43022] Unable to dynamically load functions from python3.dll

2021-01-25 Thread Eryk Sun
Eryk Sun added the comment: I noted that the path to "python3.dll" must be fully qualified. But let me stress that point. You cannot use the relative path "path/to/python3.dll" with LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR. The loader will fail the call as an invalid paramet

[issue43022] Unable to dynamically load functions from python3.dll

2021-01-25 Thread Eryk Sun
Eryk Sun added the comment: > uses a code snippet like this. PathAllocCombine() is Windows 8+, so sample code that uses it would only be for Python 3.9+. I'd prefer the function pointer to be returned as an out parameter, and return an HRESULT status as the result. If LoadLibrary

[issue42606] Support POSIX atomicity guarantee of O_APPEND on Windows

2021-01-26 Thread Eryk Sun
Eryk Sun added the comment: > So the idea is to delete the file for a brief period, but then > undelete it. Currently NTFS defaults to using classic delete semantics for delete-on-close. However, it supports POSIX delete semantics for delete-on-close, so the default could chang

[issue42939] Linux's chattr i.e. ioctl(FS_IOC_SETFLAGS) is not supported in os.chflags()

2021-01-30 Thread Eryk Sun
Eryk Sun added the comment: bpo-39533 is a related issue that seeks to support the Linux statx() system call. A statx record includes an stx_attributes field, which supports the following file attributes that can be set with chattr: [a]ppend: STATX_ATTR_APPEND [c]ompressed

[issue43091] console encode is not utf-8!!

2021-02-01 Thread Eryk Sun
Eryk Sun added the comment: I assume you're linking to the CRT dynamically, which is shared with "python39.dll", which means you're sharing the configured locale with Python. Since you're not using an isolated configuration, the LC_CTYPE locale will be set to t

[issue43095] Windows does not raise IsADirectoryError

2021-02-01 Thread Eryk Sun
Eryk Sun added the comment: When an open attempts to access a directory as data, the error code from WinAPI CreateFileW is ERROR_ACCESS_DENIED (5), which maps to C EACCES and thus raises Python PermissionError. Python's io.FileIO() type could handle an EACCES error in Windows by che

[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()

[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'

[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:

[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 examp

[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 normal

[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

[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

[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

[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

[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:

[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

[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? A

[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 to

[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 integ

[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.

[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

[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 no

[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 s

[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

[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

[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 specif

[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

[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

[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/is

[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: > 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(

[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 co

[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

[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: *

[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

[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

[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/msg387522 ___ Python tracker <https://bugs.python.org/issue43298> ___ ___ Python-bugs-list mailin

[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 it

[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> ___

[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> ___ ___

[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

[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

[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

[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> ___ ___

[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" mo

[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

[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> ___ ___

[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

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