[issue41849] Support reading long lines with io._WindowsConsoleIO

2020-09-23 Thread Eryk Sun
New submission from Eryk Sun : io._WindowsConsoleIO reads from the console via ReadConsoleW in line-input mode, which limits the line length to the maximum of 256 and the size of the client buffer, including the trailing CRLF (or just CR if processed-input mode is disabled). Text that&#

[issue41849] Support reading long lines with io._WindowsConsoleIO

2020-09-24 Thread Eryk Sun
Eryk Sun added the comment: > The biggest risk here is that we have to emulate GNU readline for > compatibility, which severely limits the data that can be passed > through, and also forces multiple encoding/decoding passes. I'm not suggesting to disable the console's

[issue24757] Installing Py on Windows: Need to restart or logout for path to be added

2020-09-24 Thread Eryk Sun
Eryk Sun added the comment: > We already update the current shell, so if you start a new > terminal/Powershell/cmd/etc. instance it should have the > updated variable. The installer broadcasts an "Environment" message to top-level windows. In practice, only Explo

[issue41862] can not open file in system folder

2020-09-25 Thread Eryk Sun
Eryk Sun added the comment: > File "c:\users\chris\appdata\local\programs\python\python38-32 > \lib\runpy.py", line 194, in _run_module_as_main You have to use 64-bit Python in order to load a 64-bit DLL from the native "%SystemRoot%\System32" directory. The

[issue41883] ctypes pointee goes out of scope, then pointer in struct dangles and crashes

2020-09-28 Thread Eryk Sun
Eryk Sun added the comment: I think this is a numpy issue. Its data_as() method doesn't support the ctypes _objects protocol to keep the numpy array referenced by subsequently created ctypes objects. For example: import ctypes import numpy as np dtype = ctypes.c_d

[issue41883] ctypes pointee goes out of scope, then pointer in struct dangles and crashes

2020-09-29 Thread Eryk Sun
Eryk Sun added the comment: > `data_as` method which has the desired behavior: "The returned > pointer will keep a reference to the array." I don't think it's the desired behavior at all. data_as() sets an _arr attribute of which ctypes isn't aware. It shoul

[issue12836] ctypes.cast() creates circular reference in original object

2020-09-29 Thread Eryk Sun
Change by Eryk Sun : -- stage: -> needs patch versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.3 ___ Python tracker <https://bugs.python.org/issu

[issue41908] Make IDLE Start Menu entry more descriptive

2020-10-02 Thread Eryk Sun
Eryk Sun added the comment: > maybe we should consider moving the bitness to the folder title > (so the folder becomes "Python 3.8 64-bit")? Splitting up the start-menu entries into separate "Python 3.9 (32-bit)" and "Python 3.9 (64-bit)" folders wou

[issue41925] Lowercase path to python.exe in pip.exe from venv is throwing error

2020-10-03 Thread Eryk Sun
Eryk Sun added the comment: > "C:\Users\chris\code\project\myenv\Scripts\pip.exe" Have you tried different case combinations for "Users" and "Scripts"? * C:\users\chris\code\project\myenv\scripts\pip.exe * C:\users\chris\code\project\myenv\Scripts\

[issue41925] Lowercase path to python.exe in pip.exe from venv is throwing error

2020-10-03 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg377918 ___ Python tracker <https://bugs.python.org/issue41925> ___ ___ Python-bugs-list mailin

[issue41925] Lowercase path to python.exe in pip.exe from venv is throwing error

2020-10-03 Thread Eryk Sun
Eryk Sun added the comment: > "C:\Users\chris\code\project\myenv\Scripts\python.exe" Have you tried different case combinations for "Users" and "Scripts"? * C:\users\chris\code\project\myenv\scripts\python.exe * C:\users\chris\code\project\myenv\

[issue41929] Detect OEM code page for zip archives in ZipFile based on system locale

2020-10-04 Thread Eryk Sun
Eryk Sun added the comment: This is already addressed in bpo-28080, which adds an `encoding` parameter -- e.g. `encoding="oem"` ("oem" is only available in Windows). Unfortunately bpo-28080 has languished without resolution for four years. -

