[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-10-09 Thread Eryk Sun
Eryk Sun added the comment: > Is there any benefit of calling SetWaitableTimer() with an > absolute timeout No, the due time of a timer object is stored in absolute interrupt time, not absolute system time. This has to be calculated either way, and it's actually more work for the

[issue21302] time.sleep (floatsleep()) should use clock_nanosleep() on Linux

2021-10-09 Thread Eryk Sun
Eryk Sun added the comment: > In Python 3.11, time.sleep() is now always implemented with a > waitable timer. A regular waitable timer in Windows becomes signaled with the same resolution as Sleep(). It's based on the current interrupt timer period, which can be lowered to 1

[issue45382] platform() is not able to detect windows 11

2021-10-07 Thread Eryk Sun
Eryk Sun added the comment: > use the build number as reference instead of the major.minor It could check the (major, minor, build) tuple, which allows reporting 10.1+ as "post11" and minimizes hard coding of build numbers. For example, given win32_ver() iterates by (major,

[issue45375] Windows assertion in out-of-tree debug build

2021-10-06 Thread Eryk Sun
Eryk Sun added the comment: I left a message on the PR a day ago about a one-off error in the allocation of `buff`. The size should be `MAXPATHLEN + 1`. That's what's used everywhere else in PC/getpathp.c and what gets passed in the PathCchCombineEx(buff, MAXPATHLEN + 1, ...) call

[issue45382] platform() is not able to detect windows 11

2021-10-05 Thread Eryk Sun
Eryk Sun added the comment: The _WIN32_CLIENT_RELEASES table based on major.minor version number isn't helpful since Windows 10 and 11 have the same version number. win32_ver() needs a workaround to return release "11" if the build number is 22000 or greater. Is there any n

[issue45354] test_winconsoleio fails on Windows 11

2021-10-04 Thread Eryk Sun
Eryk Sun added the comment: > This will be the change to make "special" filenames only be > special when used on their own, and not as part of a path For some reason, Windows 11 still reserves case-insensitive "nul" in qualified paths, but none of the other DOS dev

Re: python39.dll not found

2021-10-01 Thread Eryk Sun
On 10/1/21, Sravan Kumar Chitikesi wrote: > You might copy the installation files from one to another computer, but you > missed the copying pytho**.dll from from windows/system32 folder.> The PSF installer 3.4 and earlier installs "pythonXY.dll" in the system directory when it peforms an

Re: Python added to PATH, cannot be directly accessed, cannot install pip

2021-09-28 Thread Eryk Sun
On 9/27/21, Mats Wichmann wrote: > > pip, meanwhile, is not in the same directory as the python executable, > so even "adding python to PATH" doesn't solve the problem of running > pip. Invoke it like this instead: The installer's option to add Python to PATH adds both the installation

[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation, use Windows native conditional variable

2021-09-28 Thread Eryk Sun
Eryk Sun added the comment: FYI, waiting for a condition variable can cause a thread to enter a wait state that's interruptible, in theory, but the mechanism is different since condition variables and SRW locks are pointer-sized values in user space, instead of NT objects in kernel space

Re: Python added to PATH, cannot be directly accessed, cannot install pip

2021-09-27 Thread Eryk Sun
On 9/27/21, Will wrote: > >I am using a Lenovo Laptop using Windows. I'm trying to install >get-pip.py The installer includes pip by default and has an option to update PATH for you, though the latter isn't enabled by default. Latest 64-bit release:

[issue45301] pycore_condvar.h: remove Windows conditonal variable emulation

2021-09-27 Thread Eryk Sun
Eryk Sun added the comment: > IMO it's time to remove _PY_EMULATED_WIN_CV code path from > pycore_condvar.h. SleepConditionVariableSRW() can't be interrupted in PyCOND_WAIT() and PyCOND_TIMEDWAIT(). Maybe a hybrid solution could be adopted. Use native condition variables for t

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-27 Thread Eryk Sun
Eryk Sun added the comment: This is the same as bpo-21822, so I suppose it should be closed as well with a reference to this issue. -- ___ Python tracker <https://bugs.python.org/issue45

[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-09-25 Thread Eryk Sun
Eryk Sun added the comment: Running the REPL with -S is unusual, so having to use sys.exit() or `raise SystemExit` in that case shouldn't be an issue. A user who wants custom behavior for `exit` could override sys.displayhook() in the PYTHONSTARTUP file. For example: import sys

[issue45285] c_char incorrectly treated as bytes in Structure

2021-09-24 Thread Eryk Sun
Eryk Sun added the comment: A simple ctypes type implements a get function that's called when its value is returned as an attribute of struct/union, index of an array/pointer, or result of a function pointer. For example: >>> a = (ctypes.c_char * 1)(97) >>> a[0]

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-24 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +eryksun ___ Python tracker <https://bugs.python.org/issue45274> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45274] Race condition in Thread._wait_for_tstate_lock()

2021-09-23 Thread Eryk Sun
Eryk Sun added the comment: See bpo-21822 from 2014, which I think was the first report of this issue. -- nosy: +eryksun ___ Python tracker <https://bugs.python.org/issue45

[issue45176] Many regtest failures on Windows with non-ASCII account name

2021-09-21 Thread Eryk Sun
Eryk Sun added the comment: I see no problem with changing a test -- such as test_consistent_sys_path_for_direct_execution() -- to spawn the child interpreter with `-X utf8` when the I/O encoding itself is irrelevant to the test -- except for forcing a common Unicode encoding to ensure

Re: Explaining exec(globals, separate_locals)

2021-09-20 Thread Eryk Sun
On 9/20/21, Terry Reedy wrote: > > "If exec gets two separate objects as globals and locals, the code will > be executed as if it were embedded in a class definition." Note that, unlike exec(), the body of a class definition can modify closure variables in nonlocal function scopes. For example:

[issue45237] Python subprocess not honoring append mode for stdout on Windows

2021-09-19 Thread Eryk Sun
Eryk Sun added the comment: There's nothing we could easily change to use the native OS append mode or support inheritance of file descriptors in subprocess. A general solution would be to give up on C file descriptors and CRT functions such as _wopen(), read(), etc, and instead implement

[issue45234] copy_file raises FileNotFoundError when src is a directory

2021-09-18 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +gregory.p.smith ___ Python tracker <https://bugs.python.org/issue45234> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45237] Python subprocess not honoring append mode for stdout on Windows

2021-09-17 Thread Eryk Sun
Eryk Sun added the comment: In Windows, the C runtime's append mode doesn't use the native file append mode. The CRT just opens the file in read-write mode and seeks to the end, initially and before each write. subprocess.Popen() doesn't implement inheritance of file descriptors, so

[issue45120] Windows cp encodings "UNDEFINED" entries update

2021-09-17 Thread Eryk Sun
Eryk Sun added the comment: Rafael, I was discussing code_page_decode() and code_page_encode() both as an alternative for compatibility with other programs and also to explore how MultiByteToWideChar() and WideCharToMultiByte() work -- particularly to explain best-fit mappings, which do

[issue45232] ascii codec is used by default when LANG is not set

2021-09-17 Thread Eryk Sun
Eryk Sun added the comment: Python 3.7+ doesn't need to explicitly enable UTF-8 mode in this case on POSIX systems. If the locale encoding is the "POSIX" or "C" locale, and "C" locale coercion is not disabled via LC_ALL or PYTHONCOERCECLOCALE=0, the interpreter

[issue45120] Windows cp encodings "UNDEFINED" entries update

2021-09-17 Thread Eryk Sun
Eryk Sun added the comment: > From Eryk's description it sounds like we should always add > WC_NO_BEST_FIT_CHARS as an option to MultiByteToWideChar() > in order to make sure it doesn't use best fit variants > unless explicitly requested. The concept of a "best fit"

[issue45120] Windows cp encodings "UNDEFINED" entries update

2021-09-16 Thread Eryk Sun
Eryk Sun added the comment: > in CP1252, bytes \x81 \x8d \x8f \x90 \x9d map to "UNDEFINED", > whereas in bestfit1252, they map to \u0081 \u008d \u008f > \u0090 \u009d respectively This is the normal mapping in Windows, not a best-fit encoding. Within Windows, you ca

[issue45176] Many regtest failures on Windows with non-ASCII account name

2021-09-12 Thread Eryk Sun
Eryk Sun added the comment: > FWIW, I did test with "-X utf8" option I was suggesting to modify the tests to use the UTF-8 mode option in the spawn_python() command line. It doesn't help to run the parent process in UTF-8 mode since it isn't inherited. It could be inherited v

[issue45176] Many regtest failures on Windows with non-ASCII account name

2021-09-12 Thread Eryk Sun
Eryk Sun added the comment: In Windows, the standard I/O encoding of the spawn_python() child defaults to the process active code page, i.e. GetACP(). In Windows 10, the active code page can be set to UTF-8 at the system or application level, but most systems and applications still use

[issue45105] Incorrect handling of unicode character \U00010900

2021-09-05 Thread Eryk Sun
Eryk Sun added the comment: > I think you may be mistaken. In Max's original post, he has > s = '000X' It displays that way for me under Firefox in Linux, but what's really there when I copy it from Firefox is '0\U000109', which matches the result Max gets for individual

[issue45105] Incorrect handling of unicode character \U00010900

2021-09-05 Thread Eryk Sun
Eryk Sun added the comment: AFAICT, there is no bug here. It's just confusing how Unicode right-to-left characters in the repr() can modify how it's displayed in the console/terminal. Use the ascii() representation to avoid the problem. > The same behavior does not occur when directly us

[issue45077] multiprocessing.Pool(64) crashes on Windows

2021-09-03 Thread Eryk Sun
Eryk Sun added the comment: See bpo-26903 for a similar problem in concurrent.futures.ProcessPoolExecutor. It was resolved by adding a limit constant, _MAX_WINDOWS_WORKERS == 61. WaitForMultipleObjects() can wait on up to 64 object handles, but in this case 3 slots are already taken

[issue45073] windows installer quiet installation targetdir escapes "quote"-symbol

2021-08-31 Thread Eryk Sun
Eryk Sun added the comment: A literal backlash has to be escaped by doubling it if it precedes a double quote, else it escapes the double quote character. This is how typical command-line argument parsing handles backslash in Windows [1]: * 2n backslashes followed by a quotation mark

[issue45055] Fresh build on Windows fails the first time for zlib.c

2021-08-31 Thread Eryk Sun
Eryk Sun added the comment: I can't directly reproduce the problem. Does it reproduce reliably for you? My guess would be that there's a file open in "cpython-source-deps-zlib-1.2.11" when get_external.py tries to rename it to "zlib-1.2.11". Maybe an anti-malware scanne

[issue45052] WithProcessesTestSharedMemory.test_shared_memory_basics fails on Windows

2021-08-30 Thread Eryk Sun
Eryk Sun added the comment: > It may be a bug in the constructor of SharedMemory. It ignores > the size argument on Windows. The `size` argument is always ignored when `create` is false, on all platforms, not that I understand the reason for it. The difference compared to

[issue45048] subprocess.run(capture_output=Bool) does the opposite of expected

2021-08-29 Thread Eryk Sun
Eryk Sun added the comment: The documentation states that "[i]f capture_output is true, stdout and stderr will be captured". This implies a container of some kind. So look to what subprocess.run() returns: "[w]ait for command to complete, then return a CompletedP

[issue45031] [Windows] datetime.fromtimestamp(t) when t = 253402210800 fails on Python 3.8

2021-08-27 Thread Eryk Sun
Eryk Sun added the comment: The supported range depends on the platform. The C runtime library in Windows can handle dates through the year 3000 [1]: >>> datetime.fromtimestamp(3253679) datetime.datetime(3001, 1, 19, 7, 59, 59) >>> datetime.fromtim

[issue45013] os.path.isfile fails on path exactly 260 Chars long in Windows

2021-08-26 Thread Eryk Sun
Eryk Sun added the comment: The legacy maximum buffer size is 260 characters, but remember that strings in C are terminated by a null character (i.e. "\0"). So the maximum path length is actually 259 characters when opening files. In Windows 10 with Python 3.6+, you

[issue25867] os.stat raises exception when using unicode and no locale is set

2021-08-26 Thread Eryk Sun
Eryk Sun added the comment: > It's doing this now, so seems like it has been fixed Yes. In POSIX systems since Python 3.7, if the LC_CTYPE locale is the legacy "C" or "POSIX" locale, by default it tries to coerce LC_CTYPE to "C.UTF-8", "C.utf8", o

[issue33140] shutil.chown should not be defined in Windows

2021-08-17 Thread Eryk Sun
Eryk Sun added the comment: > creating a Windows `os.set_owner` function that uses the > appropriate Windows API calls to change owner/group settings, > and then using that for Windows in the `shutil.chown` function? I'd gladly help with implementing os.set_owner(), as a separ

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-17 Thread Eryk Sun
On 8/17/21, Dennis Lee Bieber wrote: > On Tue, 17 Aug 2021 15:11:05 +1000, Chris Angelico > declaimed the following: > >>Huh. Okay. Then I withdraw the concern from this list, and instead lay >>it at Microsoft's feet. That is, I maintain, a bizarre choice. Surely >>there are better ways to

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-16 Thread Eryk Sun
On 8/16/21, Chris Angelico wrote: > On Tue, Aug 17, 2021 at 11:44 AM Eryk Sun wrote: > >> Yes, the PC speaker beep does not get used in Windows 7+. The beep >> device object is retained for compatibility, but it redirects the >> request to a task in the user's session

Re: Regarding inability of Python Module Winsound to produce beep in decimal frequency

2021-08-16 Thread Eryk Sun
On 8/16/21, Roel Schroeven wrote: > > We're not necessarily talking about the PC speaker here: (almost) all > computers these days have sound cards (mostly integrated on the > motherboard) that are much more capable than those one-bit PC speakers. Yes, the PC speaker beep does not get used in

Re: Can't get rid of old version of python

2021-08-13 Thread Eryk Sun
On 8/13/21, Ciarán Ó Duibhín via Python-list wrote: > > But when I type "python" at the DOS prompt, I get "Python 3.8.10". I > don't understand this, as I uninstalled old versions, and I do not see a > DOS environment variable called "python" anywhere. The app distribution is probably

[issue15533] subprocess.Popen(cwd) documentation: Posix vs Windows

2021-08-12 Thread Eryk Sun
Eryk Sun added the comment: > I don't understand the wording proposed (that seem backwards to me?) Thanks. Looks like I inverted the logic of the quoted paragraph. It should have been a "relative path with a slash in it" is resolved against the current working directory,

[issue10835] sys.executable default and altinstall

2021-08-07 Thread Eryk Sun
Eryk Sun added the comment: In 3.2, the default program name on non-Windows systems was changed to "python3" (see bpo-15020). In 3.5, the code was moved into Python/pylifecycle.c (see bpo-22869). Between 3.7 and 3.8, the initialization code was rewritten (see PEP 587). Currentl

[issue44762] getpass.getpass on Windows fallback detection is incomplete

2021-08-05 Thread Eryk Sun
Eryk Sun added the comment: The `sys.stdin is not sys.__stdin__` check is not relevant information. We need to know whether msvcrt.getwch() works and that the user should be able to type the password in the console window. sys.__stdin__ could be a file object for the NUL device, a pipe

[issue44817] os.path.realpath fails with WinError 161

2021-08-04 Thread Eryk Sun
Eryk Sun added the comment: ERROR_NETWORK_ACCESS_DENIED (65) should probably be added to the ignore list. I don't know whether it occurs in practice, but we have it mapped to EACCES in PC/errmap.h. The common access error is ERROR_ACCESS_DENIED (5), even on a UNC share with restricted

[issue44829] zoneinfo.ZoneInfo does not check for Windows device names

2021-08-04 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg398916 ___ Python tracker <https://bugs.python.org/issue44829> ___ ___ Python-bugs-list mailin

[issue44829] zoneinfo.ZoneInfo does not check for Windows device names

2021-08-04 Thread Eryk Sun
Eryk Sun added the comment: In zoneinfo._tzpath, _validate_tzfile_path() depends on os.path.normpath(). I think the Windows implementation of normpath() in the ntpath module should be extended to normalize reserved names in the final path component in the same manner as WinAPI

[issue44817] os.path.realpath fails with WinError 161

2021-08-03 Thread Eryk Sun
Eryk Sun added the comment: It should also ignore ERROR_BAD_NETPATH (53). -- nosy: +eryksun ___ Python tracker <https://bugs.python.org/issue44817> ___ ___ Pytho

[issue44817] os.path.realpath fails with WinError 161

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

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

2021-07-30 Thread Eryk Sun
Eryk Sun added the comment: > On MacOS, I get Not a directory error on all 3 Confirmation on Linux and macOS suffices for "most POSIX systems", based on market share for desktops and servers. It would be nice to also confirm this for FreeBSD, AIX, HP-UX, and Solaris, but I sup

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

2021-07-30 Thread Eryk Sun
Eryk Sun added the comment: > It should be emphasized that it may happen on a **file operation** I think it's adequately covered by "attempts to open or traverse a non-directory file". The reader should know that opening "/path/to/file/somename.txt" requires tr

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

2021-07-30 Thread Eryk Sun
Eryk Sun added the comment: I'd prefer a generic wording regarding the platform, and overall simpler phrasing without examples: "On some platforms, it may also be raised if an operation attempts to open or traverse a non-directory file as if it were a directory." The latter doe

[issue44778] os seperator error. str method of PureWindowsPath on Ming64 env

2021-07-30 Thread Eryk Sun
Eryk Sun added the comment: MinGW Python sets os.sep to "/" and os.altsep to "\\". It also swaps _WindowsFlavour.sep and _WindowsFlavour.altsep in pathlib. This seems dubious to me. Technically the Windows API supports both backslash and slash as path separators, but

[issue44762] getpass.getpass on Windows fallback detection is bad

2021-07-29 Thread Eryk Sun
Eryk Sun added the comment: > WindowsConsoleIO doesn't actually use the standard file descriptors > for stdin/out/err To resolve bpo-30555, _WindowsConsoleIO was changed to eliminate self->handle and get the underlying handle dynamically via _get_osfhandle(). It's thus susceptible

[issue44762] getpass.getpass on Windows fallback detection is bad

2021-07-29 Thread Eryk Sun
Eryk Sun added the comment: > We could also provide a better check in WindowsConsoleIO.isatty, For isatty(), my concern is a false positive if the file is the "NUL" device, which should be an io.FileIO object. I suppose checking the file type in io._WindowsConsoleIO.i

[issue44762] getpass.getpass on Windows fallback detection is bad

2021-07-29 Thread Eryk Sun
Eryk Sun added the comment: It should be noted that changing win_getpass() to check sys.stdin.isatty() makes it inconsistent with unix_getpass(). The latter tries to open "/dev/tty" regardless of sys.stdin. To be consistent, win_getpass() would be implemented to call fallback_getp

[issue44762] getpass.getpass on Windows fallback detection is bad

2021-07-28 Thread Eryk Sun
Eryk Sun added the comment: > When the check incorrectly infers that it can use `msvcrt` while > its stdin is a pipe, the calls to `putwch` and `getwch` are going > into the void and the program effectively freezes waiting for > input that never comes. The C runtime's getwch(

[issue44681] time.sleep(0.001) not working properly

2021-07-28 Thread Eryk Sun
Eryk Sun added the comment: > It certainly wouldn't be worth the power and CPU usage > impact that people would inevitable get tricked into > causing To clarify, only short waits such as time.sleep(0.001) would busy loop. Waits longer than say 50 ms would call WaitForSingl

[issue44705] Support Windows file open modes for `open` built-in function

2021-07-22 Thread Eryk Sun
Eryk Sun added the comment: Currently you can use os.open() if you need platform-specific open flags such as Windows O_RANDOM, O_SEQUENTIAL, O_SHORT_LIVED, and O_TEMPORARY. The file descriptor can be passed to builtin open() to get a file object that owns the fd. It might be more

[issue44681] time.sleep(0.001) not working properly

2021-07-20 Thread Eryk Sun
Eryk Sun added the comment: The implementation of time.sleep() uses WaitForSingleObjectEx() on the main thread. It waits for an event object that gets signaled by Ctrl+C. On other threads it simply calls Sleep(). Thread wait functions such as WaitForSingleObjectEx() and Sleep() are based

[issue44627] Python terminal cmd line recall

2021-07-13 Thread Eryk Sun
Eryk Sun added the comment: By default, reading input from the console uses the console's built-in command-line editor. You can clear the console input history with Alt+F7; display the history list with F7; navigate in the history list with the up and down arrow keys, even when the list

[issue44579] shutil.copy() inefficient implementation in Windows

2021-07-07 Thread Eryk Sun
Change by Eryk Sun : -- components: +Windows -Library (Lib) ___ Python tracker <https://bugs.python.org/issue44579> ___ ___ Python-bugs-list mailing list Unsub

[issue44579] shutil.copy() inefficient implementation in Windows

2021-07-07 Thread Eryk Sun
Eryk Sun added the comment: > In Windows there is an fast API to copy file in kernel mode: CopyFile The possibility of calling CopyFileEx() for shutil.copy2() is discussed in issue 30044. Note that CopyFileEx() is a high-level Windows API function, not a "kernel mode" c

[issue44567] venv fails when called from within long path on Windows

2021-07-05 Thread Eryk Sun
Eryk Sun added the comment: The secure CRT string functions such as wcscpy_s() and wcscat_s() invoke the invalid parameter handler if the destination string is too small. This defaults to a fastfail that terminates with the status code 0xC409, subcode 5 (FAST_FAIL_INVALID_ARG). We're

[issue44527] On Windows, subprocess.run gets stuck indefinitely

2021-06-28 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> subprocess.run() sometimes ignores timeout in Windows ___ Python tracker <https://bugs.python

[issue44452] Allow paths to be joined without worrying about a leading slash

2021-06-27 Thread Eryk Sun
Eryk Sun added the comment: > I was thinking about about a case where paths are resolved relative > to a container root in a filesystem. I can see the need for generalized 'drive' support that sets an arbitrary path prefix as the 'drive'. For example, if "/var/tmp/instroot&q

[issue44510] file.read() UnicodeDecodeError with UTF-8 BOM in files on Windows

2021-06-25 Thread Eryk Sun
Eryk Sun added the comment: > On Windows we currently still default to your console encoding In Windows, the default encoding for open() is the ANSI code page of the current process [1], from GetACP(), which is based on the system locale, unless it's overridden to UTF-8 in the applicat

[issue36621] shutil.rmtree follows junctions on windows

2021-06-20 Thread Eryk Sun
Eryk Sun added the comment: Yes, this issue is out of date. shutil._rmtree_isdir() and shutil._rmtree_islink() were added to handle mount points (i.e. junctions) as if they're symlinks. More generally, junctions and symlinks are what the platform refers to as name-surrogate reparse points

[issue44436] [Windows] _thread.start_new_thread() should close the thread handle

2021-06-16 Thread Eryk Sun
Eryk Sun added the comment: > Would it be safe to close the handle just after PyThread_start_new_thread() > success? We already close the handle in PyThread_start_new_thread() in Python/thread_nt.h: if (hThread == 0) { // ... } else { dprintf

Re: curses apps on MS Windows?

2021-06-14 Thread Eryk Sun
On 6/13/21, Grant Edwards wrote: > > Are there examples of popular curses applications for Windows? I don't think are any popular examples. The port of the "nano" editor uses ncurses. https://github.com/lhmouse/nano-win IIRC, PDCurses has better support -- e.g. 256 colors and blinking under

[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-14 Thread Eryk Sun
Eryk Sun added the comment: >> Try changing EnterNonRecursiveMutex() to break out of the loop in >> this case > > This does work, but unfortunately a little too well - in a single > test I saw several instances where that approach returned > _earlier_ than the t

[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-14 Thread Eryk Sun
Eryk Sun added the comment: > Seems like Windows 7 may need to be considered as well, as > per vstinner's bpo-32592 mention? Python 3.9 doesn't support Windows 7. Moreover, the interpreter DLL in 3.9 implicitly imports PathCchCanonicalizeEx, PathCchCombineEx, and PathCchSkipRoot,

[issue44316] Support preserving path meaning in os.path.normpath() and abspath()

2021-06-13 Thread Eryk Sun
Eryk Sun added the comment: I think separate keep_curdir and keep_pardir options is over-complicating the signature. Also, I'd prefer to remove a dot component if it's not the first component since there's no reason to keep it. If you plan to use normpath() in pathlib, then the case

[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-13 Thread Eryk Sun
Eryk Sun added the comment: On second thought, starting with Windows 8, WaitForSingleObject() and WaitForMultipleObjects() exclude time when the system is suspended. For consistency, an external deadline (e.g. for SIGINT support) should work the same way. The monotonic clock should thus

[issue19007] precise time.time() under Windows 8: use GetSystemTimePreciseAsFileTime

2021-06-13 Thread Eryk Sun
Eryk Sun added the comment: > What are the expected benefits from changing? Just a higher > resolution? I'm not sure that's worth anything if it's inaccurate. GetSystemTimePreciseAsFileTime() returns an accurate timestamp, which is the current system time plus the difference b

[issue44316] Support preserving path meaning in os.path.normpath() and abspath()

2021-06-12 Thread Eryk Sun
Eryk Sun added the comment: > single dots are collapsed For pathlib, I've previously discussed a desire to retain a leading dot component from the initializing path. This could be implemented in strict mode for normpath(). A leading dot is significant in the path of an executa

[issue44352] Native Windows Python builds running on Europe/Moscow TZ report wrong time from datetime.datetime.now when there is TZ environment variable also set to Europe/Moscow

2021-06-11 Thread Eryk Sun
Eryk Sun added the comment: Note that this explanation in your commit is wrong and unhelpful: "likely because datetime.datetime.now in the native Windows Python takes into account both system timezone data and the TZ environment variable". When TZ is set, localtime() is based only

[issue44352] Native Windows Python builds running on Europe/Moscow TZ report wrong time from datetime.datetime.now when there is TZ environment variable also set to Europe/Moscow

2021-06-09 Thread Eryk Sun
Eryk Sun added the comment: > 2. Execute 'set TZ=Europe/Moscow' The Windows C runtime supports a simple format for the TZ environment variable, which is detailed in the documentation of _tzset() [1]. For example, it's "MSK-3" for Moscow Standard Time. It's -3 because the o

[issue44328] time.monotonic() should use a different clock source on Windows

2021-06-09 Thread Eryk Sun
Eryk Sun added the comment: You resolved bpo-41299 using QueryPerformanceCounter(), so we're already a step toward making it the default monotonic clock. Personally, I've only relied on QPC for short intervals, but, as you've highlighted above, other language runtimes use

Re: ctypes on Windows question: How to access an array of uint32_t exported from a DLL?

2021-06-07 Thread Eryk Sun
On 6/6/21, pjfarl...@earthlink.net wrote: > > On a Windows 10 platform (python 3.8.9 and 3.9.5), how do I use ctypes to > access an array of uint32_t's exported from a DLL? > ... > __declspec(dllexport) extern uint32_t array_name[128]; A ctypes data type has an in_dll() method [1] that returns

[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-01 Thread Eryk Sun
Eryk Sun added the comment: > Now many people want to use Python with UTF-8 mode in PowerShell > in Windows Terminal. And they don't want to care about legacy > encoding at all. Windows Terminal isn't relevant to the encoding issue. Applications interact with the console session

Re: Definition of "property"

2021-06-01 Thread Eryk Sun
On 6/1/21, Jon Ribbens via Python-list wrote: > > I already answered that in the post you are responding to, but you > snipped it: You can tell something's definitely not a data attribute > if you have to put brackets after its name to call it as a method to > invoke its function or retrieve the

[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-06-01 Thread Eryk Sun
Eryk Sun added the comment: > I was one of the people who mistakenly thought that Python 3 operating > in the new Windows Terminal was going to magically leave us sitting > happily in completely UTF-8 compatible territory on Windows, not > realizing the complex long-term

[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Eryk Sun
Eryk Sun added the comment: > PS > [System.Console]::InputEncoding = $OutputEncoding If changing the console input codepage to UTF-8 fixes the mojibake problem, then probably you're running Python in UTF-8 mode. pydoc.tempfilepager() encodes the temporary file with the preferred en

[issue44275] Is there a mojibake problem rendering interactive help in the REPL on Windows?

2021-05-31 Thread Eryk Sun
Eryk Sun added the comment: > PS> [System.Console]::OutputEncoding The console's current output encoding is irrelevant to this problem. In Windows, pydoc uses the old "more.com" pager with a temporary file that's encoded with the default encoding, which is the process acti

Re: Definition of "property"

2021-05-30 Thread Eryk Sun
On 5/30/21, Ethan Furman wrote: > > > Properties are a special kind of attribute. Basically, when Python > encounters the following code: > > > > spam = SomeObject() > > print(spam.eggs) > > > > it looks up eggs in spam, and then examines eggs to see if it has a > __get__, __set__,

[issue44270] shutil.which: does not find path/cmd.ext where ext is not given

2021-05-30 Thread Eryk Sun
Eryk Sun added the comment: Michael, thank you for the PR, but please associate it with the existing issue bpo-24505. -- nosy: +eryksun resolution: -> duplicate stage: patch review -> resolved status: open -> closed superseder: -> shutil.which wrong result on Wind

[issue44189] multiprocessing AF_PIPE name format is slightly confusing in the docs

2021-05-20 Thread Eryk Sun
Eryk Sun added the comment: There's a formatting problem in Doc/library/multiprocessing.rst due to consumption of the backslashes in multiple steps. The following keeps all of the required backslashes in the HTML output: * An ``'AF_PIPE'`` address is a string of the form :samp:`r

[issue7760] [doc] ctypes: use_errno=True does not work

2021-05-18 Thread Eryk Sun
Eryk Sun added the comment: > The recommendation not to use absolute paths in CDLL is still > not mentioned in the docs: It's not generally the case. Load just a base filename only if the shared library is in the loader's search path. Otherwise use a qualified path that contains at

[issue44147] [WinError 193] %1 is not a valid Win32 application

2021-05-17 Thread Eryk Sun
Eryk Sun added the comment: > There are a few ways to get multiple Python installs that > could lead to launching the wrong one through PATH. > --user is one of the least likely. As far as I was aware, a --user installation prior to Python 3.10 would be the common way to have

[issue44147] [WinError 193] %1 is not a valid Win32 application

2021-05-17 Thread Eryk Sun
Eryk Sun added the comment: > For this issue, the PATH conflict would be that "pip" and "python" > refer to different Python installs. I'm aware of the problem for a per-user installation prior to 3.10. However, none of the install commands use the "--

[issue44147] [WinError 193] %1 is not a valid Win32 application

2021-05-16 Thread Eryk Sun
Eryk Sun added the comment: The issue tracker is not a general support forum for software development. Please ask first on python-list or the users group on discuss.python.org. For now, I'm changing the status of this issue to pending. If the discussion determines that there's a bug

[issue44046] When writing to the Registry using winreg, it currently allows you to write ONLY to HKEY_CURRENT_USERS.

2021-05-06 Thread Eryk Sun
Eryk Sun added the comment: > In any case, it should not be necessary to get Python permissions > to execute write / update methods in Python against HKLM hive HKEY_LOCAL_MACHINE is a predefined handle for the key "\REGISTRY\MACHINE". This key is not mounted by a hive. T

[issue44046] When writing to the Registry using winreg, it currently allows you to write ONLY to HKEY_CURRENT_USERS.

2021-05-06 Thread Eryk Sun
Eryk Sun added the comment: Thank you. The output shows that the Python process is using a UAC limited security context, i.e. the administrators group is enabled only for access-denied rules, and the integrity level is medium (not elevated to high or system level). Group Name: BUILTIN

[issue44046] When writing to the Registry using winreg, it currently allows you to write ONLY to HKEY_CURRENT_USERS.

2021-05-06 Thread Eryk Sun
Eryk Sun added the comment: > The whoami process check output shows that my account is in > BUILTIN\Administrators, which proves that the account I am > logged in as local Administrator permissions. Please show the output when whoami.exe is spawned from Python. I never questione

[issue44055] NamedTemporaryFile opened twice on Windows

2021-05-06 Thread Eryk Sun
Eryk Sun added the comment: Your example uses delete=False. In Windows, the provision about reopening the file while it's open applies to delete=True. With the latter, the file is opened with the O_TEMPORARY flag. At the OS level, this flag modifies the CreateFileW() call as follows

[issue44051] Virtualalloc wrong return type

2021-05-05 Thread Eryk Sun
Eryk Sun added the comment: > ctypes.windll.kernel32.VirtuAlloc function return by default > a ctypes.c_long In Windows, ctypes.c_int is an alias for ctypes.c_long, which is a signed 32-bit integer. This is the default conversion type for the integer parameters of an FFI (foreign fu

[issue44046] When writing to the Registry using winreg, it currently allows you to write ONLY to HKEY_CURRENT_USERS.

2021-05-05 Thread Eryk Sun
Eryk Sun added the comment: > There is no reason why a user should be able to write to > HKCU but not HKLM. Modifying system keys is limited to SYSTEM, administrators, and various privileged accounts and services such as TrustedInstaller. Standard users are not allowed to modify

[issue44008] os.walk and other directory traversal does not handle recursive mounts on Windows

2021-05-02 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> os.walk always follows Windows junctions ___ Python tracker <https://bugs.python

<    1   2   3   4   5   6   7   8   9   10   >