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:
> 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:
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:
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:
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:
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:
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:
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
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg411287
___
Python tracker
<https://bugs.python.org/issue46454>
___
___
Python-bugs-list mailin
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg411776
___
Python tracker
<https://bugs.python.org/issue46454>
___
___
Python-bugs-list mailin
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
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:
> 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:
> 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:
> 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:
> 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:
> 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
Change by Eryk Sun :
--
dependencies: +[Windows] wrap CreateFile to support follow_symlinks
___
Python tracker
<https://bugs.python.org/issue46490>
___
___
Pytho
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
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
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:
> 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
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:
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 :
--
Removed message: https://bugs.python.org/msg410068
___
Python tracker
<https://bugs.python.org/issue46287>
___
___
Python-bugs-list mailin
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
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:
> 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:
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:
> _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
Change by Eryk Sun :
--
type: behavior -> crash
___
Python tracker
<https://bugs.python.org/issue46297>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, tim.golden, zach.ware
type: crash -> behavior
___
Python tracker
<https://bugs.python.org/issu
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
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:
> 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:
"_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:
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:
> 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:
> 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:
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:
> 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:
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'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:
> 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:
> 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:
> 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:
> 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:
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:
> 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:
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:
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:
> 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:
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:
> 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:
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:
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:
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:
> 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 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
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, 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 :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> missing return in win32_kill?
___
Python tracker
<https://bugs.python
Change by Eryk Sun :
--
resolution: -> rejected
stage: needs patch -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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 :
--
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 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
Eryk Sun added the comment:
The _ctypes extension module could have a dict that maps each format code to
its (size, alignment), based on `formattable`. Then direct size comparisons
wouldn't be limited to types defined by the struct module, and it wouldn't be
necessary to create c_
Change by Eryk Sun :
--
type: -> behavior
___
Python tracker
<https://bugs.python.org/issue23104>
___
___
Python-bugs-list mailing list
Unsubscrib
Eryk Sun added the comment:
Victor's comment wasn't relevant. objid() stays referenced during the call.
Anyway, I just built testlib.c and verified that this ctypes example works
correctly in both 64-bit 3.4.4 and 3.10, so the issue is out of date.
--
nosy: +eryksun
Change by Eryk Sun :
Added file: https://bugs.python.org/file50484/deactivate.bat
___
Python tracker
<https://bugs.python.org/issue44540>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
There's no parsing problem with delayed expansion (e.g. "!VAR!" instead of
%VAR%) and for loop variables (e.g. "%%a"). The solution is thus to execute in
a local scope that enables delayed expansion and command extensions [1].
Tha
Eryk Sun added the comment:
Ingrid's patch misses the requirement to log off after adding a privilege to
the current account. A new access token is required, from a fresh logon.
Privileges can also be added to groups, not just to individual user accounts.
Thus the symlink privilege c
Eryk Sun added the comment:
You can use "#!python", or "#!/usr/bin/python", or "#!/usr/local/bin/python".
They're all equivalent, and they do not search PATH. Since no wanted version is
specified, the launcher will look for a version to run in the
Eryk Sun added the comment:
PyOS_Readline() calls PyOS_StdioReadline() if sys_stdin or sys_stdout isn't a
tty file. This function always writes the prompt to stderr, as follows:
if (prompt) {
fprintf(stderr, "%s", prompt);
}
fflush(stderr);
Maybe t
Change by Eryk Sun :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> behavior
___
Python tracker
<https://bugs.python
Eryk Sun added the comment:
Whether it should be this way or not, here's how it currently works.
The builtin virtual paths all end with "python":
static SHEBANG builtin_virtual_paths [] = {
{ L"/usr/bin/env python", TRUE },
{ L"/usr/bin/pyth
Eryk Sun added the comment:
The os module tries to avoid documenting low-level OS behaviors. It would be
unreliable and difficult to maintain.
In the case of os.replace(), in Windows it calls MoveFileExW() with the flag
MOVEFILE_REPLACE_EXISTING [1]. The source and destination paths must
Eryk Sun added the comment:
This appears to be misreported. The implementation in 3.1.2rc1 looks correct to
me [1]. Either way, it's out of date.
That said, the emulation of a simple type in an aggregate type is still
incomplete nowadays. It's not implemented when a c_char or c_w
Eryk Sun added the comment:
The shebang "#!/usr/bin/env python" searches PATH for
"python" plus the PATHEXT file extensions.
The shebang "#!/usr/bin/env python3" uses the highest version of Python 3 from
the registry. It doesn't search PATH because Pytho
Eryk Sun added the comment:
Windows opens the working directory without delete sharing, so trying to delete
it fails with a PermissionError for ERROR_SHARING_VIOLATION (winerror 32).
I discussed a modified version of the _rmtree() method in msg377358. The
proposed version would try to reset
Change by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue44735>
___
Change by Eryk Sun :
--
stage: -> needs patch
versions: +Python 3.10, Python 3.11
___
Python tracker
<https://bugs.python.org/issue44540>
___
___
Python-
Change by Eryk Sun :
--
versions: +Python 3.10, Python 3.11 -Python 3.7
___
Python tracker
<https://bugs.python.org/issue40467>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
> it might be nice if it's possible to give some sort of useful
> warning/error when this happens -- perhaps say that specifying
> both shell=True and executable="..." isn't supported on Windows?
The `shell` parameter is documented as
Eryk Sun added the comment:
> not quite clear to me it this only applies on Windows or is general.
macOS defaults to the spawn method (bpo-33725).
--
___
Python tracker
<https://bugs.python.org/issu
Eryk Sun added the comment:
This was fixed in 3.5.
--
nosy: +eryksun
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Fix shutil.get_terminal_size() to catch AttributeError
___
Python tra
Eryk Sun added the comment:
> make it returning False without invoking a system call if the file
> size is non-zero it will eliminate the need to expose _size.
I suggest using the file type instead of the size. There's no reason to call
isatty() if it's not an S_IFCHR file.
Eryk Sun added the comment:
mmap no longer allows resizing if the object has buffer exports. For example:
>>> m = mmap.mmap(-1, 4096, access=mmap.ACCESS_WRITE)
>>> p = (ctypes.c_char * 4096).from_buffer(m)
>>> m.resize(8192)
Traceback (most re
Eryk Sun added the comment:
test.py is a UTF-8 file, which is the default source encoding in Python 3. It
fails as expected if the test script is encoded differently, such as Latin-1,
unless the source encoding is declared.
--
nosy: +eryksun
resolution: -> out of date
st
Eryk Sun added the comment:
I've created bpo-45919 with a suggested enhancement to use GetFileType() in
Windows, since the Windows C runtime does not provide fcntl().
--
___
Python tracker
<https://bugs.python.org/is
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg407216
___
Python tracker
<https://bugs.python.org/issue45915>
___
___
Python-bugs-list mailin
New submission from Eryk Sun :
During startup, is_valid_fd() in Python/pylifecycle.c is called to validate
stdin, stdout, and stderr. Performance isn't critical here, but every bit helps
in reducing startup time. In my tests, implementing this check in Windows via
GetFileType((H
Eryk Sun added the comment:
In Windows, GetFileType((HANDLE)_get_osfhandle(fd)) is several times faster
than close(dup(fd)). For example:
#if defined(MS_WINDOWS)
int type;
_Py_BEGIN_SUPPRESS_IPH
type = GetFileType((HANDLE)_get_osfhandle(fd));
_Py_END_SUPPRESS_IPH
return
Eryk Sun added the comment:
> AttributeError: Can't get attribute 'f'
> on
The Windows API only supports the spawn method of process creation. In POSIX
(except macOS), the default is the fork method, for which the child inherits
the interactive main module of the par
Eryk Sun added the comment:
> What does "the builtin readline support" refer to here?
> Presumably not GNU Readline?
That's referring to the readline(ish) support that's built into the console
host for ReadFile() and ReadConsole() calls when the input stream is
Eryk Sun added the comment:
> AFAIK the reason command history works in cmd.py on Windows is
> that it's built into the terminal program. Or maybe into the
> operating system.
As mentioned in msg406800, input editing, history (e.g. up/down arrows, F7
popup, F8 completion), and
Eryk Sun added the comment:
> You can take the view that it's not a bug (with some justification),
> but a few lines in the cmd docs would make all the difference in
> terms of wasted time.
If anything, I think the readline documentation should have a note explaining
th
Eryk Sun added the comment:
> and b / a gives me WindowsPath('/a/b'). So I'm like "ok, a seems
> like absolute, I will test for that" but on Windows a.is_absolute()
> is False.
Path.is_absolute() is true if a path has a `root` and, for a Windows path, also
New submission from Eryk Sun :
The file association for the store app uses '"%1"' for the command-line
parameters. This ignores the rest of the command-line arguments, i.e. '%*'. In
PC/layout/support/appxmanifest.py, the add_application() calls that
Eryk Sun added the comment:
> The Windows cmd implementation clearly uses readline or
> some compatible lib under the hood
The REPL shell and input() call PyOS_Readline(). If this call isn't hooked
(e.g. by the readline module), and stdin is a console file, then it reads a
li
101 - 200 of 2115 matches
Mail list logo