[issue41925] Lowercase path to python.exe in pip.exe from venv is throwing error

2020-10-04 Thread Eryk Sun
Eryk Sun added the comment: > I wouldn't think that changing locales would have an effect on Windows > paths being case sensitive or not, otherwise folks from other countries > would be experiencing this error. Perhaps the mixing of locale and system > language? I had locale

[issue41941] Py_Initialize affects the console

2020-10-05 Thread Eryk Sun
Eryk Sun added the comment: Python supports Unicode in a Windows console session by using the console API's wide-character functions (i.e. ReadConsoleW and WriteConsoleW) with UTF-16 encoded text. This is implemented in the io stack via io._WindowsConsoleIO, and for PyOS_Readline

[issue41941] Py_Initialize affects the console

2020-10-05 Thread Eryk Sun
Change by Eryk Sun : -- components: +IO, Unicode, Windows nosy: +ezio.melotti, paul.moore, steve.dower, tim.golden, vstinner, zach.ware ___ Python tracker <https://bugs.python.org/issue41

[issue41941] Py_Initialize affects the console

2020-10-05 Thread Eryk Sun
Eryk Sun added the comment: Having looked at the screenshots, it seems that your issue is in part due to non-legacy mode not setting the standard I/O files to binary mode (_O_BINARY) from their default ANSI text mode (_O_TEXT). This is not a problem on its own. The real issue is that

[issue41941] Py_Initialize affects the console

2020-10-05 Thread Eryk Sun
Eryk Sun added the comment: > config_init_stdio() is not called in an isolated configuration: config_init_stdio wasn't being called anyway since Py_Initialize uses _PyConfig_InitCompatConfig. The issue was primarily due to the LC_CTYPE locale being set to the default user loca

[issue36534] tarfile: handling Windows (path) illegal characters in archive member names

2020-10-06 Thread Eryk Sun
Eryk Sun added the comment: > The pathlib module has _WindowsFlavour.reserved_names list of > Windows reserved names: pathlib._WindowsFlavour.reserved_names is missing "CONIN$" and "CONOUT$". Prior to Windows 8 these two are reserved as relative names. In Windows

[issue36534] tarfile: handling Windows (path) illegal characters in archive member names

2020-10-06 Thread Eryk Sun
Eryk Sun added the comment: > This issue is about tarfile. Maybe create another issue to enhance > the pathlib module? IIRC there's already an open issue for that. But in case anyone were to look to pathlib as an example of what should be reserved, I wanted to highlight he

[issue41961] Windows install failure "could not set file security"

2020-10-06 Thread Eryk Sun
Eryk Sun added the comment: > Anyone else know of any possible causes for this? The installer service runs as SYSTEM, with an access token at system integrity level that has full privileges and the administrators group enabled. Nothing in the file security should prevent the service f

[issue41965] distutils.spawn.find_executable() fails to find .py files on Windows

2020-10-07 Thread Eryk Sun
Eryk Sun added the comment: The linked code runs subprocess.check_output([rstbin, path]), which won't work with "rst2man.py" in Windows. Reliably running a .py script in Windows requires running it explicitly via py[w].exe or python[w].exe, or via sys.executable from an

[issue41965] distutils.spawn.find_executable() fails to find .py files on Windows

2020-10-07 Thread Eryk Sun
Eryk Sun added the comment: The existing behavior of find_executable() is unusual compared to a native Windows file search via CreateProcessW or SearchPathW, for which a default ".exe" extension is appended only if the executable name doesn't already have an extension.

[issue36534] tarfile: handling Windows (path) illegal characters in archive member names

2020-10-07 Thread Eryk Sun
Eryk Sun added the comment: > extract the sanitizing function into a common module > (could be *pathlib*?) to avoid duplicates I would prefer something common, cross-platform, and function-based such as os.path.isreservedname and os.path.sanitizename. In posixpath, it would just h

[issue41961] Windows install failure "could not set file security"

2020-10-07 Thread Eryk Sun
Eryk Sun added the comment: > It might be that Python is the first/only MSI that the user > has tried though? It's likely the first per-user MSI install attempted since the security of the "Installer" directory was modified. There's no problem with a per-machine i

