Eryk Sun added the comment:
The Windows implementation of symlink_or_copy() actually copies "python.exe"
and "pythonw.exe" launchers from "Lib/venv/scripts/nt". One cannot simply copy
the "python3.exe" executable because the required DLLs aren't
Change by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.11 -Python 3.8
___
Python tracker
<https://bugs.python.org/issue43
Eryk Sun added the comment:
The code to copy a file could be rewritten to use a regex match. For example:
# Copy src to dst. If src is a base executable, copy a launcher.
dirname, filename = os.path.split(src)
m = re.match(r'(pythonw?)[0-9._]*(
Change by Eryk Sun :
--
resolution: -> rejected
stage: needs patch -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> missing return in win32_kill?
___
Python tracker
<https://bugs.python
Eryk Sun added the comment:
The details of os.kill() on Windows have been discussed extensively for years
in various issues such as bpo-26350, bp-23948, and bp42962. But the problem of
the missing return statement is always overwhelmed by discussion of the
egregiously bad design of this
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg408336
___
Python tracker
<https://bugs.python.org/issue14484>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
The details of os.kill() on Windows have been discussed extensively for years
in various issues such as bpo-26350, bpo-23948, and bpo-42962. But the problem
of the missing return statement is always overwhelmed by discussion of the
egregiously bad design of this
Eryk Sun added the comment:
> Raising a SpecialFileError would be OK if `follow_symlinks` was False.
I expect it to fail if follow_symlinks is True, which is the default value. I
expect it to succeed with follow_symlinks=False, which should create a shallow
copy of just the syml
Eryk Sun added the comment:
The alternate keyboard shortcuts for the clipboard work fine with a Russian
keyboard layout:
copy: Ctrl+Insert
cut: Shift+Delete
paste: Shift+Insert
Some programs also support Alt+Backspace for undo (Ctrl+Z). Watch out with
Shift+Delete in GUI shells
Eryk Sun added the comment:
I think the following wiki article still applies even though it was first
discussed in 2003: "KeySyms on platforms other than X11" [1]. In particular, it
states the following:
On Windows and MacOS X Tk only supports keysyms correctly for a
limi
Eryk Sun added the comment:
Try using symlinks if you're allowed, e.g. `python -m venv --symlinks `.
Note that a virtual environment created with symlinks is unreliable in some
cases because ShellExecute[Ex]W() eagerly resolves a symlink before calling
CreateProcessW().
Also, you won
Eryk Sun added the comment:
> symlinks do not work for me
Sorry, I forgot that you're using the store app. The store app has to use the
copied venv launchers.
When a store app is run from the command line, the system executes an appexec
link from "%LocalAppData%\Microsof
Eryk Sun added the comment:
PR 29821 adds __APPLE__ to the platforms that use fcntl(fd, F_GETFD). Is this
okay on macOS, given bpo-30225? Apparently fstat() fails if the other end of a
pipe is closed.
--
___
Python tracker
<ht
Eryk Sun added the comment:
> Python 3.9.6 scan_dir returns filenotfound on long paths,
> but os_walk does not.
This would be surprising. os.walk() has been implemented via os.scandir() since
Python 3.5. Do you have a concrete example of the directory structure to test?
> I see
Eryk Sun added the comment:
It works as expected for me:
>>> len(p)
261
>>> print(p)
C:\Temp\Jim\Documents\jschw_uiowtv3_old\AppData\Local\Google\Chrome\User
Data\Default\Extensions\nenlahapcbofgnanklpelkaejcehkggg\0.1.823.675_0\notifications\pages\C
Eryk Sun added the comment:
If I had long paths enabled, then next(os.walk(p, onerror=print)) would not
have printed the error that I showed in the example and would not have
immediately raised StopIteration. Instead it would have returned a (dirpath,
dirnames, filenames) result for
Eryk Sun added the comment:
> but errors in DirEntry.is_dir() and DirEntry.is_symlink()
> are always ignored
In Windows, is_symlink() won't fail due to a long path, since that information
comes from the directory listing, but is_dir() might fail for a long path if
it'
Eryk Sun added the comment:
The rare circumstance in which UTF-8 mode gets enabled automatically is
described in the following paragraph [1]:
If the PYTHONUTF8 environment variable is not set at all, then the
interpreter defaults to using the current locale settings, unless the
Eryk Sun added the comment:
> Buffering is necessary for implementing the universal_newlines
Why is that? I can see that it requires newline state tracking, and the
allowance to make two read(fd, &c, 1) system calls for a single read(1) method
call, in case a "\n"
Eryk Sun added the comment:
> If exec gets two separate objects as globals and locals,
> the code will be executed as if it were embedded in a
> class definition.
That's a misleading comparison because a class definition intentionally
supports nonlocal closures, which
Eryk Sun added the comment:
> That's taken straight out of the documentation.
Yes, but it's still a misleading comparison.
> Until I understood that exec with two different mapping objects as
> globals and locals behaves as if the code where embedded inside a
> class
Eryk Sun added the comment:
> You seem to be arguing that a description in the docs is "misleading",
> not because it misleads, but because it don't describe a situation
> which has nothing to do with the situation that the docs are describing.
To me it's mislea
Eryk Sun added the comment:
There's no point to making the user worry about short names, symlinks, or
non-canonical mount points in the filesystem path of a virtual environment.
It's still accessible where the user expects to find it. The problem for
bpo-45337 is filesystem redi
Eryk Sun added the comment:
There's still the problem of the system using short names in %TEMP%, since by
default that's under "%USERPROFILE%\AppData". Either an exception could be made
for the temp directory, since it's never redirected (AFAIK), or su
Eryk Sun added the comment:
> There are plenty of other ways to get a venv through a potentially
> unexpected path (turns out I've been doing one for years)
Examples would be appreciated because I'm drawing a blank here. A junction or
directory symlink in the parent pat
Eryk Sun added the comment:
Every time open(r"test.txt", "w") is called, the existing "test.txt" file gets
overwritten in the filesystem as an empty file. For each iteration,
setdefault() returns a reference to the first file object, which advances its
f
Eryk Sun added the comment:
> My VHDX mounted in a directory is affected by this
I created a VHDX and mounted it in a directory. It's just a regular volume
mount point with a junction (IO_REPARSE_TAG_MOUNT_POINT). That won't cause any
problems, so I guess your setup must be
Eryk Sun added the comment:
> On Windows the extension of "python.exe" is "exe", not ".exe".
FWIW, a file extension in Windows includes the dot. Trailing dots are stripped
from filenames, so a file can't be named "python." because it's
Eryk Sun added the comment:
With just PATHCCH_ALLOW_LONG_PATHS, PathCchCombineEx() returns a long path as a
normal path (i.e. not a \\?\ extended path) if long-path support is enabled for
the current process. Otherwise, if long-path support isn't enabled or
available, as is always the
Eryk Sun added the comment:
"_frida.cp310-win_amd64.pyd" is a bad build or corrupted file. It imports a
procedure with no name from a DLL with no name, which causes the loader to
search for a file named ".DLL". Even if that were found, it imports another
procedure wit
Eryk Sun added the comment:
> ImportError: DLL load failed while importing _socket: El parámetro no es
> correcto.
I'm not familiar with the implementation of PyInstaller, which is a third-party
tool. The above invalid-parameter error may be indirectly related to the
problem wit
Eryk Sun added the comment:
> Did anyone reproduce on python3.X?
In principle, winreg should not have a problem in 3.x because it only uses the
UTF-16 wide-character API.
--
nosy: +eryksun
stage: -> resolved
status: pending -> closed
_
Eryk Sun added the comment:
Terry, it's just a simple bug that slipped by. The PATHCCH_OPTIONS enum in the
SDK header "PathCch.h" unconditionally defines all of the options. So there's
no compiler error when building with a newer version of the SDK, even though we
de
Change by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, tim.golden, zach.ware
type: crash -> behavior
___
Python tracker
<https://bugs.python.org/issu
Change by Eryk Sun :
--
type: behavior -> crash
___
Python tracker
<https://bugs.python.org/issue46297>
___
___
Python-bugs-list mailing list
Unsubscrib
Eryk Sun added the comment:
> _Py_abspath/_getfullpathname does not always call GetFullPathNameW on 3.11.
Also, PathCchSkipRoot() doesn't recognize forward slash as a path separator, so
_Py_isabs() is wrong in many cases compared to the same path that uses
backslash as the path s
Eryk Sun added the comment:
Were you upgrading an existing installation of Python 3.10? Did it actually
install in "C:\Program Files\Python310"? Is Python currently installed in
per-user "%LocalAppData%\Programs\Python\Python310"? Was it ever installed
there?
-
Eryk Sun added the comment:
> Do you know other projects which dump the full help into stdout
> when asking for the "full help"?
`ps --help` lists sections "". The "--help
all" output is all sections, but truly all help is only available via `man ps`.
Eryk Sun added the comment:
Ned, the CLI of venv has a `--clear` option, which invokes EnvBuilder [1] with
clear=True. It's implemented by EnvBuilder.clear_directory(). Ali wants this
method to prompt for confirmation before deleting the directory contents and
also proposes the additi
Eryk Sun added the comment:
The implementation of `--clear` in virtualenv apparently was changed to align
with venv. On the linked virtualenv issue, Bernát Gábor suggested creating a
bpo issue for venv to determine how the issue should be resolved for virtualenv.
--
nosy
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg410068
___
Python tracker
<https://bugs.python.org/issue46287>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
PR 30142 is sufficient for Unix, but it's missing a bit for Windows.
In Windows, the C runtime library maps the console event for Ctrl+Break to
SIGBREAK. The default handler for SIGBREAK exits with 0xC13A (i.e.
STATUS_CONTROL_C_EXIT). This value is unre
Change by Eryk Sun :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue45554>
___
___
Python-bugs-
Eryk Sun added the comment:
> If some one closes fd 0, then he reopens it. it will not be inherited.
In Windows, when a console process spawns a child console process without
enabling handle inheritance -- e.g. subprocess.Popen(['python.exe']) -- the OS
will manually duplicate
Eryk Sun added the comment:
The Windows API doesn't directly support opening a 'symlink' as Python defines
it for the follow_symlinks parameter. That problem should be resolved in a
separate issue. Then updating os.utime() would be relatively trivial.
--
components
Eryk Sun added the comment:
> It's *very* unlikely you'll ever get output that doesn't fit into MBCS,
When writing to a pipe, wmic.exe hard codes using the process OEM code page
(i.e. CP_OEMCP). If it matters, running wmic.exe with subprocess should use
encoding='oe
New submission from Eryk Sun :
Issue 46490 proposes to support follow_symlinks in os.utime() on Windows.
Instead of duplicating the os.stat() implementation of follow_symlinks, I
suggest factoring out a common _Py_CreateFile() function with two additional
parameters: traverse (input) and
Change by Eryk Sun :
--
dependencies: +[Windows] wrap CreateFile to support follow_symlinks
___
Python tracker
<https://bugs.python.org/issue46490>
___
___
Pytho
Eryk Sun added the comment:
> Bit wmic seems nice solution.
> Is still working for windows lower than 11?
wmic.exe is still included in Windows 10 and 11, but it's officially deprecated
[1], which means it's no longer being actively developed, and it might be
removed in
Eryk Sun added the comment:
> sys.getwindowsversion() which exposes GetVersionEx() looks fine to me.
In Windows 8+, sys.getwindowsversion() returns a version that can vary from
6.2.9200 (Windows 8) up to the actual OS version. It depends on the OS versions
supported by the applicat
Eryk Sun added the comment:
> AFAIK, the Win32_OperatingSystem caption is always ASCII.
I think I was wrong here. The "Caption" field is localized, so the wmic.exe OEM
encoded output to a pipe isn't reliable. The system OEM code page doesn't
necessarily match the dis
Eryk Sun added the comment:
> stdin is closed
> os.open() is called and creates a new fd=0
> a call to os.dup2(fd, 0) is made but is a noop
The dup2() silent noop case is a problem, but not the problem that's reported
in msg43.
The two examples for this issue are fd.py
Eryk Sun added the comment:
> switch to the newer CreateFile2() function
Apparently we need to allow FILE_SHARE_READ if CreateFile2() is used to
implement os.stat(). It's not a big deal, but this is a design flaw.
CreateFile2() always uses the kernel I/O flag FILE_DISALLOW_EXCL
Eryk Sun added the comment:
Here's an implementation of _Py_CreateFile2() and win32_xstat_impl():
typedef struct {
DWORD type;
DWORD attributes;
DWORD reparseTag;
} _PY_CREATE_FILE_INFO;
static HANDLE
_Py_CreateFile2(LPCWSTR lpFileName,
DWORD dwDesiredA
Eryk Sun added the comment:
Please read about augmented assignment [1]. In the REPL, use help("+=").
An augmented assignment evaluates the target (which, unlike normal
assignment statements, cannot be an unpacking) and the expression
list, performs the binary operation s
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg411776
___
Python tracker
<https://bugs.python.org/issue46454>
___
___
Python-bugs-list mailin
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg411287
___
Python tracker
<https://bugs.python.org/issue46454>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
If the target object of an augmented assignment doesn't support the in-place
binary operation, the normal binary operation is used instead. Thus an
augmented assignment is implemented to always assign the result back to the
target. For an attribute, t
Eryk Sun added the comment:
Please read "Identifiers and keywords" [1] in the documentation. For example:
>>> import unicodedata as ud
>>> ud.normalize('NFKC', '𝖇𝖆𝖗') == 'bar'
True
>>> c = '\N{CYRILLIC
Eryk Sun added the comment:
In Windows, paths that are relative to the current directory on a drive aren't
resolved. The following should be resolved by the current code:
>>> os.chdir('C:/Temp')
>>> pathlib.Path('C:').absolute()
Windows
Eryk Sun added the comment:
This is just a point of clarification.
> my del did not change the environment variable
os.environ defines the __delitem__ method to call C unsetenv(). Thus `del
os.environ[varname]` does unset the environment variable, at least at the level
of the C runt
Eryk Sun added the comment:
PR 29396 and PR 29501 didn't get backported to 3.8 in November. Probably that
was intentional since 3.8 only gets security fixes since 3.8.10, which was
released in May. Supporting a newer build environment isn't a security issue. A
core developer cou
Eryk Sun added the comment:
Alternatively, one can cast the address to py_object and dereference its
`value`. For example:
>>> obj = bytearray(b'spam')
>>> sys.getrefcount(obj)
2
>>> obj2 = ctypes.cast(id(obj), ctypes.py_objec
Eryk Sun added the comment:
> cmd310 = ["/LIBPATH:D:\\python310\\lib\\site-packages\\torch\\lib",
The `argv` parameter of os.spawnv() should begin with a command name to ensure
that the application parses its command-line correctly. This doesn't
necessarily have to be a f
Eryk Sun added the comment:
Why was it decided to not raise a syntax error when the NFKC normalization of a
non-ASCII token matches a keyword? I don't see a use for cases such as `𝕚𝕗 = 1`
and `𝕚𝕗 + 1`. It seems the cost in terms of confusion far outweighs any
potential be
Eryk Sun added the comment:
> I'm not seeing what's wrong with your example.
"C:" or "C:spam\\eggs" are not absolute paths. They depend on the effective
working directory on the drive. An absolute path should never depend on a
working directory, wh
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg412220
___
Python tracker
<https://bugs.python.org/issue29688>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
> I'm not seeing what's wrong with your example.
"C:" or "C:spam\\eggs" are not absolute paths. They depend on the effective
working directory on the drive. An absolute path should never depend on a
working directory, wh
Eryk Sun added the comment:
> I'd imagine that bug is reproducible with `Path('C:\\Temp', 'C:')`
> already, right? If that's the case, should it logged as a
> separate issue?
Yes, it's a separate issue that affects the _from_parts() call in ab
Eryk Sun added the comment:
Check your settings in the registry.
In "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts" there
should be a ".py" key, but not necessarily. It should have an "OpenWithList"
subkey that contains an "MRUList&qu
Eryk Sun added the comment:
> the Open With entries may not be being merged.
That would probably be a bug in the Windows shell API. The HKCU and HKLM
subkeys of "Software\Classes\Python.File\Shell\editwithidle\shell" are merged
in the HKCR view. The same key path can exist
Eryk Sun added the comment:
In case you missed it, I implemented _Py_CreateFile2() in bpo-46506 and rewrote
os.stat() based on it. Check it out in case you're interested in moving forward
with a PR in bpo-46506.
For this issue, follow_symlinks is fairly simple to support
New submission from Eryk Sun :
getpass.getuser() checks the environment variables LOGNAME (login name), USER,
LNAME, and USERNAME, in that order. In Windows, LOGNAME, USER, and LNAME have
no conventional usage. I think there should be a strict mode that restricts
getuser() to check only
Eryk Sun added the comment:
Here's an example for the suggested changes to _winapi.
Include these headers:
#include // LsaGetLogonSessionData
#include // STATUS_SUCCESS
Add these argument-clinic macros to _winapi_functions:
_WINAPI_GETCURRENTPROCESSTOKEN_METH
Eryk Sun added the comment:
Builtin open() calls C open(). This C function supports whatever path types are
supported natively. In Windows, C open() calls WinAPI CreateFileW(), which does
not support "file://" URIs. The Windows API handles it as a relative path,
which gets resolv
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg412604
___
Python tracker
<https://bugs.python.org/issue46654>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
In FileHandler.file_open(), req.host is the host name, which is either None or
an empty string for a local drive path such as, respectively,
"file:/Z:/test.py" or "file:///Z:/test.py". The value of req.selector never
starts with "//"
Eryk Sun added the comment:
> file://server/host/file.ext on windows, even though
> file:server/host/file.ext open just fine.
For r"\\host\share\test.py", the two slash conversion
"file://host/share/test.py" is correct according to RFC80889 "E.3.1. UR
Eryk Sun added the comment:
> The value of req.selector never starts with "//", for which file_open()
> checks, but rather a single slash, such as "/Z:/test.py" or
> "/share/test.py".
To correct myself, actually req.selector will start with &qu
Change by Eryk Sun :
--
assignee: docs@python ->
components: -2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, C API,
Cross-Build, Demos and Tools, Distutils, Documentation, Extension Modules,
FreeBSD, IDLE, IO, Installation, Interpreter Core, Parser, Regular Expressi
Eryk Sun added the comment:
> The Python 3.6 and 3.7 "codecs.register(_alias_mbcs)" doesn't work
> because "search_function()" is tested before and it works for "cpXXX"
> encodings.
Isn't the 3.6-3.10 ordering of search_function() and _
Eryk Sun added the comment:
> I don't think that this fallback is needed anymore. Which Windows
> code page can be used as ANSI code page which is not already
> implemented as a Python codec?
Python has full coverage of the ANSI and OEM code pages in the standard Windows
Eryk Sun added the comment:
> getdefaultlocale() falls back to LANG and LANGUAGE.
_Py_SetLocaleFromEnv(LC_CTYPE) (e.g. setlocale(LC_CTYPE, "")) gets called at
startup, except for the isolated configuration [1].
I think calendar.Locale*Calendar should try the LC_CTYPE locale if L
Eryk Sun added the comment:
> Oh. Serhiy asked me to use LC_TIME rather than LC_CTYPE.
Since Locale*Calendar is documented as not being thread safe, __init__() could
get the real default via setlocale(LC_TIME, "") when locale=None and the
current LC_TIME is "C". Resto
Eryk Sun added the comment:
run_child() expects `cmdline` to be correctly quoted, and normally it is.
I can't reproduce this problem with Python 3.10.2. I created a user account
with a space in the account name, logged on, and installed 3.10.2 for the
current user, with the option en
Eryk Sun added the comment:
I checked the source code in PC/launcher.c process(). It turns out that
`executable` is not getting quoted in the venv launcher case.
CreateProcessW() tries to get around this. If the command isn't quoted, it has
a loop that consumes up to a space (or tab
Eryk Sun added the comment:
The venv launcher can quote the executable path either always or only when it
contains spaces. The following is a suggestion for implementing the latter.
Before allocating `executable`, use memchr() (include ) to search the
UTF-8 source for a space. If found
Change by Eryk Sun :
--
stage: -> patch review
versions: -Python 3.7, Python 3.8
___
Python tracker
<https://bugs.python.org/issue46697>
___
___
Python-
Eryk Sun added the comment:
> True == False == False is really True == False and False == False
> wich is False and True which is False
Moreover, since the left-hand comparison is `True == False`, which evaluates to
False, the right-hand comparison doesn't even get evaluate
Eryk Sun added the comment:
> test_call_timeout() or test_timeout() in test_subprocess.py.
These tests don't override the standard files, and they only spawn a single
child with no descendants. I don't see why this would hang. It shouldn't be a
problem with leaked pip
Eryk Sun added the comment:
> The race on := is much smaller than the original race
> and I suspect in practice will be very hard to hit.
In Windows, the acquire() method of a lock can't be interrupted. Thus, in the
main thread, an exception from Ctrl+C gets raised as soon
Eryk Sun added the comment:
> If the acquire() in fact times out, but the store to the `acquired`
> variable is interrupted, `if _WINDOWS and acquired is None` will
> succeed, despite that the lock is still locked
Yeah, my proposed workaround is no good, so we can't resolve
Eryk Sun added the comment:
> Wrap everything needed in a custom C function.
Maybe add an `acquire_and_release()` method:
static PyObject *
lock_PyThread_acquire_and_release_lock(
lockobject *self, PyObject *args, PyObject *kwds)
{
_PyTime_t time
Eryk Sun added the comment:
> the fix should be as simple as coercing the timeout values to >= 0.
Popen._remaining_time() should return max(endtime - _time(), 0).
Popen._wait() should raise OverflowError if the timeout is too large for the
implementation. In Windows, the upper li
Eryk Sun added the comment:
> is there a bulletproof way to guarantee that `self._stop()` gets
> called if the acquire_and_release() succeeds?
I don't think it's critical. But we still should deal with the common case in
Windows in which a KeyboardInterrupt is raised immed
Eryk Sun added the comment:
> Anything at the Python level that cares whether the thread is
> still alive will call _wait_for_tstate_lock() again
It's nice that _maintain_shutdown_locks() gets called in _stop(), but the more
important call site is in _set_tstate_lock().
I t
Eryk Sun added the comment:
> I didn't have that in mind at all.
I understood what you had in mind, and I don't disagree. I was just
highlighting that the only somewhat important work done in _stop() is to clean
up the _shutdown_locks set, to keep it from growing too large. But
Eryk Sun added the comment:
> I fear the potential 3rd-party breakage alone should bump
> this to its own issue.
The change to the DWORD converter in _winapi should only be in 3.11+. If this
causes problems for other projects, they're probably depending on undefined
behavior in t
Eryk Sun added the comment:
> 4) use Job objects to group Windows processes for termination
I think a separate issue should be created for this enhancement.
_winapi wrappers would be needed for CreateJobObjectW(),
SetInformationJobObject(), AssignProcessToJobObject(), TerminatejobObj
1 - 100 of 2115 matches
Mail list logo