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
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
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
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
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
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
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
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
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\
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg377918
___
Python tracker
<https://bugs.python.org/issue41925>
___
___
Python-bugs-list mailin
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\
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.
-
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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"
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
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
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg378489
___
Python tracker
<https://bugs.python.org/issue42013>
___
___
Python-bugs-list mailin
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.
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
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
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
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
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
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
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
>
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
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
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
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
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
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
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
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
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
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
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
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
Change by Eryk Sun :
--
resolution: -> duplicate
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue38233>
___
___
Python-bugs-list
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
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
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
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
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
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
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
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
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
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
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
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
Change by Eryk Sun :
--
nosy: +vstinner
___
Python tracker
<https://bugs.python.org/issue42296>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
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
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
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
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
Change by Eryk Sun :
--
priority: release blocker ->
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue42296>
___
___
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
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
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&
Change by Eryk Sun :
--
nosy: +davin, pitrou
___
Python tracker
<https://bugs.python.org/issue42178>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
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
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
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
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
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
Change by Eryk Sun :
--
stage: backport needed -> resolved
___
Python tracker
<https://bugs.python.org/issue42438>
___
___
Python-bugs-list mailing list
Un
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,
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
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
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
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
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
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)
Change by Eryk Sun :
--
nosy: -eryksun
___
Python tracker
<https://bugs.python.org/issue37007>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
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
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
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
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
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
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
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
1101 - 1200 of 2119 matches
Mail list logo