[issue26332] OSError: exception: access violation writing <...> (Windows 10 x64, Python 3.5.1)

2020-10-08 Thread Eryk Sun
Eryk Sun added the comment: I see nothing to act on in this issue. A common cause of access violations with ctypes is truncated pointer values. There's a lot of sloppy ctypes code from the 32-bit era that assumes a C int can store a pointer. -- nosy: +eryksun resolution: -&g

[issue21927] BOM appears in stdin when using Powershell

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: I'm closing this as a third-party issue with older versions of PowerShell. Newer versions of PowerShell set the output encoding to UTF-8 without a BOM preamble. For example: PS C:\> $PSVersionTable.PSVersion Major Minor Patch PreReleaseLabel Bu

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: I can't reproduce the issue with the normal 3.9.0 distribution from python.org. For example: >>> venv.EnvBuilder(with_pip=False, symlinks=True).create("venv") >>> subprocess.check_call(["venv\\Scripts\\python.exe"

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: What about the PYTHONHOME and PYTHONPATH environment variables? >>> 'PYTHONHOME' in os.environ False >>> 'PYTHONPATH' in os.environ False PYTHONHOME should not be set all. PYTHONPATH needs to be set carefu

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: > Well, actually the environment variables /should/ not matter as -I > implies -E. The operative word there is "should". I was grasping for anything that might explain why I couldn't reproduce the issue. > Ok, the missing link is that

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg378489 ___ Python tracker <https://bugs.python.org/issue42013> ___ ___ Python-bugs-list mailin

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: This issue is partly due to bpo-8901, which changed the behavior of the -E and -I command-line options to make them ignore the default PythonPath value in the registry key "Software\Python\PythonCore\X.Y\PythonPath". The change itself is not wrong.

[issue42020] interpreter hangs forever on invalid input

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: The terminal you're using apparently implements C1 controls [1]. U+009B is the Control Sequence Introducer (CSI) for ANSI escape sequences. U+0090 starts a Device Control String (DCS), and it gets terminated by U+009C, a String Terminator (ST). For exampl

[issue42020] interpreter hangs forever on invalid input

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: In Windows 10 2004, CSI is currently supported by the console host (conhost.exe) if virtual-terminal mode is enabled. Windows Terminal Preview supports many more C1 control codes, as will conhost.exe in the next release of Windows 10. This should be 

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: > So I'm +1 on fixing this by calling realpath. In POSIX, calculate_path() in Modules/getpath.c calls calculate_argv0_path() before it calls calculate_read_pyenv(), and calculate_argv0_path() in turn calls resolve_symlinks(&calculate->ar

[issue42046] Unable to write to file without elevated privileges

2020-10-15 Thread Eryk Sun
Eryk Sun added the comment: > Desktop rwx, > Username-directory rwx, POSIX permissions are not meaningful in Windows. Please run the following two commands in a Python script in order to show the current user and the access-control list on the directory: import subp

[issue42044] Running Python in unbuffered mode may not write all contents to the console

2020-10-15 Thread Eryk Sun
Eryk Sun added the comment: Text mode without a buffer isn't reliable. That said, Python 3.9 no longer supports Windows 7, so it can remove the 32 KiB limit on console I/O files. The size limit in Windows 7 and earlier is due to the LPC-based pseudo-files that it uses for I/O. Unde

[issue42041] venv subprocess call to python resolves to wrong interpreter

2020-10-15 Thread Eryk Sun
Eryk Sun added the comment: PR 22715 is accurate for the current implementation of subprocess. There has been discussion in past issues about implementing a PATH search that's similar to what the CMD shell does -- as in calling os.system() or Popen() with shell=True -- instead of relyi

[issue42046] Unable to write to file without elevated privileges

2020-10-16 Thread Eryk Sun
Eryk Sun added the comment: > icacls.exe C:\Python38-32\python.exe lists Mandatory Label\ > Low Mandatory Level:(I)(NW) ** This might be the problem. Removing "L" > with icacls might work. > > **When a user attempts to launch an executable file, the new process is >

[issue42046] Unable to write to file without elevated privileges

