Eryk Sun added the comment:
> 1) disable _cleanup, _active, and remove _internal_poll() for windows
_active only gets appended to in __del__. We can skip the entire body of
__del__. Also, calling _cleanup can be skipped in __init__.
_internal_poll is required for poll().
2) ignore EB
Eryk Sun added the comment:
> One issue on Linux is that the zombie process keeps the pid used until
> the parent reads the child exit status, and Linux pids are limited to
> 32768 by default.
Windows allocates Process and Thread IDs out of a kernel handle table, which
can grow t
Eryk Sun added the comment:
> The process is not polled to be able to emit the warning in more
> cases, again, to ease debug.
It emits an incorrect warning if the process has already exited: "subprocess %s
is still running". This can be rectified. Here's my current un
Eryk Sun added the comment:
This update breaks long-path support in Windows. It includes the following
unnecessary check, which is using the wrong comparison operator:
if (len >= PY_SSIZE_T_MAX / sizeof(wchar_t))
PyMem_RawMalloc already checks this and returns NULL if s
Eryk Sun added the comment:
getpass() reads from the console via msvcrt.getwch(). This is a raw console
read, so Ctrl+V is read as the SYN (0x16) control character. Only the following
keys are handled specially by getpass:
* Ctrl+C - raise KeyboardInterrupt
* Ctrl+H (backspace) - delete
Eryk Sun added the comment:
> you should go through your current user's apps directory
> (C:\Users\name\AppData\Local\Microsoft\WindowsApps\,
> which contains only symlinks to the actual executables).
"%LocalAppData%\Microsoft\WindowsApps" contains IO_REPARSE_TAG_APP
Eryk Sun added the comment:
> The expected behavior would be to have it point to
> "%LOCALAPPDATA%\Microsoft\WindowsApps\Python37.exe" (or something
> else that's reasonable) since PEP514 requires it to be an actual
> executable.
This appears to be a duplicate
Eryk Sun added the comment:
FYI, this only works when the system is in developer mode. If you want
authenticated users and non-elevated administrators to have symlink rights in
applications that haven't been updated to use this flag, or without enabling
developer mode, grant the rig
Eryk Sun added the comment:
>> If one of the processes in that list is gone, then (...) "The handle
>> is invalid" (...) will prevent you from creating any new processes
>> with Popen after that
>
> It's the first time that I see such bug report.
I
Eryk Sun added the comment:
>> subprocess._active[0]._handle.Close()
>
> Why would you do that? You should not access the private _active list,
> nor access the private _handle attribute. I understand that it's a way
> to trigger such bug, but is it possible to t
Eryk Sun added the comment:
> Without accessing private attributes, I don't see how someone can
> discover the private handle. So for me, it's more a serious bug in an
> application, no? Blindly closing random handles doesn't sound like a
> good idea to me.
Say a
Eryk Sun added the comment:
CanAccessFolder is incomplete for the following reasons:
(1) It doesn't account for SeBackupPrivilege (read and execute access) and
SeRestorePrivilege (write and delete access). If a create or open call requests
backup semantics, these two privileges are ch
Eryk Sun added the comment:
Steve, in what's new and the installer, you've referenced KB2533625 instead of
KB2533623. Do we have to open a new issue for this minor search and replace fix?
--
___
Python tracker
<https://bugs.python.o
Eryk Sun added the comment:
DOS device names are reserved in the final component of DOS drive-letter paths.
"AUX" (plus an optional colon, spaces, or extension) becomes "\\.\AUX", which
is "\??\AUX" in the NT object namespace. By default, "\??\AUX"
Eryk Sun added the comment:
> Perhaps Windows builds can check for reserved file names and give a
> more descriptive error message in the event of IO error?
An operation on a reserved DOS device name can also succeed with unexpected
results. For example, a script may unintentionally wr
Eryk Sun added the comment:
If you want to harden the test for Windows, you could transform TEMPDIR
into an extended path. os.path._getfinalpathname always returns an extended
path. For example:
>>> os.path._getfinalpathname('C:/Temp')
'?\\C:
Change by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> create_unicode_buffer() fails on non-BMP strings on Windows
___
Python tracker
<https://bugs.python
Eryk Sun added the comment:
> if the operation succeeds, no error/message is displayed
Some errors pass silently and may be confusing later on. For example,
CreateDirectoryW calls NtCreateFile with the disposition FILE_CREATE and the
option FILE_DIRECTORY_FILE (i.e. the call *must* creat
Eryk Sun added the comment:
> OSError: [WinError 87] The parameter is incorrect
This error didn't originate from the C dup() call, since that would be based on
errno, like `OSError: [Errno 9] Bad file descriptor`. It must come from
_Py_set_inheritable. The only WINAPI call
Eryk Sun added the comment:
> os.dup() doc says: "On Windows, when duplicating a standard stream
> (0: stdin, 1: stdout, 2: stderr), the new file descriptor is
> inheritable."
That's not necessarily correct. For example, if stdout is a pipe or disk file:
C:\>
New submission from Eryk Sun :
Windows Python includes UNC shares such as "//server/spam" in its definition of
a drive. This is natural because Windows supports setting a UNC path as the
working directory and handles the share component as the working drive when
resolving rooted
Eryk Sun added the comment:
> on Windows (where there is no linkat()) os.link() creates a new link
> to the symbolic link itself.
Yes, CreateHardLinkW opens the source file by calling NtOpenFile with the
option FILE_OPEN_REPARSE_POINT. So the behavior is follow_symlinks=False.
Eryk Sun added the comment:
The behavior of list2cmdline with double quotes is intentional. It supports
passing literal quote characters in the command line for applications that use
VC++ argv parsing, WINAPI CommandLineToArgvW, or in general any application
that adheres to these rules when
Eryk Sun added the comment:
> This is still the case on windows as the pipes created to talk to the
> process might be inherited by two or more simultaneous CreateProcess
> calls.
subprocess already uses PROC_THREAD_ATTRIBUTE_HANDLE_LIST to address this
problem, at least betwee
Eryk Sun added the comment:
The behavior in question is documented as follows: "If a component is an
absolute path, all previous components are thrown away and joining continues
from the absolute path component."
In Windows, this is extended to support drives and the six file-
New submission from Eryk Sun :
OSError and _Py_fstat_noraise rely on winerror_to_errno() in PC/errmap.h in
order to translate a Windows system error code into a POSIX errno value.
PC/errmap.h is supposed to be generated by PC/generrmap.c, which is based on
the old CRT's _dosma
Eryk Sun added the comment:
> It sounds like we should probably revert to the middle ground, and
> skip _raising the error_ if _Py_set_inheritable for files of type
> FILE_TYPE_CHAR.
The problem is just console pseudohandles in Windows 7 and earlier. Maybe it
should just check
Eryk Sun added the comment:
Special casing of Winsock error codes should be handled in winerror_to_errno
rather than in oserror_parse_args, so it's consistently applied everywhere. And
it should use the proper range for Winsock, 1-11999 -- not
1-2147483647. Codes above the Wi
Eryk Sun added the comment:
The CPython interpreter doesn't centrally cache and reuse float objects, and
even if it did that would be an implementation detail, like what it does with
small int objects and strings.
What you're seeing at the module level is a compilation side e
Eryk Sun added the comment:
How about doing something similar for Windows when winerror is set? This is a
common case since many os functions use the Windows API directly. Showing the
symbolic error name will help to disambiguate exceptions, such as
FileNotFoundError (ENOENT) from
Eryk Sun added the comment:
The STANDARD_RIGHTS_* and SPECIFIC_RIGHTS_ALL constants aren't used much in
practice. Do you have a particular case that needs them?
I don't think we have direct use for the standard rights constants in winreg.
For example, deleting a key via winreg.D
Eryk Sun added the comment:
> Perhaps _winapi is the best place? It already includes CreateFile and
> OpenProcess, both of which also use these flags and already have some
> of the "preconstructed" values exposed.
I'd like to see an os.windows namespace, with
Eryk Sun added the comment:
> First it seems the error is being raised incorrectly - winerror 2 is
> for file not found, but it's being passed as errno 2.
I think this only happens with open(). The _io module could use the CRT's
_doserr
Eryk Sun added the comment:
> I think this only happens with open().
Well, and everything else that calls a CRT function and relies on errno, such
as C read() and write(). Though we'd have to look through on a case-by-case
basis to ensure that _doserrno is valid in each case, i
Eryk Sun added the comment:
> Junctions are sometimes used as links (e.g. mklink /j) and sometimes
> as volume mount points (e.g. mountvol.exe).
That people sometimes use junctions as if they're symlinks doesn't mean that we
should pretend it's tru
Eryk Sun added the comment:
> Thanks for the detailed explanation Eryk. While it is a little
> annoying that it comes 2 years after the initial proposed
> solution, I'll happily take that if the end result is a better fix :)
Mea culpa. I am sorry about that. I do respect you
Eryk Sun added the comment:
I wasn't aware that CPython builds for MSYS2 out of the box, since it's a
POSIX-on-Windows platform like Cygwin. Apparently there are patches that enable
it to build, since MSYS2 has Python available.
For Windows, WCSTOK expands to wcstok_s, which takes
Eryk Sun added the comment:
If we see 0x8XXX_, it's either an NTSTATUS [1] warning, which is unlikely,
or and HRESULT [2] error, which is very likely. One of the more common facility
codes for HRESULT is the Windows API, 0x007. If we see 0x8007, then is
a Windows system
Eryk Sun added the comment:
Symlinks are specially interpreted by the file API, I/O manager, and network
redirector. So I think they should remain a separate category. readlink() and
is_link() should be reserved for POSIX symlinks, i.e. only
IO_REPARSE_TAG_SYMLINK.
These app-exec reparse
Eryk Sun added the comment:
> How about adding a separate function such as nt.read_reparse_point()
If we support reading junctions, this should be using the substitute name (with
\??\ replaced by \\?\) instead of the print name. For both symlinks and
junctions, [MS-FSCC] 2.1.2 states t
Eryk Sun added the comment:
We could extend bool with shades of grey that close the 2-bit, signed set over
the complement: {-2, -1, 0, 1}. For example, the bitwise complement of False
could be RealNews (-1, 0x11) and the bitwise complement of True could be
FakeNews (-2, 0x10). The bool
Eryk Sun added the comment:
An exception specifically for ENAMETOOLONG would be limited to Unix systems.
The Windows CRT defines ENAMETOOLONG but doesn't use it. Windows file systems
do not return a specific status code for a filename that's too long. Per MS-FSA
2.1.5.1 [1], a reque
Eryk Sun added the comment:
This is due to computing the PEP 495 fold in the function
datetime_from_timet_and_us in Modules/_datetimemodule.c. It computes the local
time for (timet - max_fold_seconds), which is negative for timestamps less than
max_fold_seconds (86400). It's documented
Changes by Eryk Sun :
--
resolution: out of date -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.or
Eryk Sun added the comment:
Yes, I think this issue should be closed. But for the record I'd like to note a
not uncommon case in which listdir() raise FileNotFoundError on Windows.
According to MS-FSA [1], if a request to open a directory resolves to a file,
the operation should fail
Eryk Sun added the comment:
Issue 27888 switched to using WiX CAQuietExec task to hide the console, but it
also changed the action flags to no longer include
msidbCustomActionTypeNoImpersonate (2048). Without this flag, the installer
impersonates the user for these custom actions: UpdatePip
Eryk Sun added the comment:
You can still create and use virtual environments (virtualenv) without
requiring administrator access.
--
___
Python tracker
<http://bugs.python.org/issue30
Eryk Sun added the comment:
Did you try the example in Python 2? Did you click on the "next" link in the
preceding paragraph? Please read the following:
https://docs.python.org/2/library/stdtypes.html#iterator.next
iterator.next()
Return the next item from the contain
Eryk Sun added the comment:
subprocess.Popen calls CreateProcess on Windows, which searches for an
unqualified executable in the command line as follows:
1. The directory from which the application loaded.
2. The current directory for the parent process. (Starting with
Vista
Eryk Sun added the comment:
cmd.exe implements its own search, like shutil.which, and uses the
CreateProcess lpApplicationName parameter that corresponds to the Popen
executable parameter. But in general (not always) it's better to use
shutil.which because you don't have to worry
Eryk Sun added the comment:
I assume by nt.realpath we're talking about ntpath.realpath. In that case
nothing was done to fix this. It's still an alias for ntpath.abspath, which
calls GetFullPathNameW.
--
nosy: +eryksun
resolution: fixed ->
stage: resolved -> ne
Eryk Sun added the comment:
> interrupt_main is now equivalent to the user having hit control-C.
That's true on a POSIX system with pthread_kill, but not really for a Windows
process that's attached to a console.
A real Ctrl+C executes the registered control handlers fo
Eryk Sun added the comment:
Terry, I assume you ran IDLE via pyw.exe or pythonw.exe, which won't inherit
the console of its parent. You have to use py.exe or python.exe. In this case
you can also use sys.__stdout__.write('spam\n').
If you run via pythonw.exe or pyw.exe from a
Eryk Sun added the comment:
The strong claim that "interrupt_main is now equivalent to the user having hit
control-C" is the reason I suggested broadcasting CTRL_C_EVENT via
GenerateConsoleCtrlEvent. That operation isn't buggy on its own to my
knowledge. There is a glitch due t
Eryk Sun added the comment:
In Windows 10, I have 32-bit 3.6.1 installed for both an administrator and a
standard user, both per-user installations. Maybe the logs from the failed
attempt will help clarify what went wrong. If they still exist in the account's
%temp% folder, please zip th
Eryk Sun added the comment:
This differs slightly from WinAPI PathCchCombineEx, which fails the example
case as an invalid parameter. If the second path is rooted but without a drive
or UNC share, then if the first path is relative it must be at least drive
relative (e.g. "C:dir1"
Eryk Sun added the comment:
The difference compared to PathCchCombineEx stems from the following snippet in
ntpath.join:
if p_path and p_path[0] in seps:
# Second path is absolute
if p_drive or not result_drive:
result_drive
Eryk Sun added the comment:
BTW, I don't see why one would expect join(r"C:\dir1", "D:dir2") to return
r"D:\dir1\dir2" instead of "D:dir2". Python's result is in agreement with
Windows PathCchCombineEx. Paths on different drives should
Eryk Sun added the comment:
subprocess.Popen calls WinAPI CreateProcess, which can execute PE/COFF
executables and .BAT/.CMD batch scripts. It doesn't know anything about .LNK
shell shortcuts. If CreateProcess fails, a Windows shell (e.g. CMD or
PowerShell) tries ShellExecuteEx, which
Eryk Sun added the comment:
That depends on the shortcut. I have some shortcuts that are designed to be run
from the command line (e.g. python.lnk), which take arguments and inherit the
working directory of the parent process. I add .LNK to PATHEXT so I can run
them as commands without a
Eryk Sun added the comment:
The generic abspath implementation could be moved into the genericpath module,
where it will be common to both posixpath and ntpath:
def abspath(path):
"""Return an absolute path."""
path = os.fspath(p
Eryk Sun added the comment:
Terry, the Windows implementation calls GetModuleFileNameW to get the
executable's fully-qualified path from the loader. However, depending on how
Python is started, this could be a \\?\ path, which leads to a bug in the
startup code that determines the prefix
New submission from Eryk Sun:
search_for_prefix in PC/getpathp.c sets the wrong path when Python is started
with a \\?\ path on Windows, which results in the following crash:
>>> subprocess.call(r'"\\?\C:\Program Files\Python36\python.exe"')
Fatal Python er
Eryk Sun added the comment:
The docs [1] are clear that this property must be of the form
major.minor.build. It can include at least one additional field, which the
installer ignores. The major and minor version numbers can be up to 255, and
the build number can be up to 65535. Python
Eryk Sun added the comment:
Python uses the C runtime wmain entry point, which parses the commandline
string into an argument array using documented rules [1]. The quoted string "-m
locust.main -V" is passed as a single argument instead of the expected three
arguments: ["-m
Eryk Sun added the comment:
Comprehensions evaluate the iterator for the outermost loop in the surrounding
scope. The iterators for all inner loops are evaluated in the local scope of
the comprehension itself.
--
nosy: +eryksun
resolution: -> not a bug
stage: -> resolved
Eryk Sun added the comment:
It's consistent with the behavior of generator expressions:
Variables used in the generator expression are evaluated lazily
when the __next__() method is called for the generator object
(in the same fashion as normal generators). However, the
lef
Eryk Sun added the comment:
A WM_SETTINGCHANGE message gets broadcasted to top-level windows, so Explorer
should reload its environment from the registry. Did you start a new command
prompt from Explorer?
--
nosy: +eryksun
___
Python tracker
<h
Changes by Eryk Sun :
--
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue31134>
___
___
Python-bugs-list
Eryk Sun added the comment:
Here are a couple of workarounds for the crash in Windows.
The default stack reservation size is a field in the PE/COFF header, which you
can edit using editbin.exe, e.g.:
editbin /stack:[size_in_bytes] "path\to\python.exe"
The distributed python
Eryk Sun added the comment:
> Is this post wrong then?
No, it's not wrong that semicolon is a valid character in Windows NTFS and
FAT32 filesystems.
However, the answer by Kevin Edwards that recommends using double quotes needs
qualification. It only works in CMD. It doesn
Eryk Sun added the comment:
It's simple to work around using a junction or symbolic link, so is this worth
pursuing?
--
___
Python tracker
<http://bugs.python.org/is
Eryk Sun added the comment:
Junctions are sometimes used as links (e.g. mklink /j) and sometimes as volume
mount points (e.g. mountvol.exe). GetVolumePathName can be called to
distinguish these cases. If a junction is a volume mount point, then its
absolute path and volume path are the same
Changes by Eryk Sun :
--
components: -IO
stage: -> test needed
type: -> behavior
versions: +Python 3.7 -Python 3.3
___
Python tracker
<http://bugs.python.org/i
Changes by Eryk Sun :
--
resolution: -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder: -> Windows: subprocess debug assertion on failure to execute the
process
___
Python tracker
<http://bugs.python
Changes by Eryk Sun :
--
stage: -> needs patch
versions: +Python 3.6, Python 3.7 -Python 3.4, Python 3.5
___
Python tracker
<http://bugs.python.org/issu
Changes by Eryk Sun :
--
versions: +Python 3.5
___
Python tracker
<https://bugs.python.org/issue31427>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eryk Sun added the comment:
The FAQ could instead link to the more recent update, KB3118401.
https://support.microsoft.com/en-us/help/3118401/update-for-universal-c-runtime-in-windows
--
nosy: +eryksun
___
Python tracker
<https://bugs.python.
Eryk Sun added the comment:
I don't see a bug here. The inner run() kills cmd.exe after 4 seconds. But the
waitfor.exe process waits for 200 seconds and has handles for the pipes. The OS
won't close out the pipes as long as there are potential writers, so the outer
communicate()
Eryk Sun added the comment:
> the process terminates, but "communicate" doesn't exit. It doesn't
> say "communicate will hang as long as the pipes are open".
I think the problem with leaked handles does warrant a note. It can be a
difficult problem to
Eryk Sun added the comment:
> Now I can read from the "R" pipes with 0 problems (getting the error
> and output streams)
The pipe handles are inherited by waitfor.exe, just as before. You'll find that
reading to EOF will block just as it does when using subprocess.P
Eryk Sun added the comment:
> I tried with stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
> stderr=subprocess.DEVNULL
As I said previously, you also need to make the current standard handles
non-inheritable. Pending issue 19764, in 3.7 you'll be able to override stdin,
Eryk Sun added the comment:
> when I said "also with close_fds=True", I meant that I tried
> WITHOUT overriding stdin, stdout, and stderr AND setting
> close_fds=True, but it didn't work.
Console applications (e.g. python.exe) duplicate their standard handles into
Eryk Sun added the comment:
Py_CreateSymbolicLinkW can be removed in 3.5+ because Windows XP is no longer
supported and calling enable_symlink() is pointless.
The Windows API uses some privileges simply to determine which security
principals can access a capability. Whether the privilege is
Eryk Sun added the comment:
Path.exists should ignore all OSError exceptions, as os.path.exists does.
Barring that, I suppose for Windows we could add EINVAL to IGNORED_ERROS.
The problem with ValueError was already addressed in issue 33721.
--
components: +Windows
nosy: +eryksun
Eryk Sun added the comment:
The default function result type is c_int, which truncates a 64-bit pointer to
32-bit. The attribute that needs to be set is singular restype, not plural
restypes. Unfortunately ctypes objects have a dict, so you're not catching the
typo in an obviou
Eryk Sun added the comment:
The Windows console has a fixed number of history buffers. In Windows 7 the
default maximum is four history buffers. In this case, if we run a script via
cmd.exe -> py.exe -> python.exe, then only one history buffer remains for a
child process. As you'
Change by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> os.symlink: FileExistsError shows wrong message
___
Python tracker
<https://bugs.python
Change by Eryk Sun :
--
nosy: +eryksun
___
Python tracker
<https://bugs.python.org/issue35374>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eryk Sun added the comment:
Your example uses POINTER(c_double), not c_void_p. There's no problem with an
actual pointer object (i.e. subclass of ctypes._Pointer). The problem is with
simple types (i.e. immediate subclasses of ctypes._SimpleCData), including
simple pointer types
Eryk Sun added the comment:
> This traceback doesn't make sense
Enable the installer options for the debug binaries and symbol files. Ensure
that this installs the *_d.[exe|dll] debug binaries and also the *.pdb symbol
files for the release and debug builds.
Run the debug b
Eryk Sun added the comment:
> I don't see how PyNamespace_New() can call LookupPrivilegeValueA()
For the record, in the 3.7.1 release build, `PyNamespace_New + d4` is in
enable_symlink (Modules/posixmodule.c), which gets called when the nt (aka
posix) module gets initialized.
Eryk Sun added the comment:
For what it's worth, 0x8007 indicates a Windows error, which in this case
is ERROR_INTERNET_SECURITY_CHANNEL_ERROR (12157 or 0x2f7d) [1]: "the
application experienced an internal error loading the SSL libraries".
[1]: https://docs.microsoft.co
Change by Eryk Sun :
--
nosy: +eryksun
stage: -> needs patch
versions: +Python 3.8
___
Python tracker
<https://bugs.python.org/issue29707>
___
___
Python-
Eryk Sun added the comment:
It's also inconsistent. ismount() is true for a bind mount to the parent
directory (e.g. dir/mount -> dir).
--
___
Python tracker
<https://bugs.python.org
Change by Eryk Sun :
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue29707>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eryk Sun added the comment:
> what is the problem with getting False for bind mounts
> on the same filesystem?
Probably there's no problem if it's consistently false for all bind mounts on
the same file system, but ismount() is true for a bind mount to the parent
directory
Eryk Sun added the comment:
pyreadline is a third-party package. Refer to issue 55 at its GitHub repo:
https://github.com/pyreadline/pyreadline/issues/55
--
nosy: +eryksun
resolution: -> third party
stage: -> resolved
status: open -&g
Change by Eryk Sun :
--
nosy: +serhiy.storchaka
stage: patch review -> test needed
type: -> crash
___
Python tracker
<https://bugs.python.org/i
Eryk Sun added the comment:
> I am not sure about the difference in semantics between powershell and
> command prompt with respect to quoting since
CMD only uses single quotes in `for /f` loops, in which it's either a command
or a literal string (w/ the "usebackq" o
1201 - 1300 of 2119 matches
Mail list logo