[issue47203] ImportError: DLL load failed while importing binascii: %1 is not a valid Win32 application.

2022-04-05 Thread Eryk Sun
Eryk Sun added the comment: There is something fundamentally wrong with the way modules built into the interpreter DLL (python3x.dll) are loaded if anything in sys.path or the system PATH can cause an import to fail. -- ___ Python tracker <ht

[issue47203] ImportError: DLL load failed while importing binascii: %1 is not a valid Win32 application.

2022-04-03 Thread Eryk Sun
Eryk Sun added the comment: The user site packages directory is architecture specific starting with 3.10, e.g. "%AppData%\Python\Python310-32\site-packages". The PYTHONPATH environment variable is shared by all versions. However, I don't understand how the binascii mo

[issue47198] os.stat on windows doesn't take an open file even though os.stat in os.supports_fd

2022-04-01 Thread Eryk Sun
Eryk Sun added the comment: You're mistaken about what `fd` is. It's a TextIOWrapper, which wraps a BufferedWriter, which buffers a FileIO raw file object, which accesses the open file number fd.fileno(). For example: >>> f = open('tmp.tmp','w') >>> os.stat(f.filen

[issue47170] py launcher on windows opens new terminal window when parsing python script with shebang

2022-04-01 Thread Eryk Sun
Eryk Sun added the comment: > This is Windows (shell) behaviour. To avoid this, you need to > add the .py extension to the PATHEXT environment variable. PowerShell reuses the current console session only if .PY is set in PATHEXT. Otherwise Python gets executed with a flag that

[issue47161] pathlib method relative_to doesnt work with // in paths

2022-04-01 Thread Eryk Sun
Eryk Sun added the comment: > Hmm..., I get it, but Im not gonna lie it's pretty confusing given > that in other places `//` works as a substitute for `/`. Maybe it > should be mentioned in the documentation? In Linux, the system resolves "//" as just "/&

[issue39090] Document various options for getting the absolute path from pathlib.Path objects

2022-04-01 Thread Eryk Sun
Eryk Sun added the comment: > Now a file that doesn't exist: > >>> mike = Path("palin.jpg") > >>> mike.resolve() > WindowsPath('palin.jpg') This is a bug in resolve(). It was fixed in 3.10+ by switching to ntpath.realpath(). I don't remember w

[issue47134] Document the meaning of the number in OverflowError

2022-03-26 Thread Eryk Sun
Eryk Sun added the comment: The error code for `1e+300 ** 2` is ERANGE, from calling libm pow(). Since pow() returns a double, there's no way to indicate an error in the return value. Instead, C errno is set to 0 beforehand and checked for a non-zero error value after the call. If the error

[issue32642] add support for path-like objects in sys.path

2022-03-26 Thread Eryk Sun
Eryk Sun added the comment: > I've got in mind a PyListObject subclass with calls to PyOS_FSPath > before insert, append, extend and __getitem__. The sys module doesn't prevent rebinding sys.path. Most code I think is careful to update sys.path. But surely some code replaces it with

[issue47086] Include HTML docs with Windows installer instead of CHM

2022-03-22 Thread Eryk Sun
Change by Eryk Sun : -- nosy: -eryksun ___ Python tracker <https://bugs.python.org/issue47086> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue47086] Include HTML docs with Windows installer instead of CHM

2022-03-22 Thread Eryk Sun
Eryk Sun added the comment: Do you have any thoughts about distributing the docs in ePub format? -- nosy: +eryksun ___ Python tracker <https://bugs.python.org/issue47

[issue46788] regrtest fails to start on missing performance counter names

2022-03-22 Thread Eryk Sun
Change by Eryk Sun : Removed file: https://bugs.python.org/file50695/loadtracker.py ___ Python tracker <https://bugs.python.org/issue46788> ___ ___ Python-bugs-list m

[issue46788] regrtest fails to start on missing performance counter names

2022-03-22 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg415781 ___ Python tracker <https://bugs.python.org/issue46788> ___ ___ Python-bugs-list mailin

[issue47096] Use the PDH API in WindowsLoadTracker

2022-03-22 Thread Eryk Sun
New submission from Eryk Sun : In bpo-44336, a new version of WindowsLoadTracker was implemented in Lib/test/libregrtest/win_utils.py. This version resolves issues with the previous implementation that spawned typeperf.exe. The new implementation uses the registry API's HKEY_PERFORMANCE_DATA

[issue47093] Documentation Fix: Remove .bat when activating venv on windows

2022-03-22 Thread Eryk Sun
Eryk Sun added the comment: Running `tutorial-env\Scripts\activate` should suffice. The .bat script is for CMD, and the .ps1 script is for PowerShell. The shell should run the right script without having to include the extension. In Windows 10+, if you use a case-sensitive directory

[issue46788] regrtest fails to start on missing performance counter names

2022-03-22 Thread Eryk Sun
Eryk Sun added the comment: I implemented a ctypes prototype that replaces the registry-based implementation with the API calls PdhOpenQueryW(), PdhAddEnglishCounterW(), PdhCollectQueryData(), PdhGetRawCounterValue(), and PdhCloseQuery(). I'm attaching the script, but here's the class

[issue46788] regrtest fails to start on missing performance counter names

2022-03-21 Thread Eryk Sun
Eryk Sun added the comment: I was just wondering whether it's worth implementing it using the API. To be clear, I wasn't implying to hold off on applying Jeremy's PR. The existing code is causing him problems, and he has a working solution. -- nosy: +eryksun

[issue43702] [Windows] correctly sort and remove duplicates in _winapi getenvironment()

2022-03-19 Thread Eryk Sun
Eryk Sun added the comment: > which name should be stored if they are duplicated with case insensitive? Ideally os.environ would preserve the original case of the process environment, and os.environ.copy() would return a copy that's also case insensitive. That would prevent most probl

[issue47037] Build problems on Windows

2022-03-18 Thread Eryk Sun
Eryk Sun added the comment: The main entry point for python[_d].exe should support a command-line -X option or environment variable that suppresses Windows error/assert/warn reporting, or redirects it to stderr in verbose mode. This would be useful to simplify everyone's automated testing

[issue47037] Build problems on Windows

2022-03-17 Thread Eryk Sun
Change by Eryk Sun : -- priority: normal -> critical ___ Python tracker <https://bugs.python.org/issue47037> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue47037] Build problems on Windows

2022-03-16 Thread Eryk Sun
Eryk Sun added the comment: > Ouch, is Python crashes because of an unsupported strftime call? It's not a crash. It's a CRT error report dialog, which is enabled by default for the _CRT_ASSERT and _CRT_ERROR macros in debug builds. This dialog can be helpful when debugging interactiv

[issue47037] Build problems on Windows

2022-03-16 Thread Eryk Sun
Eryk Sun added the comment: bpo-46587 added top-level code to "Lib/test/support/__init__.py" to check whether time.strftime("%4Y") works. Since "Lib/test/libregrtest/setup.py" imports the support module, that code executes before suppress_msvcrt_asser

[issue46890] getpath problems with framework build

2022-03-16 Thread Eryk Sun
Eryk Sun added the comment: > This means that "python -S" doesn't work with a virtual environment. Does that matter? I've only used a virtual environment to override or extend the system site packages. Is there a reason to use one without site packages? -- n

[issue47025] bytes do not work on sys.path

2022-03-15 Thread Eryk Sun
Eryk Sun added the comment: > this is a regression from 3.2 In Windows, bytes paths in sys.path do not work in 3.2+. I didn't test 3.0 and 3.1, but practically one can say that bytes paths were never supported in Python 3 on Windows. -- nosy: +eryk

[issue46950] Windows 11, VENV not working with case sensitive windows paths

2022-03-14 Thread Eryk Sun
Eryk Sun added the comment: In 3.10, you should be able to work around the problem for the venv site-packages directory by setting the environment variable "PYTHONPLATLIBDIR" to "Lib". This sets sys.platlibdir, which the site module uses to create the site-packages di

[issue46785] On Windows, os.stat() can fail if called while another process is creating or deleting the file

2022-03-14 Thread Eryk Sun
Eryk Sun added the comment: I was following the pattern of StatAttributeTests.test_access_denied(), which uses the current user's temp directory to get a filesystem that supports security. It would probably be better to skip tests if the filesystem of the current working directory doesn't

[issue46785] On Windows, os.stat() can fail if called while another process is creating or deleting the file

2022-03-13 Thread Eryk Sun
Eryk Sun added the comment: > Why catch ERROR_NOT_READY and ERROR_BAD_NET_NAME as well? When os.stat() falls back on FindFirstFileW(), an error that means the file doesn't exist should be kept. ERROR_BAD_NET_NAME is an obvious error to keep because it's already mapped to ENOENT (i.e. f

[issue47001] deadlock in ctypes?

2022-03-13 Thread Eryk Sun
Eryk Sun added the comment: Pointers to resource type/name strings use the lower 16-bit range for integer identifiers such as RT_ICON (3) and RT_GROUP_ICON (14). C code checks for these cases using the IS_INTRESOURCE() macro. It's incorrect to use a simple C string pointer type

[issue46988] if a python program is execute by subprocess, the python program can't output unicode characters and raise UnicodeEncodeError

2022-03-11 Thread Eryk Sun
Change by Eryk Sun : -- superseder: -> Encoding error running in subprocess with captured output ___ Python tracker <https://bugs.python.org/issue46988> ___ _

[issue46785] On Windows, os.stat() can fail if called while another process is creating or deleting the file

2022-03-11 Thread Eryk Sun
Eryk Sun added the comment: Itai, you can add a test to Win32NtTests in Lib/test/test_os.py. Maybe spawn a child process that creates and unlinks a file in a loop. In the parent process execute a loop that tries to stat the file and ignores errors when the file or path isn't found

[issue46966] c_void_p array is a footgun on I32LP64 systems

2022-03-09 Thread Eryk Sun
Eryk Sun added the comment: > I'm not sure what can be done here (maybe a truncation warning?) For a function pointer, the default argument conversion for Python integers is the platform int type. Ideally, Python integer arguments would be converted to a type that matches the platform w

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

2022-03-06 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg390391 ___ Python tracker <https://bugs.python.org/issue37609> ___ ___ Python-bugs-list mailin

[issue46916] There is a problem with escape characters in the path passed in by pathlib.Path.mkdir()

2022-03-04 Thread Eryk Sun
Eryk Sun added the comment: > I thought pathlib would solve this problem completely now, > without having to replace the slashes. pathlib has nothing to do with how the Python language compiles string literals. A string *literal* is Python source code that gets compiled and instan

[issue46916] There is a problem with escape characters in the path passed in by pathlib.Path.mkdir()

2022-03-03 Thread Eryk Sun
Eryk Sun added the comment: > e = Path(r'F:\ceven\test2') Using forward slashes in the string literal is preferred, e.g. Path('F:/ceven/test2'). This avoids the problem of backslash escapes in string literals. The Path constructor parses the path and stores it internally as component pa

[issue46916] There is a problem with escape characters in the path passed in by pathlib.Path.mkdir()

2022-03-03 Thread Eryk Sun
Eryk Sun added the comment: > FileNotFoundError: [WinError 3] The system cannot find > the path specified: 'F:\\ceven\\test2' The Windows error code, ERROR_PATH_NOT_FOUND (3), indicates that the parent path, r"F:\ceven", does not exist. Try e.mkdir(parents=True)

[issue46905] winsound.PlaySound should accept pathlib.Path instances

2022-03-02 Thread Eryk Sun
Change by Eryk Sun : -- components: +Windows keywords: +easy (C) nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker <https://bugs.python.org/issue46

[issue46905] winsound.PlaySound should accept pathlib.Path instances

2022-03-02 Thread Eryk Sun
Eryk Sun added the comment: PlaySound() is implemented by the C function winsound_PlaySound_impl() in "PC/winsound.c". To support pathlike objects, it could use `soundname = PyOS_FSPath(sound)`, and require soundname to be a Unicode string via PyUnicode_Check(soundname). Or it

[issue46888] SharedMemory.close() destroys memory

2022-03-02 Thread Eryk Sun
Eryk Sun added the comment: Putting words into action, here's an example of what a privileged process (e.g. running as SYSTEM) can do if a script or application is written to call the undocumented NT API function NtMakePermanentObject(). A use case would be a script running as a system

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

2022-03-02 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg414332 ___ Python tracker <https://bugs.python.org/issue28824> ___ ___ Python-bugs-list mailin

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

2022-03-02 Thread Eryk Sun
Eryk Sun added the comment: Putting words into action, here's an example of what a privileged process (e.g. running as SYSTEM) can do if a script or application is written to call the undocumented NT API function NtMakePermanentObject(). A use case would be a script running as a system

[issue46888] SharedMemory.close() destroys memory

2022-03-01 Thread Eryk Sun
Eryk Sun added the comment: > The persistent mode sounds just like Python shared memory also works > on Linux (where I can have these /dev/shm/* files even after the > Python process ends) but I think on Windows, Python is not using > the persistent mode and thus the shared memo

[issue15373] copy.copy() does not properly copy os.environment

2022-03-01 Thread Eryk Sun
Eryk Sun added the comment: In bpo-28824, I suggested preserving the case of environment variables in Windows by using a case-insensitive subclass of str in the encodekey() function. This is self-contained by the use of the encodekey() and decodekey() functions in the mapping methods

[issue46888] SharedMemory.close() destroys memory

2022-03-01 Thread Eryk Sun
Eryk Sun added the comment: > Yes, named memory mappings only exist on Windows until the last > reference is closed, so this is a difference due to the underlying OS. That's true for the Windows API, so it's true for all practical purposes. In the underlying NT API, creating a per

[issue46791] Allow os.remove to defer to rmdir

2022-03-01 Thread Eryk Sun
Eryk Sun added the comment: glibc remove() has an optimization to skip calling rmdir() if the macro condition IS_NO_DIRECTORY_ERROR is true for the unlink() error. For Linux, this condition is `errno != EISDIR`. On other platforms (e.g. BSD systems), the condition is `errno != EPERM

[issue46791] Allow os.remove to defer to rmdir

2022-02-28 Thread Eryk Sun
Eryk Sun added the comment: > For REMOVE_BOTH, I don't see the need of calling GetFileAttributes I was thinking that the NtQueryAttributesFile() system call is relatively cheap compared to a full open, especially if the attributes of a remote file are cached locally. However, on sec

[issue46869] platform.release() and sys returns wrong version on Windows 11

2022-02-26 Thread Eryk Sun
Eryk Sun added the comment: platform.release() returns platform.uname().release, which comes from platform.win32_ver() in Windows [1]. The issue with Windows 11 is being discussed in bpo-45382, but no PR has been submitted yet to resolve the issue. > >>> sys.getwi

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

2022-02-26 Thread Eryk Sun
Eryk Sun added the comment: > I think there should be a public class like this. I wrote a basic implementation of _CaseInsensitiveString under the assumption that it's hidden behind the __getitem__(), __setitem__(), and __delitem__() methods of the _Environ class. I don't want to complic

[issue46861] os.environ forces variable names to upper case on Windows

2022-02-25 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> os.environ should preserve the case of the OS keys ? ___ Python tracker <https://bugs.python

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

2022-02-25 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.11 ___ Python tracker <https://bugs.python.org/issue28824> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46862] subprocess makes environment blocks with duplicate keys on Windows

2022-02-25 Thread Eryk Sun
Eryk Sun added the comment: I suggest closing this issue as a duplicate of bpo-43702. -- ___ Python tracker <https://bugs.python.org/issue46862> ___ ___ Pytho

[issue43702] [Windows] correctly sort and remove duplicates in _winapi getenvironment()

2022-02-25 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.11 -Python 3.8 ___ Python tracker <https://bugs.python.org/issue43702> ___ ___ Python-bugs-list mailing list Unsub

[issue46862] subprocess makes environment blocks with duplicate keys on Windows

2022-02-25 Thread Eryk Sun
Eryk Sun added the comment: This should be handled in _winapi.CreateProcess(). An environment block is technically required to be sorted. (Ages ago this was a MUST requirement for getting and setting variables to work correctly, since the implementation depended on the sort order, but I

[issue46858] mmap constructor resets the file pointer on Windows

2022-02-25 Thread Eryk Sun
Eryk Sun added the comment: The resize() method also modifies the file pointer. Instead of fixing that oversight, I think it should directly set the file's FileEndOfFileInfo and FileAllocationInfo. For example: // resize the file if (!SetFileInformationByHandle

[issue46855] printing a string with strange characters loops forever

2022-02-25 Thread Eryk Sun
Eryk Sun added the comment: The ordinal range 0x80-0x9F is the C1 control code set [1]. Ordinal 0x9F is "Application Program Command" (APC). The command must be terminated by ordinal 0x9C, "String Terminator" (ST). For example, "\x9f Some Command \x9c". In G

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

2022-02-25 Thread Eryk Sun
Eryk Sun added the comment: > I have an idea to solve it. But I don't know how to get the > clipboard data. In Windows, using the window manager entails extending the process and the current thread with GUI-related structures in the kernel and then connecting the process to a

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

2022-02-25 Thread Eryk Sun
Eryk Sun added the comment: > Clicking `Edit > Paste` from the window menu > Use right-click to paste In particular, if the console has quick-edit mode enabled, then you can paste text by right-clicking. Also, if text is selected in quick-edit mode, right-clicking copies to the

[issue12165] [doc] clarify documentation of nonlocal

2022-02-24 Thread Eryk Sun
Eryk Sun added the comment: > Another problem with the current text is that it fails to exclude > enclosing class scopes The nonlocal statement is only disallowed in module code (i.e. "exec" compilation mode) because it can never be nested. It's allowed in a class def

[issue46839] Process finished with exit code -1073741819 (0xC0000005)

2022-02-23 Thread Eryk Sun
Eryk Sun added the comment: I tried to get more information for you by installing 2.7.11 (64-bit because of the given fault) and unassembling python27.dll at the fault offset. But it doesn't help. Whatever the bug is, it ended up jumping to an address that's in the middle of an instruction

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-21 Thread Eryk Sun
Eryk Sun added the comment: > pathlib does not allow to distinguish "path" from "path/". os.path.normpath() and os.path.abspath() don't retain a trailing slash -- or a leading dot component for that matter. Are you referring to os.path.join()? For example: &

[issue46791] Allow os.remove to defer to rmdir

2022-02-19 Thread Eryk Sun
Eryk Sun added the comment: In Windows, checking for a directory in order to defer to either os_rmdir_impl() or os_unlink_impl() would lead to a redundant directory check. os_unlink_impl() already has to check for a directory in order to delete a directory symlink or mountpoint. I suggest

[issue46785] On Windows, os.stat() can fail if called while another process is creating or deleting the file

2022-02-18 Thread Eryk Sun
Eryk Sun added the comment: Windows filesystems disallow new opens for a file that has its delete disposition set (i.e. the file is marked for deletion). For example, CreateFileW() fails with ERROR_ACCESS_DENIED (5) in this case. A file with its delete disposition set is still visibly

[issue46763] os.path.samefile incorrect results for shadow copies

2022-02-16 Thread Eryk Sun
Eryk Sun added the comment: Sample implementation: import os import msvcrt import win32file def samefile(f1, f2): """Test whether two paths refer to the same file or directory.""" s1 = os.stat(f1) s2 = os.stat(f2)

[issue46775] [Windows] OSError should unconditionally call winerror_to_errno

2022-02-16 Thread Eryk Sun
New submission from Eryk Sun : bpo-37705 overlooked fixing the OSError constructor. oserror_parse_args() in Objects/exceptions.c should unconditionally call winerror_to_errno(), which is defined in PC/errmap.h. winerror_to_errno() maps the Winsock range 1-11999 directly, except

[issue46763] os.path.samefile incorrect results for shadow copies

2022-02-16 Thread Eryk Sun
Eryk Sun added the comment: Python uses the volume serial number (VSN) and file ID for st_dev and st_ino. The OS allows the file ID to be 0 if the filesystem doesn't support file IDs. Also, it does not require or force the VSN to be a unique ID in the system, though if it's not 0 it's

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-15 Thread Eryk Sun
Eryk Sun added the comment: > I'm planning to learn more heavily on posixpath + ntpath in > pathlib once bpo-44136 is done. I think that would be a good > time to introduce is_mount() support on Windows. In the long run, it would be better to migrate the implementations in

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-14 Thread Eryk Sun
Eryk Sun added the comment: WindowsPath.is_mount() should call ntpath.ismount(). This function needs a significant redesign, but it's fine to use it as long as it's documented that is_mount() is equivalent to os.path.ismount(). Since the owner() and group() methods return names instead

[issue46751] Windows-style path is not recognized under cygwin

2022-02-14 Thread Eryk Sun
Eryk Sun added the comment: MSYS2 has basically the same problem when the script is passed as a Windows path, except it uses "/c" for the "C:" drive instead of "/cygdrive/c". # python3 -VV Python 3.9.9 (main, Dec 28 2021, 11:05:23) [GCC 11.2

[issue46716] regrtest didn't respect the timeout when running test_subprocess on AMD64 Windows11 3.x

2022-02-14 Thread Eryk Sun
Eryk Sun added the comment: > 4) use Job objects to group Windows processes for termination I think a separate issue should be created for this enhancement. _winapi wrappers would be needed for CreateJobObjectW(), SetInformationJobObject(), AssignProcessToJobObject(), TerminatejobObj

[issue46716] regrtest didn't respect the timeout when running test_subprocess on AMD64 Windows11 3.x

2022-02-14 Thread Eryk Sun
Eryk Sun added the comment: > I fear the potential 3rd-party breakage alone should bump > this to its own issue. The change to the DWORD converter in _winapi should only be in 3.11+. If this causes problems for other projects, they're probably depending on undefined behavior in the st

[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-13 Thread Eryk Sun
Eryk Sun added the comment: > I didn't have that in mind at all. I understood what you had in mind, and I don't disagree. I was just highlighting that the only somewhat important work done in _stop() is to clean up the _shutdown_locks set, to keep it from growing too large. But that t

[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-13 Thread Eryk Sun
Eryk Sun added the comment: > Anything at the Python level that cares whether the thread is > still alive will call _wait_for_tstate_lock() again It's nice that _maintain_shutdown_locks() gets called in _stop(), but the more important call site is in _set_tstate_lock(). I ty

[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-13 Thread Eryk Sun
Eryk Sun added the comment: > is there a bulletproof way to guarantee that `self._stop()` gets > called if the acquire_and_release() succeeds? I don't think it's critical. But we still should deal with the common case in Windows in which a KeyboardInterrupt is raised immediately

[issue46716] regrtest didn't respect the timeout when running test_subprocess on AMD64 Windows11 3.x

2022-02-13 Thread Eryk Sun
Eryk Sun added the comment: > the fix should be as simple as coercing the timeout values to >= 0. Popen._remaining_time() should return max(endtime - _time(), 0). Popen._wait() should raise OverflowError if the timeout is too large for the implementation. In Windows, the upper

[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-12 Thread Eryk Sun
Eryk Sun added the comment: > Wrap everything needed in a custom C function. Maybe add an `acquire_and_release()` method: static PyObject * lock_PyThread_acquire_and_release_lock( lockobject *self, PyObject *args, PyObject *kwds) { _PyTime_t time

[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-12 Thread Eryk Sun
Eryk Sun added the comment: > If the acquire() in fact times out, but the store to the `acquired` > variable is interrupted, `if _WINDOWS and acquired is None` will > succeed, despite that the lock is still locked Yeah, my proposed workaround is no good, so we can't resolve thi

[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-12 Thread Eryk Sun
Eryk Sun added the comment: > The race on := is much smaller than the original race > and I suspect in practice will be very hard to hit. In Windows, the acquire() method of a lock can't be interrupted. Thus, in the main thread, an exception from Ctrl+C gets raised as soon as a

[issue46716] regrtest didn't respect the timeout when running test_subprocess on AMD64 Windows11 3.x

2022-02-11 Thread Eryk Sun
Eryk Sun added the comment: > test_call_timeout() or test_timeout() in test_subprocess.py. These tests don't override the standard files, and they only spawn a single child with no descendants. I don't see why this would hang. It shouldn't be a problem with leaked pipe handles (see

[issue46703] boolean operation issue (True == False == False)

2022-02-09 Thread Eryk Sun
Eryk Sun added the comment: > True == False == False is really True == False and False == False > wich is False and True which is False Moreover, since the left-hand comparison is `True == False`, which evaluates to False, the right-hand comparison doesn't even get eva

[issue46697] _ctypes_simple_instance returns inverted logic

2022-02-09 Thread Eryk Sun
Change by Eryk Sun : -- stage: -> patch review versions: -Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue46697> ___ ___ Python-

[issue46686] [venv / PC/launcher] issue with a space in the installed python path

2022-02-08 Thread Eryk Sun
Eryk Sun added the comment: The venv launcher can quote the executable path either always or only when it contains spaces. The following is a suggestion for implementing the latter. Before allocating `executable`, use memchr() (include ) to search the UTF-8 source for a space. If found

[issue46686] [venv / PC/launcher] issue with a space in the installed python path

2022-02-08 Thread Eryk Sun
Eryk Sun added the comment: I checked the source code in PC/launcher.c process(). It turns out that `executable` is not getting quoted in the venv launcher case. CreateProcessW() tries to get around this. If the command isn't quoted, it has a loop that consumes up to a space (or tab

[issue46686] [venv / PC/launcher] issue with a space in the installed python path

2022-02-08 Thread Eryk Sun
Eryk Sun added the comment: run_child() expects `cmdline` to be correctly quoted, and normally it is. I can't reproduce this problem with Python 3.10.2. I created a user account with a space in the account name, logged on, and installed 3.10.2 for the current user, with the option enabled

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread Eryk Sun
Eryk Sun added the comment: > Oh. Serhiy asked me to use LC_TIME rather than LC_CTYPE. Since Locale*Calendar is documented as not being thread safe, __init__() could get the real default via setlocale(LC_TIME, "") when locale=None and the current LC_TIME is "C". Resto

[issue46659] Deprecate locale.getdefaultlocale() function

2022-02-08 Thread Eryk Sun
Eryk Sun added the comment: > getdefaultlocale() falls back to LANG and LANGUAGE. _Py_SetLocaleFromEnv(LC_CTYPE) (e.g. setlocale(LC_CTYPE, "")) gets called at startup, except for the isolated configuration [1]. I think calendar.Locale*Calendar should try the LC_CTYPE locale if L

[issue46668] encodings: the "mbcs" alias doesn't work

2022-02-07 Thread Eryk Sun
Eryk Sun added the comment: > I don't think that this fallback is needed anymore. Which Windows > code page can be used as ANSI code page which is not already > implemented as a Python codec? Python has full coverage of the ANSI and OEM code pages in the standard Windows local

[issue46668] encodings: the "mbcs" alias doesn't work

2022-02-06 Thread Eryk Sun
Eryk Sun added the comment: > The Python 3.6 and 3.7 "codecs.register(_alias_mbcs)" doesn't work > because "search_function()" is tested before and it works for "cpXXX" > encodings. Isn't the 3.6-3.10 ordering of search_function() and _alias_mbcs

[issue46654] urllib.request.urlopen doesn't handle UNC paths produced by pathlib's as_uri() (but can handle UNC paths with additional slashes)

2022-02-06 Thread Eryk Sun
Change by Eryk Sun : -- assignee: docs@python -> components: -2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, C API, Cross-Build, Demos and Tools, Distutils, Documentation, Extension Modules, FreeBSD, IDLE, IO, Installation, Interpreter Core, Parser, Regular Expressi

[issue46654] urllib.request.urlopen doesn't handle UNC paths produced by pathlib's as_uri() (but can handle UNC paths with additional slashes)

2022-02-06 Thread Eryk Sun
Eryk Sun added the comment: > The value of req.selector never starts with "//", for which file_open() > checks, but rather a single slash, such as "/Z:/test.py" or > "/share/test.py". To correct myself, actually req.selector will start with &qu

[issue46654] urllib.request.urlopen doesn't handle UNC paths produced by pathlib's resolve() (but can handle UNC paths with additional slashes)

2022-02-05 Thread Eryk Sun
Eryk Sun added the comment: > file://server/host/file.ext on windows, even though > file:server/host/file.ext open just fine. For r"\\host\share\test.py", the two slash conversion "file://host/share/test.py" is correct according to RFC80889 "

[issue46654] urllib.request.urlopen doesn't handle UNC paths produced by pathlib's resolve() (but can handle UNC paths with additional slashes)

2022-02-05 Thread Eryk Sun
Eryk Sun added the comment: In FileHandler.file_open(), req.host is the host name, which is either None or an empty string for a local drive path such as, respectively, "file:/Z:/test.py" or "file:///Z:/test.py". The value of req.selector never starts with "//"

[issue46654] file_open doesn't handle UNC paths produced by pathlib's resolve() (but can handle UNC paths with additional slashes)

2022-02-05 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg412604 ___ Python tracker <https://bugs.python.org/issue46654> ___ ___ Python-bugs-list mailin

[issue46654] file_open doesn't handle UNC paths produced by pathlib's resolve() (but can handle UNC paths with additional slashes)

2022-02-05 Thread Eryk Sun
Eryk Sun added the comment: Builtin open() calls C open(). This C function supports whatever path types are supported natively. In Windows, C open() calls WinAPI CreateFileW(), which does not support "file://" URIs. The Windows API handles it as a relative path, which gets resolv

[issue46631] Implement a "strict" mode for getpass.getuser()

2022-02-04 Thread Eryk Sun
Eryk Sun added the comment: Here's an example for the suggested changes to _winapi. Include these headers: #include // LsaGetLogonSessionData #include // STATUS_SUCCESS Add these argument-clinic macros to _winapi_functions: _WINAPI_GETCURRENTPROCESSTOKEN_METHODDEF

[issue46631] Implement a "strict" mode for getpass.getuser()

2022-02-03 Thread Eryk Sun
New submission from Eryk Sun : getpass.getuser() checks the environment variables LOGNAME (login name), USER, LNAME, and USERNAME, in that order. In Windows, LOGNAME, USER, and LNAME have no conventional usage. I think there should be a strict mode that restricts getuser() to check only

[issue46490] Add "follow_symlinks=False" support for "os.utime()" on Windows

2022-02-02 Thread Eryk Sun
Eryk Sun added the comment: In case you missed it, I implemented _Py_CreateFile2() in bpo-46506 and rewrote os.stat() based on it. Check it out in case you're interested in moving forward with a PR in bpo-46506. For this issue, follow_symlinks is fairly simple to support

[issue46594] Windows "Edit with IDLE >" only has one selection

2022-02-01 Thread Eryk Sun
Eryk Sun added the comment: > the Open With entries may not be being merged. That would probably be a bug in the Windows shell API. The HKCU and HKLM subkeys of "Software\Classes\Python.File\Shell\editwithidle\shell" are merged in the HKCR view. The same key path can exist

[issue46594] Windows "Edit with IDLE >" only has one selection

2022-01-31 Thread Eryk Sun
Eryk Sun added the comment: Check your settings in the registry. In "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts" there should be a ".py" key, but not necessarily. It should have an "OpenWithList" subkey that contains an "MRUL

[issue29688] Add support for Path.absolute()

2022-01-31 Thread Eryk Sun
Eryk Sun added the comment: > I'd imagine that bug is reproducible with `Path('C:\\Temp', 'C:')` > already, right? If that's the case, should it logged as a > separate issue? Yes, it's a separate issue that affects the _from_parts() call in absolute(). How about designing

[issue29688] Add support for Path.absolute()

2022-01-31 Thread Eryk Sun
Eryk Sun added the comment: > I'm not seeing what's wrong with your example. "C:" or "C:spam\\eggs" are not absolute paths. They depend on the effective working directory on the drive. An absolute path should never depend on a working directory, which can ch

[issue29688] Add support for Path.absolute()

2022-01-31 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg412220 ___ Python tracker <https://bugs.python.org/issue29688> ___ ___ Python-bugs-list mailin

[issue29688] Add support for Path.absolute()

2022-01-31 Thread Eryk Sun
Eryk Sun added the comment: > I'm not seeing what's wrong with your example. "C:" or "C:spam\\eggs" are not absolute paths. They depend on the effective working directory on the drive. An absolute path should never depend on a working directory, which can ch

  1   2   3   4   5   6   7   8   9   10   >