2020-10-16 Thread Eryk Sun
Eryk Sun added the comment: > processtoken = win32security.OpenProcessToken(process, > win32con.MAXIMUM_ALLOWED) > win32security.GetTokenInformation(processtoken, > win32security.TokenMandatoryPolicy) FYI, starting with Windows 8, the system supports pseudo-handles for the acce

[issue42041] venv subprocess call to python resolves to wrong interpreter

2020-10-18 Thread Eryk Sun
Eryk Sun added the comment: I don't know how much should be documented for subprocess.Popen, but here are the details for how searching works with shell=False (default) and shell=True. For shell=False, the search path used by WinAPI CreateProcessW checks %__APPDIR__%; %__CD__% (u

[issue42041] venv subprocess call to python resolves to wrong interpreter

2020-10-18 Thread Eryk Sun
Eryk Sun added the comment: > I don't think we should document this level of detail But a lot of it -- most of it -- is also strange behavior that no one would expect without reading about it somewhere. Most users of subprocess.Popen() will never wade through the document

[issue42041] venv subprocess call to python resolves to wrong interpreter

2020-10-18 Thread Eryk Sun
Eryk Sun added the comment: > Also, why would we document the Windows rules, but not the POSIX > rules? They are arguably just as strange to someone who doesn't > know them. POSIX rules are simply to search PATH for the filename as passed, and if it has a slash in it, the pa

[issue42041] venv subprocess call to python resolves to wrong interpreter

2020-10-18 Thread Eryk Sun
Eryk Sun added the comment: > You can build a cross-platform wrapper on top of native behaviour > (witness `shutil.which`) but you can't do the opposite. Nothing would prevent adding a parameter to use the platform semantics, if that had been in the design from the outset. B

[issue42041] venv subprocess call to python resolves to wrong interpreter

2020-10-18 Thread Eryk Sun
Eryk Sun added the comment: > For platform semantics, I'd prefer a link to the CreateProcessW docs, > with advice to read about the lpApplicationName parameter with > respect to `executable` and lpCommandLine with respect to `args` > and the platform search semantics. F

[issue42041] venv subprocess call to python resolves to wrong interpreter

2020-10-19 Thread Eryk Sun
Eryk Sun added the comment: > I'd read it because I'm interested, but that is probably too much detail > for someone who is trying to get something done quickly. I did say that I don't know how much should be documented. I tend to dump a lot of information in issues so

[issue42041] venv subprocess call to python resolves to wrong interpreter

2020-10-19 Thread Eryk Sun
Eryk Sun added the comment: > My biggest concern with the suggested wording ... is that it > reintroduces the issue with the redirector. I thought I addressed that in second paragraph by recommending sys.executable. It could be emphasized that running "python[x][.y]" is unr

[issue38324] [Windows] test_locale and test__locale failures on Windows

2020-10-19 Thread Eryk Sun
Eryk Sun added the comment: PR 20529 looks good to me. Thank you, Tiago. -- ___ Python tracker <https://bugs.python.org/issue38324> ___ ___ Python-bugs-list m

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

2020-10-20 Thread Eryk Sun
Eryk Sun added the comment: Regarding documentation, builtin open() and the io and os modules generally do not provide information about platform-specific errors. But documenting the behavior for the NotADirectoryError exception itself may be useful considering it applies to many POSIX

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

2020-10-22 Thread Eryk Sun
Eryk Sun added the comment: Steve, the PR that you pushed has the wrong error and error message. I told Philippe in msg377335 that ctypes raises FileNotFoundError with no error code. For example: >>> try: ctypes.CDLL('spam') ... except OSError as e: err = e

[issue11646] 2to3: msvcrt.(get|put)ch -> (get|put)wch

2020-10-22 Thread Eryk Sun
Eryk Sun added the comment: The bytes type has supported string methods for a long time now. I don't think there's anything else to do here. msvcrt.getch() is a low-level I/O function like os.read(). It should not be automatically converted to msvcrt.getwch(). Unfortunately th

[issue38233] datetime.datetime.fromtimestamp have different behaviour on windows and mac

2020-10-25 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate status: open -> closed ___ Python tracker <https://bugs.python.org/issue38233> ___ ___ Python-bugs-list

[issue42170] splitdrive fails for UNC path with the "\\?\UNC\" prefix.

