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" mo
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
Change by Eryk Sun :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue24493>
___
___
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
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 mention
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
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
Change by Eryk Sun :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue26866>
___
___
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 the
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
Change by Eryk Sun :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue27889>
___
___
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/issue28364>
___
___
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
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
Change by Eryk Sun :
Removed file: https://bugs.python.org/file48607/splitdrive.py
___
Python tracker
<https://bugs.python.org/issue37609>
___
___
Python-bugs-list mailin
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg387680
___
Python tracker
<https://bugs.python.org/issue28708>
___
___
Python-bugs-list mailin
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
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 an
Change by Eryk Sun :
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue30460>
___
___
Change by Eryk Sun :
--
resolution: -> works for me
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue30979>
___
___
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
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:
> 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 app
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
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 :
--
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
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.5, Python
3.6
___
Python tracker
<https://bugs.python.org/issu
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 :
--
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.6
___
Python tracker
<https://bugs.python.org/issue26565>
___
___
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
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
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:
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 mista
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(0
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:
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`.
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:
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 to
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.
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 tim
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:
> 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 "L
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 = s
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
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 impleme
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 msg3141
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
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
Change by Eryk Sun :
--
resolution: -> third party
stage: patch review -> 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
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: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue19050>
___
___
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
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://
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 EnterNonRecursiveMut
Eryk Sun added the comment:
Alexander, I wrote the above sample function to be slotted directly into the
existing design based on the SIGINT event. I wasn't looking to rewrite
everything using user-mode APCs and alertable waits. A change like that could
have ramifications for applica
Eryk Sun added the comment:
> I don't understand why any patch for CPython is needed at all.
If and operation on self._handle fails as an invalid handle (due to an
underlying STATUS_INVALID_HANDLE or STATUS_OBJECT_TYPE_MISMATCH), then call
self._handle.Detach() and re-raise the e
Eryk Sun added the comment:
> I'm always very hesitant to modify system-wide (or user-wide) settings
> like this though. I'd be more comfortable if we made it a PYTHONUTF8_310
> variable that _only_ applies to that specific version. Otherwise someone
> might insta
Eryk Sun added the comment:
> Vice versa, using bytes objects cannot represent all file names
> on Windows (in the standard mbcs encoding), hence Windows
> applications should use string objects to access all files.
This is outdated advice that should be removed, or at least re
Eryk Sun added the comment:
The locale_alias database was extended to support "en_AG" and many others, but
I'd still prefer Serhiy's suggestion to not guess the codeset when checking the
default LC_CTYPE category. Use locale.nl_langinfo(locale.CODESET), if it's
ava
Eryk Sun added the comment:
For whatever the reason and Windows version, it's still the case that
_get_handles() should work around any bad standard handles in the current
process. In bpo-25492, I suggested checking os.get_handle_inheritable(). That's
too permissive. It should
Eryk Sun added the comment:
I forgot about the much older issue for this problem. I'm closing this issue,
because the broken behavior should be fixed, not documented.
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> subproce
Eryk Sun added the comment:
I'm closing this issue because the behavior was addressed for Python 3 in POSIX
and mostly addressed in Windows (PEP 443, bpo-19764). The switch to using
PROC_THREAD_ATTRIBUTE_HANDLE_LIST with subprocess.Popen() in Windows at least
makes scripts safe from
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/issue4
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.5, Python 3.6, Python
3.7
___
Python tracker
<https://bugs.python.org/issue22
Eryk Sun added the comment:
For example, the named-pipe filesystem (NPFS), doesn't return timestamps for
pipes in the directory listing, so the timestamps are all 0 (i.e. 1601-01-01):
>>> write_time = win32file.FindFilesW('//./pipe/*')[0][3]
>>> f
Change by Eryk Sun :
--
type: -> enhancement
versions: +Python 3.10 -Python 2.7, Python 3.7
___
Python tracker
<https://bugs.python.org/issue39375>
___
___
Py
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.9 -Python 2.7, Python 3.7
___
Python tracker
<https://bugs.python.org/issue36021>
___
___
Python-bug
Change by Eryk Sun :
--
resolution: -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder: -> os.path states that bytes can't represent all MBCS paths under
Windows
___
Python tracker
<https://bugs.p
Eryk Sun added the comment:
> lets not claim that bytes cannot represent everything on a filesystem
> with an encoding.
Gregory, before changing the filesystem encoding to UTF-8 in Python 3.6, the
[A]NSI file API (e.g. CreateFileA) was used for bytes paths and the [W]ide
character fi
Change by Eryk Sun :
--
components: +Interpreter Core -IO
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.6, Python
3.7
___
Python tracker
<https://bugs.python.org/issue30
Eryk Sun added the comment:
The is fixed in 3.7+.
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.5, Python
3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/issue28
Eryk Sun added the comment:
> instead of the stated 'surrogatepass'
In Python 3.6 and above, you can check this as follows:
>>> sys.getfilesystemencoding()
'utf-8'
>>> sys.getfilesystemencodeerrors()
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.5, Python
3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/issue25
Change by Eryk Sun :
--
type: behavior -> enhancement
versions: -Python 3.5, Python 3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/issu
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/issue29533>
___
___
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg221020
___
Python tracker
<https://bugs.python.org/issue16272>
___
___
Python-bugs-list mailin
Change by Eryk Sun :
--
type: -> enhancement
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/issu
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.5, Python
3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/issue30
Eryk Sun added the comment:
The Popen() docs begin by explaining that it has "os.execvp()-like" behavior in
POSIX and uses CreateProcess() in Windows. Personally, I do not think it's
proper for Python's documentation to discuss details of how CreateProcess()
handles
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.2, Python
3.3, Python 3.4, Python 3.5, Python 3.6
___
Python tracker
<https://bugs.python.org/issue25
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.5
___
Python tracker
<https://bugs.python.org/issue27803>
___
___
Eryk Sun added the comment:
This is a variation on bpo-21822. If join() is called in the main thread, and
it gets interrupted immediately after the lock.acquire(block, timeout) call,
then subsequent calls will hang. In Windows, the acquire() call is not
interruptible with Ctrl+C, so the
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:
I didn't have time to look deeper into this. I'm sorry for not getting back to
you. The rather-large example that you uploaded didn't and doesn't run for me,
so I wasn't able to reproduce the problem.
The one bit of advice I have is t
Eryk Sun added the comment:
In summary, the launcher documentation needs to be extended as follows:
* Include an example of a shebang with a normal Windows path:
#!"C:\Program Files\Python310\python.exe"
Highlight the importance of quoting paths that cont
New submission from Eryk Sun :
Currently os.get_terminal_size() is hard coded to use the process standard
handles in Windows. The function, however, is intended for arbitrary file
descriptors, so should not be limited as follows:
>>> f = open('conout$', 'w')
New submission from Eryk Sun :
In Windows, os.device_encoding() is hard coded to map file descriptor 0 and
descriptors 1 and 2 respectively to the console's input and output code page if
isatty(fd) is true. But isatty() is true for any character device, such as
"NUL". Also an
Change by Eryk Sun :
--
components: +Extension Modules, Library (Lib)
versions: +Python 3.10, Python 3.9 -Python 3.4, Python 3.5, Python 3.6, Python
3.7
___
Python tracker
<https://bugs.python.org/issue14
Change by Eryk Sun :
--
components: +Library (Lib)
type: -> enhancement
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.4, Python 3.5, Python
3.6, Python 3.7
___
Python tracker
<https://bugs.python.org/issu
Eryk Sun added the comment:
The solution for bpo-36779 changed init_timezone() to get tzname directly from
WinAPI GetTimeZoneInformation().
Unfortunately the implementer didn't think to also support time.tzset(), so the
value may be stale with no way to refresh it, or possibly diff
Eryk Sun added the comment:
The presumption I suppose is that these statements only execute if
self.stdout_thread and/or self.stderr_thread completes successfully. I suppose
that the read could fail or get canceled via CancelSynchronousIo(). Of course
in that case you have a bigger problem
Eryk Sun added the comment:
Update since msg243660:
Python 3.8+ now calls setlocale(LC_CTYPE, "") at startup in Windows, as it has
always done in POSIX, so decoding the output of strftime("%Z") with
PyUnicode_DecodeLocaleAndSize() works again since both agree on using
Eryk Sun added the comment:
> decoding the output of strftime("%Z") with PyUnicode_DecodeLocaleAndSize()
> works again since both agree on using the process active code page
At least it works as much as it ever did. It depends on the process active code
page being com
Eryk Sun added the comment:
Update since msg255133:
Python 3.8+ now calls setlocale(LC_CTYPE, "") at startup in Windows, as 3.x has
always done in POSIX. So decoding the output of C strftime("%Z") with
PyUnicode_DecodeLocaleAndSize() 'works' again, since bot
901 - 1000 of 2119 matches
Mail list logo