[issue46555] Unicode-mangled names refer inconsistently to constants

2022-01-30 Thread Eryk Sun
Eryk Sun added the comment: Why was it decided to not raise a syntax error when the NFKC normalization of a non-ASCII token matches a keyword? I don't see a use for cases such as `đť•šđť•— = 1` and `đť•šđť•— + 1`. It seems the cost in terms of confusion far outweighs any potential be

[issue46578] cant DEBUG os.spawnv()

2022-01-30 Thread Eryk Sun
Eryk Sun added the comment: > cmd310 = ["/LIBPATH:D:\\python310\\lib\\site-packages\\torch\\lib", The `argv` parameter of os.spawnv() should begin with a command name to ensure that the application parses its command-line correctly. This doesn't necessarily have to be a f

[issue46585] Should we re-export `PyObj_FromPtr` in `ctypes`?

2022-01-30 Thread Eryk Sun
Eryk Sun added the comment: Alternatively, one can cast the address to py_object and dereference its `value`. For example: >>> obj = bytearray(b'spam') >>> sys.getrefcount(obj) 2 >>> obj2 = ctypes.cast(id(obj), ctypes.py_objec

[issue46582] Windows builds fail: fatal error RC1116: RC terminating after preprocessor errors

2022-01-30 Thread Eryk Sun
Eryk Sun added the comment: PR 29396 and PR 29501 didn't get backported to 3.8 in November. Probably that was intentional since 3.8 only gets security fixes since 3.8.10, which was released in May. Supporting a newer build environment isn't a security issue. A core developer cou

[issue44264] Add descriptive error message when environment variable not detected

2022-01-29 Thread Eryk Sun
Eryk Sun added the comment: This is just a point of clarification. > my del did not change the environment variable os.environ defines the __delitem__ method to call C unsetenv(). Thus `del os.environ[varname]` does unset the environment variable, at least at the level of the C runt

[issue29688] Add support for Path.absolute()

2022-01-29 Thread Eryk Sun
Eryk Sun added the comment: In Windows, paths that are relative to the current directory on a drive aren't resolved. The following should be resolved by the current code: >>> os.chdir('C:/Temp') >>> pathlib.Path('C:').absolute() Windows

[issue46572] Unicode identifiers not necessarily unique

2022-01-29 Thread Eryk Sun
Eryk Sun added the comment: Please read "Identifiers and keywords" [1] in the documentation. For example: >>> import unicodedata as ud >>> ud.normalize('NFKC', '𝖇𝖆𝖗') == 'bar' True >>> c = '\N{CYRILLIC

[issue46550] __slots__ updates despite being read-only

2022-01-28 Thread Eryk Sun
Eryk Sun added the comment: If the target object of an augmented assignment doesn't support the in-place binary operation, the normal binary operation is used instead. Thus an augmented assignment is implemented to always assign the result back to the target. For an attribute, t

[issue46454] '0 -> /dev/null' is lost

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

[issue46454] '0 -> /dev/null' is lost

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

[issue46550] __slots__ updates despite being read-only

2022-01-27 Thread Eryk Sun
Eryk Sun added the comment: Please read about augmented assignment [1]. In the REPL, use help("+="). An augmented assignment evaluates the target (which, unlike normal assignment statements, cannot be an unpacking) and the expression list, performs the binary operation s

[issue46506] [Windows] wrap CreateFile to support follow_symlinks

2022-01-26 Thread Eryk Sun
Eryk Sun added the comment: Here's an implementation of _Py_CreateFile2() and win32_xstat_impl(): typedef struct { DWORD type; DWORD attributes; DWORD reparseTag; } _PY_CREATE_FILE_INFO; static HANDLE _Py_CreateFile2(LPCWSTR lpFileName, DWORD dwDesiredA

[issue46506] [Windows] wrap CreateFile to support follow_symlinks

2022-01-26 Thread Eryk Sun
Eryk Sun added the comment: > switch to the newer CreateFile2() function Apparently we need to allow FILE_SHARE_READ if CreateFile2() is used to implement os.stat(). It's not a big deal, but this is a design flaw. CreateFile2() always uses the kernel I/O flag FILE_DISALLOW_EXCL

[issue46454] '0 -> /dev/null' is lost

2022-01-26 Thread Eryk Sun
Eryk Sun added the comment: > stdin is closed > os.open() is called and creates a new fd=0 > a call to os.dup2(fd, 0) is made but is a noop The dup2() silent noop case is a problem, but not the problem that's reported in msg43. The two examples for this issue are fd.py

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

2022-01-26 Thread Eryk Sun
Eryk Sun added the comment: > AFAIK, the Win32_OperatingSystem caption is always ASCII. I think I was wrong here. The "Caption" field is localized, so the wmic.exe OEM encoded output to a pipe isn't reliable. The system OEM code page doesn't necessarily match the dis

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

2022-01-25 Thread Eryk Sun
Eryk Sun added the comment: > sys.getwindowsversion() which exposes GetVersionEx() looks fine to me. In Windows 8+, sys.getwindowsversion() returns a version that can vary from 6.2.9200 (Windows 8) up to the actual OS version. It depends on the OS versions supported by the applicat

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

2022-01-25 Thread Eryk Sun
Eryk Sun added the comment: > Bit wmic seems nice solution. > Is still working for windows lower than 11? wmic.exe is still included in Windows 10 and 11, but it's officially deprecated [1], which means it's no longer being actively developed, and it might be removed in

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

2022-01-24 Thread Eryk Sun
Change by Eryk Sun : -- dependencies: +[Windows] wrap CreateFile to support follow_symlinks ___ Python tracker <https://bugs.python.org/issue46490> ___ ___ Pytho

[issue46506] [Windows] wrap CreateFile to support follow_symlinks

2022-01-24 Thread Eryk Sun
New submission from Eryk Sun : Issue 46490 proposes to support follow_symlinks in os.utime() on Windows. Instead of duplicating the os.stat() implementation of follow_symlinks, I suggest factoring out a common _Py_CreateFile() function with two additional parameters: traverse (input) and

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

2022-01-24 Thread Eryk Sun
Eryk Sun added the comment: > It's *very* unlikely you'll ever get output that doesn't fit into MBCS, When writing to a pipe, wmic.exe hard codes using the process OEM code page (i.e. CP_OEMCP). If it matters, running wmic.exe with subprocess should use encoding='oe

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

2022-01-23 Thread Eryk Sun
Eryk Sun added the comment: The Windows API doesn't directly support opening a 'symlink' as Python defines it for the follow_symlinks parameter. That problem should be resolved in a separate issue. Then updating os.utime() would be relatively trivial. -- components

[issue46454] '0 -> /dev/null' is lost

2022-01-22 Thread Eryk Sun
Eryk Sun added the comment: > If some one closes fd 0, then he reopens it. it will not be inherited. In Windows, when a console process spawns a child console process without enabling handle inheritance -- e.g. subprocess.Popen(['python.exe']) -- the OS will manually duplicate

[issue45554] multiprocessing exitcode is insufficiently documented

2022-01-18 Thread Eryk Sun
Change by Eryk Sun : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue45554> ___ ___ Python-bugs-

[issue45554] multiprocessing exitcode is insufficiently documented

2022-01-18 Thread Eryk Sun
Eryk Sun added the comment: PR 30142 is sufficient for Unix, but it's missing a bit for Windows. In Windows, the C runtime library maps the console event for Ctrl+Break to SIGBREAK. The default handler for SIGBREAK exits with 0xC13A (i.e. STATUS_CONTROL_C_EXIT). This value is unre

[issue46287] UNC path normalisation issues on Windows

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

[issue46326] 'virtualenv --clear' should prompt user before nuking entire directory

2022-01-10 Thread Eryk Sun
Eryk Sun added the comment: The implementation of `--clear` in virtualenv apparently was changed to align with venv. On the linked virtualenv issue, Bernát Gábor suggested creating a bpo issue for venv to determine how the issue should be resolved for virtualenv. -- nosy

[issue46326] 'virtualenv --clear' should prompt user before nuking entire directory

2022-01-10 Thread Eryk Sun
Eryk Sun added the comment: Ned, the CLI of venv has a `--clear` option, which invokes EnvBuilder [1] with clear=True. It's implemented by EnvBuilder.clear_directory(). Ali wants this method to prompt for confirmation before deleting the directory contents and also proposes the additi

[issue46142] python --help output is too long

2022-01-10 Thread Eryk Sun
Eryk Sun added the comment: > Do you know other projects which dump the full help into stdout > when asking for the "full help"? `ps --help` lists sections "". The "--help all" output is all sections, but truly all help is only available via `man ps`.

[issue46226] User specific paths added to System PATH environment variable

2022-01-07 Thread Eryk Sun
Eryk Sun added the comment: Were you upgrading an existing installation of Python 3.10? Did it actually install in "C:\Program Files\Python310"? Is Python currently installed in per-user "%LocalAppData%\Programs\Python\Python310"? Was it ever installed there? -

[issue46287] UNC path normalisation issues on Windows

2022-01-07 Thread Eryk Sun
Eryk Sun added the comment: > _Py_abspath/_getfullpathname does not always call GetFullPathNameW on 3.11. Also, PathCchSkipRoot() doesn't recognize forward slash as a path separator, so _Py_isabs() is wrong in many cases compared to the same path that uses backslash as the path s

[issue46297] Python interpreter crashes on bootup with multiple PythonPaths set in registry

2022-01-07 Thread Eryk Sun
Change by Eryk Sun : -- type: behavior -> crash ___ Python tracker <https://bugs.python.org/issue46297> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue46297] Python interpreter crashes on bootup with multiple PythonPaths set in registry

2022-01-07 Thread Eryk Sun
Change by Eryk Sun : -- components: +Windows nosy: +paul.moore, tim.golden, zach.ware type: crash -> behavior ___ Python tracker <https://bugs.python.org/issu

[issue46217] 3.11 build failure on Win10: new _freeze_module changes?

2022-01-07 Thread Eryk Sun
Eryk Sun added the comment: Terry, it's just a simple bug that slipped by. The PATHCCH_OPTIONS enum in the SDK header "PathCch.h" unconditionally defines all of the options. So there's no compiler error when building with a newer version of the SDK, even though we de

[issue9937] _winreg.EnumValue causes MemoryError

2022-01-07 Thread Eryk Sun
Eryk Sun added the comment: > Did anyone reproduce on python3.X? In principle, winreg should not have a problem in 3.x because it only uses the UTF-16 wide-character API. -- nosy: +eryksun stage: -> resolved status: pending -> closed _

[issue46276] ImportError: DLL load failed while importing

2022-01-06 Thread Eryk Sun
Eryk Sun added the comment: > ImportError: DLL load failed while importing _socket: El parámetro no es > correcto. I'm not familiar with the implementation of PyInstaller, which is a third-party tool. The above invalid-parameter error may be indirectly related to the problem wit

[issue46276] ImportError: DLL load failed while importing

2022-01-06 Thread Eryk Sun
Eryk Sun added the comment: "_frida.cp310-win_amd64.pyd" is a bad build or corrupted file. It imports a procedure with no name from a DLL with no name, which causes the loader to search for a file named ".DLL". Even if that were found, it imports another procedure wit

[issue46217] 3.11 build failure on Win10: new _freeze_module changes?

2022-01-03 Thread Eryk Sun
Eryk Sun added the comment: With just PATHCCH_ALLOW_LONG_PATHS, PathCchCombineEx() returns a long path as a normal path (i.e. not a \\?\ extended path) if long-path support is enabled for the current process. Otherwise, if long-path support isn't enabled or available, as is always the

[issue34931] os.path.splitext with more dots

2022-01-03 Thread Eryk Sun
Eryk Sun added the comment: > On Windows the extension of "python.exe" is "exe", not ".exe". FWIW, a file extension in Windows includes the dot. Trailing dots are stripped from filenames, so a file can't be named "python." because it's

[issue46171] venv module produces spurious warning that location has moved

2021-12-31 Thread Eryk Sun
Eryk Sun added the comment: > My VHDX mounted in a directory is affected by this I created a VHDX and mounted it in a directory. It's just a regular volume mount point with a junction (IO_REPARSE_TAG_MOUNT_POINT). That won't cause any problems, so I guess your setup must be

[issue46193] Using a dictionary for open files.

2021-12-29 Thread Eryk Sun
Eryk Sun added the comment: Every time open(r"test.txt", "w") is called, the existing "test.txt" file gets overwritten in the filesystem as an empty file. For each iteration, setdefault() returns a reference to the first file object, which advances its f

[issue46171] venv module produces spurious warning that location has moved

2021-12-28 Thread Eryk Sun
Eryk Sun added the comment: > There are plenty of other ways to get a venv through a potentially > unexpected path (turns out I've been doing one for years) Examples would be appreciated because I'm drawing a blank here. A junction or directory symlink in the parent pat

[issue46171] venv module produces spurious warning that location has moved

2021-12-24 Thread Eryk Sun
Eryk Sun added the comment: There's still the problem of the system using short names in %TEMP%, since by default that's under "%USERPROFILE%\AppData". Either an exception could be made for the temp directory, since it's never redirected (AFAIK), or su

[issue46171] venv module produces spurious warning that location has moved

2021-12-24 Thread Eryk Sun
Eryk Sun added the comment: There's no point to making the user worry about short names, symlinks, or non-canonical mount points in the filesystem path of a virtual environment. It's still accessible where the user expects to find it. The problem for bpo-45337 is filesystem redi

[issue46153] function fails in exec when locals is given

2021-12-23 Thread Eryk Sun
Eryk Sun added the comment: > You seem to be arguing that a description in the docs is "misleading", > not because it misleads, but because it don't describe a situation > which has nothing to do with the situation that the docs are describing. To me it's mislea

[issue46153] function fails in exec when locals is given

2021-12-22 Thread Eryk Sun
Eryk Sun added the comment: > That's taken straight out of the documentation. Yes, but it's still a misleading comparison. > Until I understood that exec with two different mapping objects as > globals and locals behaves as if the code where embedded inside a > class

[issue46153] function fails in exec when locals is given

2021-12-22 Thread Eryk Sun
Eryk Sun added the comment: > If exec gets two separate objects as globals and locals, > the code will be executed as if it were embedded in a > class definition. That's a misleading comparison because a class definition intentionally supports nonlocal closures, which

[issue41222] POpen bufsize=0 ignored with universal_newlines=True

2021-12-22 Thread Eryk Sun
Eryk Sun added the comment: > Buffering is necessary for implementing the universal_newlines Why is that? I can see that it requires newline state tracking, and the allowance to make two read(fd, &c, 1) system calls for a single read(1) method call, in case a "\n"

[issue46143] [docs] IO > Text Encoding info outdated

2021-12-21 Thread Eryk Sun
Eryk Sun added the comment: The rare circumstance in which UTF-8 mode gets enabled automatically is described in the following paragraph [1]: If the PYTHONUTF8 environment variable is not set at all, then the interpreter defaults to using the current locale settings, unless the

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun
Eryk Sun added the comment: > but errors in DirEntry.is_dir() and DirEntry.is_symlink() > are always ignored In Windows, is_symlink() won't fail due to a long path, since that information comes from the directory listing, but is_dir() might fail for a long path if it'

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun
Eryk Sun added the comment: If I had long paths enabled, then next(os.walk(p, onerror=print)) would not have printed the error that I showed in the example and would not have immediately raised StopIteration. Instead it would have returned a (dirpath, dirnames, filenames) result for

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun
Eryk Sun added the comment: It works as expected for me: >>> len(p) 261 >>> print(p) C:\Temp\Jim\Documents\jschw_uiowtv3_old\AppData\Local\Google\Chrome\User Data\Default\Extensions\nenlahapcbofgnanklpelkaejcehkggg\0.1.823.675_0\notifications\pages\C

[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun
Eryk Sun added the comment: > Python 3.9.6 scan_dir returns filenotfound on long paths, > but os_walk does not. This would be surprising. os.walk() has been implemented via os.scandir() since Python 3.5. Do you have a concrete example of the directory structure to test? > I see

[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-12-13 Thread Eryk Sun
Eryk Sun added the comment: PR 29821 adds __APPLE__ to the platforms that use fcntl(fd, F_GETFD). Is this okay on macOS, given bpo-30225? Apparently fstat() fails if the other end of a pipe is closed. -- ___ Python tracker <ht

[issue46056] Cannot use virtual environment on Windows 10 in corporate security settings

2021-12-13 Thread Eryk Sun
Eryk Sun added the comment: > symlinks do not work for me Sorry, I forgot that you're using the store app. The store app has to use the copied venv launchers. When a store app is run from the command line, the system executes an appexec link from "%LocalAppData%\Microsof

[issue46056] Cannot use virtual environment on Windows 10 in corporate security settings

2021-12-12 Thread Eryk Sun
Eryk Sun added the comment: Try using symlinks if you're allowed, e.g. `python -m venv --symlinks `. Note that a virtual environment created with symlinks is unreliable in some cases because ShellExecute[Ex]W() eagerly resolves a symlink before calling CreateProcessW(). Also, you won

[issue46052] IDLE: make Ctrl, Alt + IME non-ascii letter work on Windows

2021-12-12 Thread Eryk Sun
Eryk Sun added the comment: I think the following wiki article still applies even though it was first discussed in 2003: "KeySyms on platforms other than X11" [1]. In particular, it states the following: On Windows and MacOS X Tk only supports keysyms correctly for a limi

[issue46052] IDLE: make Ctrl, Alt + IME non-ascii letter work on Windows

2021-12-12 Thread Eryk Sun
Eryk Sun added the comment: The alternate keyboard shortcuts for the clipboard work fine with a Russian keyboard layout: copy: Ctrl+Insert cut: Shift+Delete paste: Shift+Insert Some programs also support Alt+Backspace for undo (Ctrl+Z). Watch out with Shift+Delete in GUI shells

[issue37701] shutil.copyfile raises SpecialFileError for symlink to fifo

2021-12-11 Thread Eryk Sun
Eryk Sun added the comment: > Raising a SpecialFileError would be OK if `follow_symlinks` was False. I expect it to fail if follow_symlinks is True, which is the default value. I expect it to succeed with follow_symlinks=False, which should create a shallow copy of just the syml

[issue14484] missing return in win32_kill?

2021-12-11 Thread Eryk Sun
Eryk Sun added the comment: The details of os.kill() on Windows have been discussed extensively for years in various issues such as bpo-26350, bpo-23948, and bpo-42962. But the problem of the missing return statement is always overwhelmed by discussion of the egregiously bad design of this

[issue14484] missing return in win32_kill?

2021-12-11 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg408336 ___ Python tracker <https://bugs.python.org/issue14484> ___ ___ Python-bugs-list mailin

[issue14484] missing return in win32_kill?

2021-12-11 Thread Eryk Sun
Eryk Sun added the comment: The details of os.kill() on Windows have been discussed extensively for years in various issues such as bpo-26350, bp-23948, and bp42962. But the problem of the missing return statement is always overwhelmed by discussion of the egregiously bad design of this

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

2021-12-11 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> missing return in win32_kill? ___ Python tracker <https://bugs.python

[issue23948] Deprecate os.kill() on Windows

2021-12-11 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> rejected stage: needs patch -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread Eryk Sun
Eryk Sun added the comment: The code to copy a file could be rewritten to use a regex match. For example: # Copy src to dst. If src is a base executable, copy a launcher. dirname, filename = os.path.split(src) m = re.match(r'(pythonw?)[0-9._]*(

[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread Eryk Sun
Change by Eryk Sun : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware versions: +Python 3.11 -Python 3.8 ___ Python tracker <https://bugs.python.org/issue43

[issue43749] venv module does not copy the correct python exe

2021-12-10 Thread Eryk Sun
Eryk Sun added the comment: The Windows implementation of symlink_or_copy() actually copies "python.exe" and "pythonw.exe" launchers from "Lib/venv/scripts/nt". One cannot simply copy the "python3.exe" executable because the required DLLs aren't

[issue12142] Reference cycle when importing ctypes

2021-12-09 Thread Eryk Sun
Eryk Sun added the comment: The _ctypes extension module could have a dict that maps each format code to its (size, alignment), based on `formattable`. Then direct size comparisons wouldn't be limited to types defined by the struct module, and it wouldn't be necessary to create c_

[issue23104] [Windows x86-64] ctypes: Incorrect function call

2021-12-09 Thread Eryk Sun
Change by Eryk Sun : -- type: -> behavior ___ Python tracker <https://bugs.python.org/issue23104> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue23104] [Windows x86-64] ctypes: Incorrect function call

2021-12-09 Thread Eryk Sun
Eryk Sun added the comment: Victor's comment wasn't relevant. objid() stays referenced during the call. Anyway, I just built testlib.c and verified that this ctypes example works correctly in both 64-bit 3.4.4 and 3.10, so the issue is out of date. -- nosy: +eryksun

[issue44540] venv: activate.bat fails for venv with special characters in PATH

2021-12-08 Thread Eryk Sun
Change by Eryk Sun : Added file: https://bugs.python.org/file50484/deactivate.bat ___ Python tracker <https://bugs.python.org/issue44540> ___ ___ Python-bugs-list mailin

[issue44540] venv: activate.bat fails for venv with special characters in PATH

2021-12-08 Thread Eryk Sun
Eryk Sun added the comment: There's no parsing problem with delayed expansion (e.g. "!VAR!" instead of %VAR%) and for loop variables (e.g. "%%a"). The solution is thus to execute in a local scope that enables delayed expansion and command extensions [1]. Tha

[issue10608] [doc] Add a section to Windows FAQ explaining os.symlink

2021-12-08 Thread Eryk Sun
Eryk Sun added the comment: Ingrid's patch misses the requirement to log off after adding a privilege to the current account. A new access token is required, from a fresh logon. Privileges can also be added to groups, not just to individual user accounts. Thus the symlink privilege c

[issue46002] py Launcher for Windows with MSYS2

2021-12-07 Thread Eryk Sun
Eryk Sun added the comment: You can use "#!python", or "#!/usr/bin/python", or "#!/usr/local/bin/python". They're all equivalent, and they do not search PATH. Since no wanted version is specified, the launcher will look for a version to run in the

[issue33411] All console message are in the error output in bash interpretor

2021-12-07 Thread Eryk Sun
Eryk Sun added the comment: PyOS_Readline() calls PyOS_StdioReadline() if sys_stdin or sys_stdout isn't a tty file. This function always writes the prompt to stderr, as follows: if (prompt) { fprintf(stderr, "%s", prompt); } fflush(stderr); Maybe t

[issue36850] shutil.copy2 fails with even with source network filesystem not supporting extended attributes

2021-12-07 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> behavior ___ Python tracker <https://bugs.python

[issue31879] Launcher fails on custom command starting with "python"

2021-12-06 Thread Eryk Sun
Eryk Sun added the comment: Whether it should be this way or not, here's how it currently works. The builtin virtual paths all end with "python": static SHEBANG builtin_virtual_paths [] = { { L"/usr/bin/env python", TRUE }, { L"/usr/bin/pyth

[issue46003] os.replace is not cross-platform: at least improve documentation

2021-12-06 Thread Eryk Sun
Eryk Sun added the comment: The os module tries to avoid documenting low-level OS behaviors. It would be unreliable and difficult to maintain. In the case of os.replace(), in Windows it calls MoveFileExW() with the flag MOVEFILE_REPLACE_EXISTING [1]. The source and destination paths must

[issue8161] inconsistency behavior in ctypes.c_char_p dereferencing

2021-12-06 Thread Eryk Sun
Eryk Sun added the comment: This appears to be misreported. The implementation in 3.1.2rc1 looks correct to me [1]. Either way, it's out of date. That said, the emulation of a simple type in an aggregate type is still incomplete nowadays. It's not implemented when a c_char or c_w

[issue46002] py Launcher for Windows with MSYS2

2021-12-06 Thread Eryk Sun
Eryk Sun added the comment: The shebang "#!/usr/bin/env python" searches PATH for "python" plus the PATHEXT file extensions. The shebang "#!/usr/bin/env python3" uses the highest version of Python 3 from the registry. It doesn't search PATH because Pytho

[issue45987] os.chdir in unittest's test case causes RecursionError on Windows

2021-12-05 Thread Eryk Sun
Eryk Sun added the comment: Windows opens the working directory without delete sharing, so trying to delete it fails with a PermissionError for ERROR_SHARING_VIOLATION (winerror 32). I discussed a modified version of the _rmtree() method in msg377358. The proposed version would try to reset

[issue44735] Failed venv Activation With "&" In Folder Name

2021-12-04 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue44735> ___

[issue44540] venv: activate.bat fails for venv with special characters in PATH

2021-12-04 Thread Eryk Sun
Change by Eryk Sun : -- stage: -> needs patch versions: +Python 3.10, Python 3.11 ___ Python tracker <https://bugs.python.org/issue44540> ___ ___ Python-

[issue40467] subprocess: replacement shell on windows with executable="..." arg

2021-12-04 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.10, Python 3.11 -Python 3.7 ___ Python tracker <https://bugs.python.org/issue40467> ___ ___ Python-bugs-list mailin

[issue40467] subprocess: replacement shell on windows with executable="..." arg

2021-12-04 Thread Eryk Sun
Eryk Sun added the comment: > it might be nice if it's possible to give some sort of useful > warning/error when this happens -- perhaps say that specifying > both shell=True and executable="..." isn't supported on Windows? The `shell` parameter is documented as

[issue45914] Very first multiprocessing example not working on Windows 11

2021-12-03 Thread Eryk Sun
Eryk Sun added the comment: > not quite clear to me it this only applies on Windows or is general. macOS defaults to the spawn method (bpo-33725). -- ___ Python tracker <https://bugs.python.org/issu

[issue24966] shutil.get_terminal_size() throws ValueError if stdout is detached, no fallback

2021-12-02 Thread Eryk Sun
Eryk Sun added the comment: This was fixed in 3.5. -- nosy: +eryksun resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Fix shutil.get_terminal_size() to catch AttributeError ___ Python tra

[issue45944] Avoid calling isatty() for most open() calls

2021-12-01 Thread Eryk Sun
Eryk Sun added the comment: > make it returning False without invoking a system call if the file > size is non-zero it will eliminate the need to expose _size. I suggest using the file type instead of the size. There's no reason to call isatty() if it's not an S_IFCHR file.

[issue12957] [doc] mmap.resize changes memory address of mmap'd region

2021-12-01 Thread Eryk Sun
Eryk Sun added the comment: mmap no longer allows resizing if the object has buffer exports. For example: >>> m = mmap.mmap(-1, 4096, access=mmap.ACCESS_WRITE) >>> p = (ctypes.c_char * 4096).from_buffer(m) >>> m.resize(8192) Traceback (most re

[issue19941] python -m imports non-ASCII .py file without encoding declaration

2021-11-30 Thread Eryk Sun
Eryk Sun added the comment: test.py is a UTF-8 file, which is the default source encoding in Python 3. It fails as expected if the test script is encoded differently, such as Latin-1, unless the source encoding is declared. -- nosy: +eryksun resolution: -> out of date st

[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-11-28 Thread Eryk Sun
Eryk Sun added the comment: I've created bpo-45919 with a suggested enhancement to use GetFileType() in Windows, since the Windows C runtime does not provide fcntl(). -- ___ Python tracker <https://bugs.python.org/is

[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-11-28 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg407216 ___ Python tracker <https://bugs.python.org/issue45915> ___ ___ Python-bugs-list mailin

[issue45919] Use WinAPI GetFileType() in is_valid_fd()

2021-11-28 Thread Eryk Sun
New submission from Eryk Sun : During startup, is_valid_fd() in Python/pylifecycle.c is called to validate stdin, stdout, and stderr. Performance isn't critical here, but every bit helps in reducing startup time. In my tests, implementing this check in Windows via GetFileType((H

[issue45915] Use fcntl(fd, F_GETFD) to check whether an fd is valid

2021-11-28 Thread Eryk Sun
Eryk Sun added the comment: In Windows, GetFileType((HANDLE)_get_osfhandle(fd)) is several times faster than close(dup(fd)). For example: #if defined(MS_WINDOWS) int type; _Py_BEGIN_SUPPRESS_IPH type = GetFileType((HANDLE)_get_osfhandle(fd)); _Py_END_SUPPRESS_IPH return

[issue45914] Very first multiprocessing example not working on Windows 11

2021-11-27 Thread Eryk Sun
Eryk Sun added the comment: > AttributeError: Can't get attribute 'f' > on The Windows API only supports the spawn method of process creation. In POSIX (except macOS), the default is the fork method, for which the child inherits the interactive main module of the par

[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Eryk Sun
Eryk Sun added the comment: > What does "the builtin readline support" refer to here? > Presumably not GNU Readline? That's referring to the readline(ish) support that's built into the console host for ReadFile() and ReadConsole() calls when the input stream is

[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Eryk Sun
Eryk Sun added the comment: > AFAIK the reason command history works in cmd.py on Windows is > that it's built into the terminal program. Or maybe into the > operating system. As mentioned in msg406800, input editing, history (e.g. up/down arrows, F7 popup, F8 completion), and

[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-27 Thread Eryk Sun
Eryk Sun added the comment: > You can take the view that it's not a bug (with some justification), > but a few lines in the cmd docs would make all the difference in > terms of wasted time. If anything, I think the readline documentation should have a note explaining th

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

2021-11-26 Thread Eryk Sun
Eryk Sun added the comment: > and b / a gives me WindowsPath('/a/b'). So I'm like "ok, a seems > like absolute, I will test for that" but on Windows a.is_absolute() > is False. Path.is_absolute() is true if a path has a `root` and, for a Windows path, also

[issue45901] store app file type ignores command-line arguments

2021-11-25 Thread Eryk Sun
New submission from Eryk Sun : The file association for the store app uses '"%1"' for the command-line parameters. This ignores the rest of the command-line arguments, i.e. '%*'. In PC/layout/support/appxmanifest.py, the add_application() calls that

[issue45870] There's no readline module on Windows Python (cmd.Cmd)

2021-11-22 Thread Eryk Sun
Eryk Sun added the comment: > The Windows cmd implementation clearly uses readline or > some compatible lib under the hood The REPL shell and input() call PyOS_Readline(). If this call isn't hooked (e.g. by the readline module), and stdin is a console file, then it reads a li

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