2020-10-27 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: patch review -> resolved status: open -> closed superseder: -> support "UNC" device paths in ntpath.splitdrive ___ Python tracker <https://b

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

2020-10-27 Thread Eryk Sun
Eryk Sun added the comment: I'm attaching a rewrite of splitdrive() from msg352355. This version uses an internal _next() function to get the indices of the next path component, ignoring repeated separators. It also flattens the nested structure of the previous implementation by a

[issue42175] long lines from interactive stdin are truncated

2020-10-27 Thread Eryk Sun
Eryk Sun added the comment: For Windows see issue 41849. The legacy limit (i.e. PYTHONLEGACYWINDOWSSTDIO) for reading input via io.FileIO is 8K characters in Windows, but with io._WindowsConsoleIO, it's only 512 characters, which is far too small in general. The legacy implementati

[issue42178] failed pickle hangs python on exit in CMD.exe only

2020-10-27 Thread Eryk Sun
Eryk Sun added the comment: Due to the exception raised when trying to pickle main..dummy in popen_spawn_win32.Popen(), the main process may have already exited by the time the spawned worker calls WinAPI OpenProcess in spawn.spawn_main(). I suppose the reduction of prep_data and

[issue42196] Python Windows Installation Error 0x800705aa

2020-10-29 Thread Eryk Sun
Eryk Sun added the comment: 0x8007_05AA is ERROR_NO_SYSTEM_RESOURCES (1450, 0x05AA) returned as an HRESULT value. This error is usually due to a system call failing with the status code STATUS_INSUFFICIENT_RESOURCES. From "Pyhon39InstallLog.txt", apparently the installer failed to

[issue42252] Embeddable Python indicates that it uses PYTHONPATH

2020-11-03 Thread Eryk Sun
Eryk Sun added the comment: The embeddable distribution isn't intended for end users to run Python scripts from the command line, so I don't think the CLI help needs to be special cased. The documentation you quoted should be clarified as something like "isolated from user an

[issue42261] Windows legacy I/O mode mistakenly ignores the device encoding

2020-11-04 Thread Eryk Sun
New submission from Eryk Sun : In Python 3.8+, legacy standard I/O mode uses the process code page from GetACP instead of the correct device encoding from GetConsoleCP and GetConsoleOutputCP. For example: C:\>chcp 850 Active code page: 850 C:\>set PYTHONLEGACYWINDOWSS

[issue42261] Windows legacy I/O mode mistakenly ignores the device encoding

2020-11-04 Thread Eryk Sun
Eryk Sun added the comment: There's a related issue that affects opening duplicated file descriptors and opening "CON", "CONIN$", and "CONOUT$" in legacy I/O mode, but this case has always been broken. For Windows, _Py_device_encoding needs to be gen

[issue42261] Windows legacy I/O mode mistakenly ignores the device encoding

2020-11-04 Thread Eryk Sun
Eryk Sun added the comment: > The solution here is to fix config_init_stdio_encoding() to use > GetConsoleCP() and GetConsoleOutputCP() to build a "cpXXX" string. But, as I mentioned, that's only possible by replacing config->stdio_encoding with three s

[issue42261] Windows legacy I/O mode mistakenly ignores the device encoding

2020-11-04 Thread Eryk Sun
Eryk Sun added the comment: > It would be nice to get an unit test for this case. The process code page from GetACP() is either an ANSI code page or CP_UTF8 (65001). It should never be a Western OEM code page such as 850. In that case, a reliable unit test would check that the configu

[issue42293] Installation of pyinstaller in Windows fails with utf8 error

