Eryk Sun added the comment:
There is something fundamentally wrong with the way modules built into the
interpreter DLL (python3x.dll) are loaded if anything in sys.path or the system
PATH can cause an import to fail.
--
___
Python tracker
<ht
Eryk Sun added the comment:
The user site packages directory is architecture specific starting with 3.10,
e.g. "%AppData%\Python\Python310-32\site-packages". The PYTHONPATH environment
variable is shared by all versions.
However, I don't understand how the binascii mo
Eryk Sun added the comment:
You're mistaken about what `fd` is. It's a TextIOWrapper, which wraps a
BufferedWriter, which buffers a FileIO raw file object, which accesses the open
file number fd.fileno(). For example:
>>> f = open('tmp.tmp','w')
Eryk Sun added the comment:
> This is Windows (shell) behaviour. To avoid this, you need to
> add the .py extension to the PATHEXT environment variable.
PowerShell reuses the current console session only if .PY is set in PATHEXT.
Otherwise Python gets executed with a flag that tel
Eryk Sun added the comment:
> Hmm..., I get it, but Im not gonna lie it's pretty confusing given
> that in other places `//` works as a substitute for `/`. Maybe it
> should be mentioned in the documentation?
In Linux, the system resolves "//" as just "/"
Eryk Sun added the comment:
> Now a file that doesn't exist:
> >>> mike = Path("palin.jpg")
> >>> mike.resolve()
> WindowsPath('palin.jpg')
This is a bug in resolve(). It was fixed in 3.10+ by switching to
ntpath.realpath(). I don'
Eryk Sun added the comment:
The error code for `1e+300 ** 2` is ERANGE, from calling libm pow(). Since
pow() returns a double, there's no way to indicate an error in the return
value. Instead, C errno is set to 0 beforehand and checked for a non-zero error
value after the call. If the
Eryk Sun added the comment:
> I've got in mind a PyListObject subclass with calls to PyOS_FSPath
> before insert, append, extend and __getitem__.
The sys module doesn't prevent rebinding sys.path. Most code I think is careful
to update sys.path. But surely some code replac
Change by Eryk Sun :
--
nosy: -eryksun
___
Python tracker
<https://bugs.python.org/issue47086>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eryk Sun added the comment:
Do you have any thoughts about distributing the docs in ePub format?
--
nosy: +eryksun
___
Python tracker
<https://bugs.python.org/issue47
Change by Eryk Sun :
Removed file: https://bugs.python.org/file50695/loadtracker.py
___
Python tracker
<https://bugs.python.org/issue46788>
___
___
Python-bugs-list m
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg415781
___
Python tracker
<https://bugs.python.org/issue46788>
___
___
Python-bugs-list mailin
New submission from Eryk Sun :
In bpo-44336, a new version of WindowsLoadTracker was implemented in
Lib/test/libregrtest/win_utils.py. This version resolves issues with the
previous implementation that spawned typeperf.exe. The new implementation uses
the registry API's HKEY_PERFORMANCE
Eryk Sun added the comment:
Running `tutorial-env\Scripts\activate` should suffice. The .bat script is for
CMD, and the .ps1 script is for PowerShell. The shell should run the right
script without having to include the extension.
In Windows 10+, if you use a case-sensitive directory for
Eryk Sun added the comment:
I implemented a ctypes prototype that replaces the registry-based
implementation with the API calls PdhOpenQueryW(), PdhAddEnglishCounterW(),
PdhCollectQueryData(), PdhGetRawCounterValue(), and PdhCloseQuery(). I'm
attaching the script, but here's
Eryk Sun added the comment:
I was just wondering whether it's worth implementing it using the API. To be
clear, I wasn't implying to hold off on applying Jeremy's PR. The existing code
is causing him problems, and he has a working solution.
--
Eryk Sun added the comment:
> which name should be stored if they are duplicated with case insensitive?
Ideally os.environ would preserve the original case of the process environment,
and os.environ.copy() would return a copy that's also case insensitive. That
would prevent most
Eryk Sun added the comment:
The main entry point for python[_d].exe should support a command-line -X option
or environment variable that suppresses Windows error/assert/warn reporting, or
redirects it to stderr in verbose mode. This would be useful to simplify
everyone's automated te
Change by Eryk Sun :
--
priority: normal -> critical
___
Python tracker
<https://bugs.python.org/issue47037>
___
___
Python-bugs-list mailing list
Unsubscrib
Eryk Sun added the comment:
> Ouch, is Python crashes because of an unsupported strftime call?
It's not a crash. It's a CRT error report dialog, which is enabled by default
for the _CRT_ASSERT and _CRT_ERROR macros in debug builds. This dialog can be
helpful when debugging inte
Eryk Sun added the comment:
bpo-46587 added top-level code to "Lib/test/support/__init__.py" to check
whether time.strftime("%4Y") works. Since "Lib/test/libregrtest/setup.py"
imports the support module, that code executes before suppress_msvcrt_asser
Eryk Sun added the comment:
> This means that "python -S" doesn't work with a virtual environment.
Does that matter? I've only used a virtual environment to override or extend
the system site packages. Is there a reason to use one without site packages?
--
Eryk Sun added the comment:
> this is a regression from 3.2
In Windows, bytes paths in sys.path do not work in 3.2+. I didn't test 3.0 and
3.1, but practically one can say that bytes paths were never supported in
Python 3 on Windows.
--
nosy:
Eryk Sun added the comment:
In 3.10, you should be able to work around the problem for the venv
site-packages directory by setting the environment variable "PYTHONPLATLIBDIR"
to "Lib". This sets sys.platlibdir, which the site module uses to create the
site-packages di
Eryk Sun added the comment:
I was following the pattern of StatAttributeTests.test_access_denied(), which
uses the current user's temp directory to get a filesystem that supports
security.
It would probably be better to skip tests if the filesystem of the current
working directory do
Eryk Sun added the comment:
> Why catch ERROR_NOT_READY and ERROR_BAD_NET_NAME as well?
When os.stat() falls back on FindFirstFileW(), an error that means the file
doesn't exist should be kept. ERROR_BAD_NET_NAME is an obvious error to keep
because it's already mapped to ENOE
Eryk Sun added the comment:
Pointers to resource type/name strings use the lower 16-bit range for integer
identifiers such as RT_ICON (3) and RT_GROUP_ICON (14). C code checks for these
cases using the IS_INTRESOURCE() macro.
It's incorrect to use a simple C string pointer type su
Change by Eryk Sun :
--
superseder: -> Encoding error running in subprocess with captured output
___
Python tracker
<https://bugs.python.org/issue46988>
___
_
Eryk Sun added the comment:
Itai, you can add a test to Win32NtTests in Lib/test/test_os.py. Maybe spawn a
child process that creates and unlinks a file in a loop. In the parent process
execute a loop that tries to stat the file and ignores errors when the file or
path isn't found
Eryk Sun added the comment:
> I'm not sure what can be done here (maybe a truncation warning?)
For a function pointer, the default argument conversion for Python integers is
the platform int type. Ideally, Python integer arguments would be converted to
a type that matches the platf
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg390391
___
Python tracker
<https://bugs.python.org/issue37609>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
> I thought pathlib would solve this problem completely now,
> without having to replace the slashes.
pathlib has nothing to do with how the Python language compiles string
literals. A string *literal* is Python source code that gets compiled and
instantia
Eryk Sun added the comment:
> e = Path(r'F:\ceven\test2')
Using forward slashes in the string literal is preferred, e.g.
Path('F:/ceven/test2'). This avoids the problem of backslash escapes in string
literals. The Path constructor parses the path and stores it interna
Eryk Sun added the comment:
> FileNotFoundError: [WinError 3] The system cannot find
> the path specified: 'F:\\ceven\\test2'
The Windows error code, ERROR_PATH_NOT_FOUND (3), indicates that the parent
path, r"F:\ceven", does not exist. Try e.mkdir(par
Change by Eryk Sun :
--
components: +Windows
keywords: +easy (C)
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
___
Python tracker
<https://bugs.python.org/issue46
Eryk Sun added the comment:
PlaySound() is implemented by the C function winsound_PlaySound_impl() in
"PC/winsound.c". To support pathlike objects, it could use `soundname =
PyOS_FSPath(sound)`, and require soundname to be a Unicode string via
PyUnicode_Check(soundname). Or it
Eryk Sun added the comment:
Putting words into action, here's an example of what a privileged process (e.g.
running as SYSTEM) can do if a script or application is written to call the
undocumented NT API function NtMakePermanentObject(). A use case would be a
script running as a s
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg414332
___
Python tracker
<https://bugs.python.org/issue28824>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
Putting words into action, here's an example of what a privileged process (e.g.
running as SYSTEM) can do if a script or application is written to call the
undocumented NT API function NtMakePermanentObject(). A use case would be a
script running as a s
Eryk Sun added the comment:
> The persistent mode sounds just like Python shared memory also works
> on Linux (where I can have these /dev/shm/* files even after the
> Python process ends) but I think on Windows, Python is not using
> the persistent mode and thus the shared memo
Eryk Sun added the comment:
In bpo-28824, I suggested preserving the case of environment variables in
Windows by using a case-insensitive subclass of str in the encodekey()
function. This is self-contained by the use of the encodekey() and decodekey()
functions in the mapping methods such
Eryk Sun added the comment:
> Yes, named memory mappings only exist on Windows until the last
> reference is closed, so this is a difference due to the underlying OS.
That's true for the Windows API, so it's true for all practical purposes. In
the underlying NT API, crea
Eryk Sun added the comment:
glibc remove() has an optimization to skip calling rmdir() if the macro
condition IS_NO_DIRECTORY_ERROR is true for the unlink() error. For Linux, this
condition is `errno != EISDIR`. On other platforms (e.g. BSD systems), the
condition is `errno != EPERM`. The
Eryk Sun added the comment:
> For REMOVE_BOTH, I don't see the need of calling GetFileAttributes
I was thinking that the NtQueryAttributesFile() system call is relatively cheap
compared to a full open, especially if the attributes of a remote file are
cached locally. However, o
Eryk Sun added the comment:
platform.release() returns platform.uname().release, which comes from
platform.win32_ver() in Windows [1]. The issue with Windows 11 is being
discussed in bpo-45382, but no PR has been submitted yet to resolve the issue.
> >>> sys.getwi
Eryk Sun added the comment:
> I think there should be a public class like this.
I wrote a basic implementation of _CaseInsensitiveString under the assumption
that it's hidden behind the __getitem__(), __setitem__(), and __delitem__()
methods of the _Environ class. I don't want
Change by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> os.environ should preserve the case of the OS keys ?
___
Python tracker
<https://bugs.python
Change by Eryk Sun :
--
versions: +Python 3.11
___
Python tracker
<https://bugs.python.org/issue28824>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eryk Sun added the comment:
I suggest closing this issue as a duplicate of bpo-43702.
--
___
Python tracker
<https://bugs.python.org/issue46862>
___
___
Pytho
Change by Eryk Sun :
--
versions: +Python 3.11 -Python 3.8
___
Python tracker
<https://bugs.python.org/issue43702>
___
___
Python-bugs-list mailing list
Unsub
Eryk Sun added the comment:
This should be handled in _winapi.CreateProcess(). An environment block is
technically required to be sorted. (Ages ago this was a MUST requirement for
getting and setting variables to work correctly, since the implementation
depended on the sort order, but I
Eryk Sun added the comment:
The resize() method also modifies the file pointer. Instead of fixing that
oversight, I think it should directly set the file's FileEndOfFileInfo and
FileAllocationInfo. For example:
// resize the file
if (!SetFileInformationByH
Eryk Sun added the comment:
The ordinal range 0x80-0x9F is the C1 control code set [1]. Ordinal 0x9F is
"Application Program Command" (APC). The command must be terminated by ordinal
0x9C, "String Terminator" (ST). For example, "\x9f Some Command \x9c".
In G
Eryk Sun added the comment:
> I have an idea to solve it. But I don't know how to get the
> clipboard data.
In Windows, using the window manager entails extending the process and the
current thread with GUI-related structures in the kernel and then connecting
the process
Eryk Sun added the comment:
> Clicking `Edit > Paste` from the window menu
> Use right-click to paste
In particular, if the console has quick-edit mode enabled, then you can paste
text by right-clicking. Also, if text is selected in quick-edit mode,
right-clicking copies to the
Eryk Sun added the comment:
> Another problem with the current text is that it fails to exclude
> enclosing class scopes
The nonlocal statement is only disallowed in module code (i.e. "exec"
compilation mode) because it can never be nested. It's allowed in a class
d
Eryk Sun added the comment:
I tried to get more information for you by installing 2.7.11 (64-bit because of
the given fault) and unassembling python27.dll at the fault offset. But it
doesn't help. Whatever the bug is, it ended up jumping to an address that's in
the middle of an i
Eryk Sun added the comment:
> pathlib does not allow to distinguish "path" from "path/".
os.path.normpath() and os.path.abspath() don't retain a trailing slash -- or a
leading dot component for that matter. Are you referring to os.path.join()? For
example:
Eryk Sun added the comment:
In Windows, checking for a directory in order to defer to either
os_rmdir_impl() or os_unlink_impl() would lead to a redundant directory check.
os_unlink_impl() already has to check for a directory in order to delete a
directory symlink or mountpoint. I suggest
Eryk Sun added the comment:
Windows filesystems disallow new opens for a file that has its delete
disposition set (i.e. the file is marked for deletion). For example,
CreateFileW() fails with ERROR_ACCESS_DENIED (5) in this case. A file with its
delete disposition set is still visibly
Eryk Sun added the comment:
Sample implementation:
import os
import msvcrt
import win32file
def samefile(f1, f2):
"""Test whether two paths refer to the same file or directory."""
s1 = os.stat(f1)
s2 = os.stat(f2)
New submission from Eryk Sun :
bpo-37705 overlooked fixing the OSError constructor. oserror_parse_args() in
Objects/exceptions.c should unconditionally call winerror_to_errno(), which is
defined in PC/errmap.h.
winerror_to_errno() maps the Winsock range 1-11999 directly, except for the
Eryk Sun added the comment:
Python uses the volume serial number (VSN) and file ID for st_dev and st_ino.
The OS allows the file ID to be 0 if the filesystem doesn't support file IDs.
Also, it does not require or force the VSN to be a unique ID in the system,
though if it's
Eryk Sun added the comment:
> I'm planning to learn more heavily on posixpath + ntpath in
> pathlib once bpo-44136 is done. I think that would be a good
> time to introduce is_mount() support on Windows.
In the long run, it would be better to migrate the implementation
Eryk Sun added the comment:
WindowsPath.is_mount() should call ntpath.ismount(). This function needs a
significant redesign, but it's fine to use it as long as it's documented that
is_mount() is equivalent to os.path.ismount().
Since the owner() and group() methods return names
Eryk Sun added the comment:
MSYS2 has basically the same problem when the script is passed as a Windows
path, except it uses "/c" for the "C:" drive instead of "/cygdrive/c".
# python3 -VV
Python 3.9.9 (main, Dec 28 2021, 11:05:23)
[GCC 11.2
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
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:
> 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:
> 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:
> 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:
> 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:
> 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:
> 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:
> 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:
> 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:
> 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
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:
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
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:
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:
> 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:
> 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:
> 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:
> 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 _
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 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
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:
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 "//"
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:
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
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
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:
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
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:
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:
> 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:
> 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
1 - 100 of 1001 matches
Mail list logo