Eryk Sun added the comment:
> But on this particular issue, making the unconditional wait be
> interruptable by signals shouldn't be impossible.
PyThread_acquire_lock_timed() in Python/thread_nt.h currently ignores
intr_flag. The current implementation calls EnterNonRecursiveMutex(),
Eryk Sun added the comment:
> `cmd.exe /c "SETX PYTHONUTF8 1
You can run "[WindowsFolder]System32\setx.exe" directly. It's not a shell
command.
--
nosy: +eryksun
___
Python tracker
<https://bugs.
Change by Eryk Sun :
--
stage: patch review ->
versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/issu
Change by Eryk Sun :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue19050>
___
___
Change by Eryk Sun :
--
resolution: -> out of date
stage: needs patch -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eryk Sun added the comment:
The internal spawn function in ucrt, common_spawnv(), verifies its parameters
as follows:
_VALIDATE_RETURN(file_name != nullptr, EINVAL, -1);
_VALIDATE_RETURN(file_name[0]!= '\0',EINVAL, -1);
_VALIDATE_RETURN(arguments != nullptr
Change by Eryk Sun :
--
resolution: -> third party
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)
___
Python tracker
<https://bugs.python
Eryk Sun added the comment:
Automatically decrementing the reference count of a shared library (e.g. via
WinAPI FreeLibrary or POSIX dlclose) when a CDLL instance is finalized would
require significant design changes to ensure that all ctypes pointers, scalars,
and aggregates that reference
Eryk Sun added the comment:
I'm closing this as not a bug. If the process limits DOS paths to MAX_PATH,
then checking os.path.isfile() should not be special cased to support longer
DOS paths because calling open() on such a path will raise FileNotFoundError.
My suggestion in msg314126
Eryk Sun added the comment:
I'm changing this to a documentation issue and removing the Windows component.
The documentation doesn't make it clear that communicate() may block
indefinitely (in both POSIX and Windows) even after the process has terminated.
As currently implemented
Eryk Sun added the comment:
Demo Popen() methods, for discussion:
def _read_output(self, fileobj):
handle = msvcrt.get_osfhandle(fileobj.fileno())
output = self._fileobj2output[fileobj]
while True:
try:
size
New submission from Eryk Sun :
subprocess.run() handles TimeoutExpired by terminating the process and waiting
on it. In POSIX, the exception object contains the partially read stdout and
stderr bytes. For example:
cmd = 'echo spam; echo eggs >&2; sleep 2'
try: p = subprocess.
Eryk Sun added the comment:
> If it was the tests, they seem to have been fixed elsewhere.
The cited tests haven't been changed to work with non-normalized
sys.executable, sys.prefix, etc. But it's not common to run the test suite with
a non-normalized path such as "Lib/../buil
Change by Eryk Sun :
--
components: +Library (Lib), Windows -Interpreter Core
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6, Python 3.7
___
Python tracker
<https://bugs.python.
Eryk Sun added the comment:
Issue 37424 fixed this for Python 3.7+ in POSIX. It's still broken in Windows,
for which I'm leaving issue 31447 open.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
superseder: -> subprocess.run timeout does
Eryk Sun added the comment:
In Python 3.10 in POSIX, it's still the case that executable, prefix,
exec_prefix, base_prefix, and base_exec_prefix in the sys module do not get
normalized. For example, in Linux:
$ .local/bin/../bin/python3.10 -c "import sys; print(sys.execu
Eryk Sun added the comment:
This problem can be addressed most easily in _get_handles() by combining the
case of an invalid standard handle with that of a NULL standard handle, for
which a file handle is validated via GetFileType(). However, that leaves a
small window for the handle
Eryk Sun added the comment:
The documentation still has two references to
PyErr_SetFromWindowsErrWithFilenameObject, which is not a defined function in
the C API.
https://docs.python.org/3.10/c-api/exceptions.html#c.PyErr_SetFromWindowsErrWithFilename
--
components: +Windows
nosy
Eryk Sun added the comment:
format_error() can use format "L" (long long) and then check for a value in the
accepted range `value >= LONG_MIN && value <= ULONG_MAX`. If the value is out
of range, raise OverflowError. Otherwise assign the value to DWORD `code`.
Change by Eryk Sun :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue28462>
___
___
Eryk Sun added the comment:
It's still the case in 3.10 that unsigned status codes are limited to
0x7FFF_, and any larger value gets mapped to -1 (0x_). For example:
>>> rc = subprocess.call([sys.executable, '-c', 'raise
SystemExit(0x7FFF_)'])
&
Eryk Sun added the comment:
Update from my previous comment in 2016: in Python 3.7+, the socket module's
setipaddr() function calls Winsock inet_pton() instead of inet_addr(), and
falls back on getaddrinfo(). Neither supports octal addresses. At least using
octal fails instead of mistakenly
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.5, Python
3.6
___
Python tracker
<https://bugs.python.org/issue27
Eryk Sun added the comment:
El Samuko, is that a Windows (Win32), Cygwin, MSYS2, WSL, or some other version
of bash? The same for Python, and which version of Python is it. With these
details, I can tell you what `os.kill($WINPID, signal.CTRL_C_EVENT)"` is
probably
Eryk Sun added the comment:
ntpath.expanduser() no longer uses HOME (though the doc string still refers to
$HOME), so at least that problem is resolved.
I suppose IDLE could work around the HOME issue in Windows by passing
env=os.environ.copy() in the subprocess.Popen() call that creates
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.6
___
Python tracker
<https://bugs.python.org/issue26565>
___
___
Change by Eryk Sun :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue20010>
___
___
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python
3.5, Python 3.6
___
Python tracker
<https://bugs.python.org/issue11
Change by Eryk Sun :
--
type: -> behavior
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.5, Python
3.6
___
Python tracker
<https://bugs.python.org/issu
Eryk Sun added the comment:
The docs still need to clarified that isinstance(obj, type) is a necessary but
not sufficient condition for success. It would also be helpful if the error
message were less confusing in the case of registered subclasses such as
numbers.Number.
--
type
Change by Eryk Sun :
--
type: -> behavior
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python
3.5, Python 3.6
___
Python tracker
<https://bugs.python.org/issu
Change by Eryk Sun :
--
versions: +Python 3.8
___
Python tracker
<https://bugs.python.org/issue23425>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.3, Python 3.4
___
Python tracker
<https://bugs.python.org/issue23
Eryk Sun added the comment:
> I'm not sure we ever meant for LoadLibrary("python3.dll") to
> actively load the concrete python3X.dll.
IIRC, Paul Moore was doing something like this to create a script runner that
loads "python3.dll", which runs as a regular appl
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg387686
___
Python tracker
<https://bugs.python.org/issue29399>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
> The APIs are the same, so you can (should) LoadLibrary the one
> that you want.
The issue is that python3.dll doesn't depend on python3x.dll in the normal way.
For example, LoadLibraryExW("path/to/python3.dll", NULL,
LOAD_WITH_ALTERED_SEAR
Change by Eryk Sun :
--
resolution: -> works for me
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue30979>
___
___
Change by Eryk Sun :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue30460>
___
___
Eryk Sun added the comment:
This issue affects Windows 7 and earlier, so I'm changing the affected version
to Python 3.8, the last version to support Windows 7. I don't have access to
Windows 7 currently. If someone has access to an updated Windows 7 installation
(all required and optional
Eryk Sun added the comment:
> figure out whether to do `Path.cwd() / path`
Thus a UNC path is absolute, i.e. any path that starts with 2 or more slashes,
and all other paths are relative unless they have both a drive and a root. For
example:
def isabs(s):
"""T
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg387680
___
Python tracker
<https://bugs.python.org/issue28708>
___
___
Python-bugs-list mailin
Change by Eryk Sun :
Removed file: https://bugs.python.org/file48607/splitdrive.py
___
Python tracker
<https://bugs.python.org/issue37609>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
In Windows, maybe the os.environ mapping could use a case-insensitive subclass
of str for its keys, such as the following:
@total_ordering
class _CaseInsensitiveString(str):
def __eq__(self, other):
if not isinstance(other, str
Eryk Sun added the comment:
Here's an example of how to change the isatty() method in Modules/_io/fileio.c
to check for a console in Windows:
_io_FileIO_isatty_impl(fileio *self)
{
long res;
if (self->fd < 0)
return err_
Change by Eryk Sun :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue28364>
___
___
Eryk Sun added the comment:
The documentation of os.rename() should mention that on Windows the "operation
will fail if src and dst are on different filesystems". For POSIX, instead of
"will" it says "may", but the failure is a certainty in Windows since
MO
Change by Eryk Sun :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue27889>
___
___
Change by Eryk Sun :
--
resolution: -> out of date
stage: needs patch -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Eryk Sun :
--
resolution: -> out of date
stage: needs patch -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Eryk Sun added the comment:
Issue 28075 extended the os.stat() and os.lstat() implementation to query basic
stat informatiom from the parent directory if opening the file fails with
ERROR_ACCESS_DENIED. This change first became available in Python 3.5.3.
Previously it was only querying
Change by Eryk Sun :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue26866>
___
___
Eryk Sun added the comment:
os.stat() was redesigned in issue 37834, which entailed extensive updates
across the standard library to improve support for Windows reparse points. As
part of this, Win32JunctionTests.tearDown() was changed to use a more reliable
lexists() check, which resolves
Eryk Sun added the comment:
In 3.8+, the DLL search path for dependent DLLs when importing extension
modules excludes PATH and the current working directory. So it's far less
likely for an import to fail with ERROR_BAD_EXE_FORMAT.
Currently the error message in Python 3 includes the base
Eryk Sun added the comment:
Issue 25994 added support for the context-manager protocol and close() method
in 3.6. So it's at least much easier to ensure that the handle gets closed.
The documentation of scandir() links to WinAPI FindFirstFile and FindNextFile,
which at least mentions
Eryk Sun added the comment:
Popen.send_signal() documents that sending CTRL_C_EVENT (cancel) to a process
group is possible, which is clearly a true statement and easily demonstrated.
OTOH, the Windows documentation of GenerateConsoleCtrlEvent() claims it's not
possible. If you know what
Change by Eryk Sun :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue24493>
___
___
Change by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> shutil.copy raises IsADirectoryError when the directory does
not actually exist
___
Python tracker
<https://bugs.python
Eryk Sun added the comment:
I rewrote windows_helper.py with cleaner ctypes code, better error handling,
the correct implementation of restoring the previous privilege state, and
without leaking the handle for the process token. It's kind of limited as a
"Windows helper" module.
Change by Eryk Sun :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue23634>
___
___
Eryk Sun added the comment:
> All getlocale is used for in _strptime.py is comparing the value
> returned to the previous value returned.
Which is why _strptime should be calling setlocale(LC_TIME), the same as the
calendar module. That's not to say that I don't think get
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg345454
___
Python tracker
<https://bugs.python.org/issue37198>
___
___
Python-bugs-list mailin
Change by Eryk Sun :
--
components: +IO
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python
3.5
___
Python tracker
<https://bugs.python.org/issue22
Change by Eryk Sun :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue22976>
___
___
Change by Eryk Sun :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue22961>
___
Eryk Sun added the comment:
ntpath.realpath() has since been implemented, and it addresses the problem by
keeping the extended (verbatim) path prefix in the result if the input argument
has it, and otherwise removing the prefix if the final path resolves correctly
without
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg387522
___
Python tracker
<https://bugs.python.org/issue43298>
___
___
Python-bugs-list mailin
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg387525
___
Python tracker
<https://bugs.python.org/issue43298>
___
___
Python-bugs-list mailin
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg387521
___
Python tracker
<https://bugs.python.org/issue43298>
___
___
Python-bugs-list mailin
Change by Eryk Sun :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
title: shutil. copy file throws incorrect SameFileError on Google Drive File
Stream -> spam
___
Python tracker
<https://bugs.python
Eryk Sun added the comment:
On second thought, I think it's cleaner and avoids potential race conditions to
implement ntpath.sameopenfile(). Then use that to implement ntpath.samefile().
Here's a summary of suggested changes, with sample code to flesh out the
concepts:
* Extend nt
Eryk Sun added the comment:
Here's an implementation of attributes_from_dir() that strips trailing slashes
(e.g. "C:/spam///" -> "C:/spam"), which entails copying the const string up to
the last character that's not a slash. Rooted paths and drive paths that
ref
Eryk Sun added the comment:
> Isn't `PyUnicode_GET_LENGTH(text) < self->chunk_size` enough?
Yes, that's simpler, except with `<=`" instead of `<`, since the maximum count
is chunk_size when pending_bytes is a list or ASCII string. When I wrote the
more complex
Eryk Sun added the comment:
> In your code, huge data passed to .write(huge) may be
> remained in the internal buffer.
If you mean the buffered writer, then I don't see the problem. A large bytes
object in pending_bytes gets temporarily referenced by
_textiowrapper_writeflush(), an
Eryk Sun added the comment:
> stdout.write("small text")
> stdout.write("very large text") # Calls writeflush, but can not allocate
> buffer.
Without the optimization, in most cases this will likely fail in
_io_TextIOWrapper_write_impl() at the line `b =
Eryk Sun added the comment:
Issue 36748 added the ASCII optimization in write(), so I'm adding Inada Naoki
to the nosy list.
--
nosy: +methane
___
Python tracker
<https://bugs.python.org/issue43
Eryk Sun added the comment:
The sys.stdout TextIOWrapper is stuck in a bad state. When the write() method
is called with an ASCII string, it implements an optimization that stores a
reference to the str() object in the internal pending_bytes instead of
immediately encoding the string
Eryk Sun added the comment:
> but at least for clean installs of 3.10 we can avoid the need
> for admin completely
Except updating PATHEXT always requires admin access. I do this manually by
setting a user PATHEXT variable with %PATHEXT% as the first item and append the
extensions
Eryk Sun added the comment:
> The APIs were written at a time where locale modifiers
> simply did mot exist.
Technically, locale modifiers did exist circa 2000, but I suppose you mean that
they were uncommon to the point of being unheard of at the time.
The modifier field was spe
Eryk Sun added the comment:
> Is this the same as the other issue where get_locale is normalising
> the result according to some particular glibc logic and isn't at
> all portable?
If I understand Anders' immediate problem correctly, I think it can be
addressed by using setlocale(
Eryk Sun added the comment:
> What does use getlocale is time.strptime and datetime.datetime.strptime
calendar.LocaleTextCalendar also uses getlocale() and getdefaultlocale(). The
result from getdefaultlocale() cannot be set via setlocale() in Windows, which
also breaks resetloc
Eryk Sun added the comment:
I left this open in case someone wants to modify shutil.copy() and
shutil.copy2() to raise a less misleading exception when `dst` names a
non-existing directory such as 'not_a_dir/'. Failing with IsADirectoryError
(errno EISDIR) is confusing since shutil.copy
Eryk Sun added the comment:
Can't there be a library named "libc" with the shared module "liblibc.so"? It
seems to me that the _is_elf() function added in issue 41976 is breaking the
contract that "[i]f no library can be found, returns None". It's not supposed
Eryk Sun added the comment:
Issue 41976 added ctypes.util._is_elf() to filter out linker scripts such as
"libc.so". The PR was backported to 3.7. _is_elf() assumes the trace result has
absolute paths that can be opened, but Matthias is getting the relative
filename "liblibc.a
Eryk Sun added the comment:
The two files in "files.zip" have the same contents:
>>> open('source.css', 'rb').read() == open('destination.css', 'rb').read()
True
Maybe there's something peculiar about the stat results. Check that they're
both reported as regular
Eryk Sun added the comment:
The IDLE shortcut that's installed by the development distribution runs
`"\pythonw.exe" "\Lib\idlelib\idle.pyw"`.
Thus opening a file that's pinned to the jumplist will execute it as a script
via "pythonw.exe".
To integrate bette
Eryk Sun added the comment:
winreg.DeleteKey[Ex] does not require any particular access on the `key`
handle. This handle is used only as the native NT API RootDirectory [1] when
opening `subkey` with DELETE access via NtOpenKeyEx [2].
The extra access with winreg.DeleteKeyEx [3] is just
On 2/15/21, Abdur-Rahmaan Janhangeer wrote:
>
> I downloaded Python 3.9 yesterday, added the root folder to path
> renamed python.exe to py39.exe and did
> py39 -m venv venv
> the output was
> No such file or directory but i dont remember the exact phrase
Probably you downloaded the embedded
Eryk Sun added the comment:
Python uses standard Unicode character properties, as defined by the Unicode
Consortium. This issue is discussed in their FAQ [1]:
Q: Why does ß (U+00DF LATIN SMALL LETTER SHARP S) not uppercase to
U+1E9E LATIN CAPITAL LETTER SHARP S by default
Eryk Sun added the comment:
> IsADirectoryError: [Errno 21] Is a directory: 'not_a_dir/'
The trailing slash forces the OS to handle "not_a_dir" as a directory [1].
A pathname that contains at least one non- character and that
ends with one or more trailing cha
Change by Eryk Sun :
--
versions: +Python 3.7
___
Python tracker
<https://bugs.python.org/issue43105>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eryk Sun added the comment:
> and it happens that "pkg" is found in a folder that is
> given in sys.path as a relative path
I'd prefer that Python disallowed relative paths in sys.path [1]. But since
they're allowed, I think importlib at least could try to resolve relative
Eryk Sun added the comment:
NoneType would have to be replaced with None in make_funcptrtype_dict() and
PyCFuncPtr_set_restype() in Modules/_ctypes/_ctypes.c. In the C API, NoneType
is (PyObject *)&_PyNone_Type.
--
nosy: +eryksun
___
Py
Eryk Sun added the comment:
> If my understanding is right, the open() will invoke
> locale.getpreferredencoding() by setting the do_setlocale=False
> -- i.e. locale.getpreferredencoding(False) -- to avoid invoking
> setlocale(LC_CTYPE, "").
Yes, that's the
Eryk Sun added the comment:
The conflict between 32-bit and 64-bit user site-packages was resolved in issue
41627, starting with Python 3.10. It's not practical to backport this change to
existing 3.9 installations.
The "nt_user" install scheme was changed to use the confi
Eryk Sun added the comment:
> What's the correct way to set the DLL search path when running a python
> script?
If possible, the simplest approach is to put dependent DLLs in the same
directory as the extension module.
In 3.8+, the search path for the dependent DLLs of a normally im
Eryk Sun added the comment:
The SIZE [1] type for a rectangle has nothing to do with SIZE_T [2], the
integer type that's returned by C sizeof(). SIZE_T isn't defined in wintypes. A
new issue can be opened to add more of the common data types to wintypes.
Here's an example for defining
Change by Eryk Sun :
--
components: +IO, Library (Lib)
title: build-in open() doesn't use whatever locale.getpreferredencoding()
returns as default encoding. -> built-in open() doesn't use
locale.getpreferredencoding() as the default encoding
versions: +Python 3
Eryk Sun added the comment:
On most platforms, unless UTF-8 mode is enabled,
locale.getpreferredencoding(False) returns the LC_CTYPE encoding of the current
locale. For example, in Linux:
>>> locale.setlocale(locale.LC_CTYPE, 'en_US.UTF-8')
'en
Eryk Sun added the comment:
I'd prefer to leave ".." in the path, at least with PosixPath. (It doesn't
matter with WindowsPath.) The "there" component may be a symlink that's
currently inaccessible. That said, Python's os.path.realpath() has a long
history
801 - 900 of 2741 matches
Mail list logo