2020-11-08 Thread Eryk Sun
Eryk Sun added the comment: This looks to be a bug in the constructor of pip's BuildEnvironment class: https://github.com/pypa/pip/blob/a4f4bfbf8ba7fd1e60884a439907e3f2a32e117a/src/pip/_internal/build_env.py#L82 Python 3 source files are UTF-8 by default, but text files default t

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Eryk Sun
Eryk Sun added the comment: It also cannot be interrupted in 3.9. But 3.8 and earlier work correctly. -- nosy: +eryksun type: -> behavior versions: +Python 3.9 ___ Python tracker <https://bugs.python.org/issu

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +vstinner ___ Python tracker <https://bugs.python.org/issue42296> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Eryk Sun
Eryk Sun added the comment: See bpo-40010. COMPUTE_EVAL_BREAKER() in Python/ceval.c -- or _Py_ThreadCanHandleSignals in Include/internal/pycore_pystate.h -- needs to take into account that SIGNAL_PENDING_SIGNALS() gets called on a completely new thread in Windows

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Eryk Sun
Eryk Sun added the comment: Yes, if I force the return value of _Py_ThreadCanHandleSignals to 1, the loop is broken by a KeyboardInterrupt. -- ___ Python tracker <https://bugs.python.org/issue42

[issue42311] It seems like ctypes code makes truncated pointer values in x64(access violations)

2020-11-10 Thread Eryk Sun
Eryk Sun added the comment: A function that returns a pointer needs an explicit `restype` set. A function parameter that's a pointer generally requires `argtypes` to be set. For example: _testdll.GetPointer.restype = ctypes.c_void_p _testdll.SetPointer.argtypes = (ctypes.c_v

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-12 Thread Eryk Sun
Eryk Sun added the comment: Note that this issue only applies to a process that has a single Python thread. With multiple Python threads, the signal handler gets called when the main thread acquires the GIL. As far as Windows console-driven SIGINT and SIGBREAK are concerned, C

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread Eryk Sun
Eryk Sun added the comment: > always interrupt and let the thread decide if it has something to do. SIGNAL_PENDING_CALLS() is called on a Python thread via signal.raise_signal() or _thread.interrupt_main() / PyErr_SetInterrupt(). If you'd rather keep the COMPUTE_EVAL_BREAKER() call

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread Eryk Sun
Eryk Sun added the comment: > That sounds like a micro-optimization which is not worth it. In the back of my mind I was also thinking to generalize the behavior at runtime whenever a signal is tripped by a non-Python thread (e.g. a thread created by an extension module or ctypes), inst

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread Eryk Sun
Change by Eryk Sun : -- priority: release blocker -> stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue42296> ___ ___

[issue37205] time.perf_counter() is not system-wide on Windows, in disagreement with documentation

2020-11-13 Thread Eryk Sun
Eryk Sun added the comment: > suggest to use time.perf_counter_ns() instead of time.perf_counter() > for best precision. QPC typically has a frequency of 1e7, which requires 24 bits for the fraction of a second. So a system can be up for years before the 53-bit precision of a float

[issue37205] time.perf_counter() is not system-wide on Windows, in disagreement with documentation

2020-11-13 Thread Eryk Sun
Eryk Sun added the comment: > QPC typically has a frequency of 1e7, Never mind. Apparently with some combinations of chipset, processor, and Windows version, the QPC frequency runs far beyond the 1-10 MHz range. I thought Windows divided by 1024 instead of letting it run in the GHz ra

[issue42339] official embedded Python fails to import certain modules

2020-11-14 Thread Eryk Sun
Eryk Sun added the comment: > maybe there's a list of updates (or FAQ) to which you > want to add KB3063858? The documentation of the embeddable package [1] could highlight the need for KB2533623. Currently it's directly mentioned only in "What's New in Python 3.8&

[issue42178] failed pickle hangs python on exit in CMD.exe only

2020-11-16 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +davin, pitrou ___ Python tracker <https://bugs.python.org/issue42178> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42178] failed pickle hangs python on exit in CMD.exe only

2020-11-16 Thread Eryk Sun
Eryk Sun added the comment: Steve or Zach, please review PR 23290, submitted by Teugea Ioan-Teodor. It modifies the startup sequence for worker processes by creating the child process with a suspended thread and pickling process_obj to a BytesIO instance before resuming the thread and

[issue12726] explain that locale.getlocale() does not read system's locales

2020-11-16 Thread Eryk Sun
Eryk Sun added the comment: > I tried "import locale; locale.getlocale()" on macOS and > windows (3.10) and linux (3.7) and in all cases I got > non-None values. In Windows, starting with Python 3.8, Python sets the LC_CTYPE locale to the user (not system) default lo

[issue10854] Output .pyd name in error message of ImportError when DLL load fails

2020-11-16 Thread Eryk Sun
Eryk Sun added the comment: > The patch adding 'name' and 'path' to the ImportError str/repr > was not merged yet. It's up to whatever code raises an ImportError to determine how the name and path should be included in the error message. In Windows, the DLL n

[issue15263] Guard against invalid file handles in os functions

2020-11-18 Thread Eryk Sun
Eryk Sun added the comment: > I don't see any _Py_VerifyFd in the code, is this out of date? Yes, this issue is out of date. The underlying issue is that the C runtime in Windows automatically checks various parameters and calls a registered handler for invalid parameters, for w

[issue42397] lstrip 处理出现bug

2020-11-18 Thread Eryk Sun
Eryk Sun added the comment: Python 3.9 added str.removeprefix() and str.removesuffix() [1]: >>> "data_prj_t_suffix".removeprefix('data_prj_').removesuffix('_suffix') 't' [1] https://docs.python.org/3/library/stdtypes

[issue42421] Native open failed to create a file on windows10 when colon exists in the name

2020-11-20 Thread Eryk Sun
Eryk Sun added the comment: > 'FocalMix: Semi-Supervised Learning for 3D Medical Image Detection.pdf' In a filesystem that supports file streams [1], such as NTFS or ReFS, the above name refers to a $DATA stream named " Semi-Supervised Learning for 3D Medical Image Detect

[issue42438] Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding

2020-11-22 Thread Eryk Sun
Eryk Sun added the comment: > I reinstalled python from 3.8.2 to 3.9 Going from 3.8 to 3.9 is not an in-place upgrade. You need to create a new virtual environment that references the base 3.9 installation. -- nosy: +eryksun resolution: -> not a bug stage: -> backpo

[issue42438] Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding

2020-11-22 Thread Eryk Sun
Change by Eryk Sun : -- stage: backport needed -> resolved ___ Python tracker <https://bugs.python.org/issue42438> ___ ___ Python-bugs-list mailing list Un

[issue42441] UnicodeEncodeError

2020-11-23 Thread Eryk Sun
Eryk Sun added the comment: The default encoding for files in Windows is the process active code page, which defaults to the system code page, e.g. code page 1252 if the system locale is "en-IN". You need to explicitly use a Unicode encoding such as UTF-8 when opening the file,

[issue36965] use of STATUS_CONTROL_C_EXIT in Modules/main.c breaks compilation with non MSC compilers

2019-05-20 Thread Eryk Sun
Eryk Sun added the comment: "crtdbg.h" doesn't provide STATUS_CONTROL_C_EXIT, but it should be fine to remove it anyway. I think it was left behind by accident in 2007. It was added to support a PYTHONNOERRORWINDOW environment variable, but then this idea was dropped in fav

[issue36965] use of STATUS_CONTROL_C_EXIT in Modules/main.c breaks compilation with non MSC compilers

2019-05-21 Thread Eryk Sun
Eryk Sun added the comment: > FSCTL_GET_REPARSE_POINT is not exported with WIN32_LEAN_AND_MEAN You can explicitly include "winioctl.h" after "windows.h". Getting it from "windows.h" is indirect via "winscard.h" (smart card services), which will b

[issue36084] Threading: add builtin TID attribute to Thread objects

2019-05-22 Thread Eryk Sun
Eryk Sun added the comment: > The pthread_self subroutine returns the calling thread's ID. I don't know much about AIX, but according to the docs [1] the kernel thread ID should be thread_self(), which is not the same as pthread_self(). [1]: https://www.ibm.com/support/knowl

[issue37074] os.stat() does not work for NUL and CON

2019-05-28 Thread Eryk Sun
Eryk Sun added the comment: Opening "CON" (i.e. r"\\.\CON") fails with ERROR_INVALID_PARAMETER (87) because it has to be opened with either GENERIC_READ or GENERIC_WRITE data access in order to map it to either the console input buffer or active screen buffer. The Crea

[issue37074] os.stat() does not work for NUL and CON

2019-05-28 Thread Eryk Sun
Eryk Sun added the comment: > GetFullPathNameW(path, sizeof(fullPath), That should be sizeof(fullPath) / sizeof(WCHAR), or use Py_ARRAY_LENGTH, or just hard code 8. That's probably not the only mistake. But this is just an example to discuss the details and alte

[issue36935] bpo-35813 introduced usage of the deprecated PyErr_SetFromWindowsErrWithUnicodeFilename() function

2019-05-28 Thread Eryk Sun
Eryk Sun added the comment: > I think it would be best to replace the two calls with > PyErr_SetFromWindowsErr(0) (for now). For now it can at least be implemented inline. For example: if (handle == NULL) { PyObject *temp = name ? PyUnicode_FromWideChar(name, -1)

[issue37007] Implement socket.if_{nametoindex, indextoname} for Windows

2019-05-29 Thread Eryk Sun
Change by Eryk Sun : -- nosy: -eryksun ___ Python tracker <https://bugs.python.org/issue37007> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36656] Please add race-free os.link and os.symlink wrapper / helper

2019-06-04 Thread Eryk Sun
Eryk Sun added the comment: > I'd like to add a few notes; please do consider Windows interactions > here - Windows does not have the same model for inode replacement that > Posix has. Certainly Windows doesn't have the same model for inode replacement since it

[issue37089] `import Lib.os` works on windows (but shouldn't)

2019-06-04 Thread Eryk Sun
Eryk Sun added the comment: sys.prefix is usually argv0_path, but in a virtual environment argv0_path is set from "home" in pyvenv.cfg in order to find the standard library, and, if the site module is imported, sys.prefix is set to the virtual environment directory. Since f

[issue28708] Low FD_SETSIZE limit on Windows

2019-06-05 Thread Eryk Sun
Eryk Sun added the comment: > It doesn't have to. The actual number of descriptors is passed in, and To clarify, this is the fd_count in each fd_set, i.e. Winsock uses a counted SOCKET array instead of the bitmask that's found on other platforms. Winsock select() ignores

[issue28708] Low FD_SETSIZE limit on Windows

2019-06-06 Thread Eryk Sun
Eryk Sun added the comment: > Those fd_sets are currently allocated on stack and the array they > contain is determined currently by FD_SETSIZE. We'll basically need > a similar structure that we can allocate dynamically, and cast it to > fd_set when passing it to the sele

[issue37198] _parse_localename fail to parse 'en_IL'

2019-06-12 Thread Eryk Sun
Eryk Sun added the comment: Windows prefers locale names based on RFC 4646 language tags, which use a hyphen instead of an underscore (e.g. "en-UK"). This name format doesn't include an encoding. The C runtime (not the Windows API) makes one exception to support ".utf

[issue37275] GetConsole(Output)CP is used even when stdin/stdout is redirected

2019-06-14 Thread Eryk Sun
Eryk Sun added the comment: > # Power Shell 6 (use cp65001 by default) > PS C:¥> python3 -c "print('おはよう')" > ps.txt PowerShell standard I/O redirection is different from any shell I've ever used. In this case, it runs Python with StandardOutput set to a h

[issue37189] PyRun_String not exported in python38.dll

2019-06-17 Thread Eryk Sun
Eryk Sun added the comment: > api = ctypes.pythonapi > api2 = ctypes.PyDLL("", handle=sys.dllhandle) Those should be the same. In Windows, pythonapi is defined as PyDLL("python dll", None, sys.dllhandle). Wouldn't it be better to add a function to _testc

[issue4198] os.path.normcase gets fooled on windows with mapped linux network drive

2019-06-18 Thread Eryk Sun
Eryk Sun added the comment: > When running a VirtualBox Windows 7 guest on Linux I have found > that os.path.samefile() returns False when the filenames are the > same, e.g., > > f = r'V:\pdfs\boson1.pdf' > same = os.path.samefile(f, f) > print(s

[issue37380] subprocess.Popen._cleanup() "The handle is invalid" error when some old process is gone

2019-06-23 Thread Eryk Sun
Eryk Sun added the comment: See issue 36067 for a related discussion. The _active list and _cleanup function are not required in Windows. When a process exits, it gets rundown to free its handle table and virtual memory. Only the kernel object remains, which is kept alive by pointer and

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