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:
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 :
--
type: -> behavior
___
Python tracker
<https://bugs.python.org/issue23104>
___
___
Python-bugs-list mailing list
Unsubscrib
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_
Eryk Sun added the comment:
> For example, I would be shocked if it wasn't absolutely trivial
> for the current implementation to add auto-indenting following
> a colon. That feature alone would be a win for usability.
That would be a non-trivial change in Windows. I think
Eryk Sun added the comment:
In attributes_from_dir() in Modules/posixmodule.c, a trailing backslash or
slash should be stripped from the lpFileName parameter of FindFirstFileW.
Otherwise the call opens the directory via NtOpenFile, instead of opening its
parent directory. Even if opening
Eryk Sun added the comment:
What is the system error code (winerror) of the PermissionError?
--
nosy: +eryksun
___
Python tracker
<https://bugs.python.org/issue38
Change by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
___
Python tracker
<https://bugs.python.org/issue38
Eryk Sun added the comment:
The directory probably has the "readonly" attribute set. The documentation
includes a basic remove_readonly error handler for rmtree [1]:
import os, stat
import shutil
def remove_readonly(func, path, _):
"Clear the r
Eryk Sun added the comment:
In Windows, using CopyFileExW and CreateDirectoryExW (with a template
directory, for copytree) doesn't agree with how shutil implements copying with
separate copyfile and copymode/copystat functions. We'd have to extend
copyfile() to support alte
Change by Eryk Sun :
--
nosy: +giampaolo.rodola
___
Python tracker
<https://bugs.python.org/issue38906>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eryk Sun added the comment:
> whens searching for executables, Windows gives "exes that are in the
> same directory as the currently executing code" priority over PATH.
That subprocess lets CreateProcessW use a platform-dependent search that
prioritizes the application direc
Eryk Sun added the comment:
> "running an unqualified python and expecting a PATH search to pick up
> the same executable as the parent shell would is not supported and may
> produce unexpected results"
CreateProcessW finds "python.exe" in __APPDIR__ before it
Eryk Sun added the comment:
For a console application, normally the system connects to either the console
that's inherited from the parent or, if no console is inherited, a newly
allocated console. The creation flag DETACHED_PROCESS sets the initial console
handle in the child to a sp
Change by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
___
Python tracker
<https://bugs.python.org/issue38
Eryk Sun added the comment:
> Didn't we clean up this warning completely on Windows recently? It
> apparently matters on POSIX to join() the child process, but on
> Windows you aren't going to leak any resources by just forgetting
> about it, so I thought we stopped
Eryk Sun added the comment:
> Possibly we could handle "python[.exe]" literals by substituting
> sys.executable transparently?
Perhaps generalize this as splitext(basename(sys.executable))[0] in order to
support names other than "python" and "pythonw&quo
Eryk Sun added the comment:
> copystat() and copymode() should be able to copy the same
> metadata/security-bits/etc as CopyFileExW.
Regarding metadata, CopyFileExW copies the basic file info (i.e.
FileAttributes, LastAccessTime, LastWriteTime, and ChangeTime). This metadata
can be
Eryk Sun added the comment:
> When strict is "false", pathlib should not fail if the network
> share is inaccessible.
A redirected filesystem (i.e. a share, whether local or remote) that's
physically inaccessible should fail with a FileNotFoundError -- due to
unde
Eryk Sun added the comment:
> The only thing 'F:' can ever be is a mount point.
"F:" is a relative path that has to be resolved via abspath() (i.e.
GetFullPathNameW in Windows) before we can determine whether it's a mount
point. ntpath.ismount handles this corr
Eryk Sun added the comment:
> So essentially, you say the check should always be "ntpath.isdir(d)
I forgot that ntpath.isdir is now genericpath.isdir, so that will work. The old
nt._isdir wouldn't work because it was equivalent to an lstat. Apparently a
vestigial import
Eryk Sun added the comment:
I don't think the "/usr/bin/env" case needs to limit qualified names like
"python3[.x]" to registered installations. This is a choice made to simplify
the implementation. If it finds a generic "python.exe" executable in PATH
Eryk Sun added the comment:
> I think supporting the shebang line in py.exe is a misfeature and
> would prefer we'd never done it (though it predates my involvement).
Do you mean all shebangs, including those with a native file path?
Or do you mean just virtual shebangs, and in
Eryk Sun added the comment:
> * PYTHONPATH = 'C:\Developing\Python;C:\Developing\Python\Scripts;
> C:\Developing\Python\Lib;C:\Developing\Python\Lib\site-packages;
> C:\Developing\Python\DLLs;'
FYI, none of this should set here. For a standard configuration, the
installati
Eryk Sun added the comment:
> I am not sure if it's possible to also support Windows.
For reference, FindFirstFileW doesn't support handle-relative names, and
neither does CreateFileW. At a lower level in Windows NT, NtCreateFile has
always supported handle-relative names
Eryk Sun added the comment:
This may be due to changes regarding DLL dependency resolution in 3.8. If so,
you can find the missing DLL using Process Monitor, configured to monitor file
access in python.exe and pythonw.exe. Add the DLL's directory to the search
path via os.add_dll_dire
Eryk Sun added the comment:
I'd like to match POSIX here by supporting path-like names. Also, I think it
would be cleaner to split out the platform-specific work into a separate
_load_library method, like how subprocess.Popen is designed, and to stop
pretending that WINAPI LoadLibrary
Eryk Sun added the comment:
> I am not going to close it as I am unsure if it is by design that
> Windows and Unix python acts differently.
For compatibility, a script should support the spawn start method. Spawning
child processes is the only available start method in Windows, and,
Eryk Sun added the comment:
> In that the best tactic would be to look in those top-level
> directories for a directory with the same name as the executable.
It may be a common pattern, but such a guess is not reliable. The needed
executable may be in an unrelated directory at an arb
Eryk Sun added the comment:
> Agreed it's not a bug, but I will say it took me a while to work out
> *why* it's not a bug (namely, that even though the OP is using shared
> memory values, the code relies on fork semantics to share the two
> Value objects that *refere
New submission from Eryk Sun :
Windows 10 apparently defaults to disguising placeholder reparse points in
python.exe processes, but exposes them to cmd.exe and powershell.exe processes.
A common example is a user's OneDrive folder, which extensively uses
placeholder reparse points for
Eryk Sun added the comment:
No, ntpath and posixpath are cross-platform. They are tested on all platforms,
and the os.path documentation lists them and notes that "you can also import
and use the individual modules if you want to manipulate a path that is always
in one of the diff
Eryk Sun added the comment:
On second thought, I think the fact that the console leaves the previously
entered text on the line is ugly and confusing. The text isn't in the input
buffer, so it won't be read. Yet there's no way for the user to even clear it
-- not by escape
Eryk Sun added the comment:
> I afraid that removing a file while the file descriptor is open
> may not work on Windows. Seems this case is not well tested.
os.remove will succeed on a file that's opened with O_TEMPORARY, which shares
delete access (i.e. FILE_SHARE_DELETE).
W
Eryk Sun added the comment:
Okay, a well-known third-party library will work if a script/application really
needs this information. I just wanted to bring it up for consideration because
I saw an issue for cross-platform PowerShell 6 [1] where it was decided to
disable placeholder
Eryk Sun added the comment:
> With Python 3.7.6 this raises an exception at the ctypes.CFUNCTYPE()
> call with
> ...
> TypeError: item 1 in _argtypes_ passes a struct/union with a bitfield
> by value, which is unsupported.
I cannot reproduce the problem as stated in 3.7.6
Eryk Sun added the comment:
I'm not certain exactly what you want Python to be doing here, but let's start
out by clarifying some concepts.
> Reproduction method linux
> mkdir test; touch test/file.txt; chmod -w test/file.txt
Unlinking a file requires write permissi
Eryk Sun added the comment:
The warning would not apply to Windows. The environment block is part of the
Process Environment Block (PEB) record, which is protected by a
critical-section lock. The runtime library acquires the PEB lock before
accessing mutable PEB values. For example
Eryk Sun added the comment:
That clarification seems okay to me. The error message is in load_library in
Modules/_ctypes/callproc.c.
The underlying problem is that the directory of the DLL is only added to the
search path (in CDLL.__init__ in Lib/ctypes/__init__.py) if the caller uses a
Eryk Sun added the comment:
> On Win7, running Python in the terminal will attempt to load the
> "api-ms-win-core-path-l1-1-0.dll" from various paths outside of the
> Python directory and the C:\Windows\System32 directories.
"api-ms-win-core-path-l1-1-0.dll" i
Eryk Sun added the comment:
> Maybe use SetEnvironmentVariable() on Windows?
`_wputenv` keeps Python's copy of the environment block in sync with CRT's
copy, which in turn calls `SetEnvironmentVariableW` to sync with process
environment block. The CRT's copy of the enviro
Eryk Sun added the comment:
This bypasses the CRT's copy of the environment. If any C code calls
[_w]getenv, it will still see the variable defined. The only way it won't is if
setting the value also bypassed the CRT environment by directly calling
SetEnvironmentVariableW.
-
Eryk Sun added the comment:
The py launcher is separate from individual installations of Python. However
many versions of Python are installed at the system level and for however many
users, the system needs only one installation of the launcher. That's why it's
recommended to i
Change by Eryk Sun :
--
Removed message: https://bugs.python.org/msg360245
___
Python tracker
<https://bugs.python.org/issue39375>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
> Python can safely removes the string to _putenv() just after the call?
Windows ucrt copies the buffer that's passed to _[w]putenv. This makes it
non-compliant with POSIX but easier to use in this case. Here's an example
using ctypes:
Eryk Sun added the comment:
> no need to remove that message.
I was discussing the wrong API. It's not directly relevant that Windows API
functions that access the process environment are protected by the PEB lock.
Python primarily uses [_w]environ, a copy of the process env
Eryk Sun added the comment:
> The problem is that the _wputenv() function allows to insert variable
> names containing the "=" character
No, it does not. Your experiments uncovered bugs elsewhere with the
implementations of _wgetenv and WINAPI GetEnvironmentVariableW, but
Eryk Sun added the comment:
This is a duplicate of issue 38092. The required change to fix this is very
simple, if you want to work on a PR.
--
nosy: +eryksun
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> environment variable
Eryk Sun added the comment:
> can you confirm that the fix is to just change spawn.get_executable()
> to return sys.executable, like it was prior to the PR mentioned in
> the other ticket?
Yes, in spawn.py, change `_python_exe = sys._base_executable` to `_python_exe =
sys.executab
Eryk Sun added the comment:
Supporting __fspath__ for os.environ[b] makes it consistent with POSIX
os.putenv, which already supports it via PyUnicode_FSConverter. For example:
os.putenv(Path('spam'), Path('eggs'))
getenv = ctypes.CDLL('libc.so.6
Eryk Sun added the comment:
> I honestly would have disagreed with the Popen change for its 'env'
> argument or any other place that is dealing with environment
> variables
os.spawnve (Windows) and os.execve support __fspath__ for the env dict
partially due to me (bpo-
Eryk Sun added the comment:
> For clarity, I'm removing 3.9 from the affected versions. This version
> does not support Windows 7, and only Windows 7 is vulnerable to this
> DLL hijack.
I added 3.9 for the related issue to switch to using a static import, since
Windows 7 isn&
Eryk Sun added the comment:
This issue is due to a bug in GNU Readline (actually GNU History). It's
documented that write_history [1] returns an errno value. But the internal
history_do_write [2] function in this case returns the value from a rename()
system call, via the value
Eryk Sun added the comment:
> as long as the behavior is *consistent* with the env kwarg to
> subprocess.run()
subprocess isn't consistent with itself across platforms. The env parameter in
Windows is strictly an str->str mapping, like os.environ. This is coded in
get
Eryk Sun added the comment:
> Suffice to say, is there a significant reason to not allow it?
It's poorly supported by packaging. In particular, relocating an environment
isn't supported with entry-point scripts, which pip installs with a
fully-qualified shebang. Moreover
Eryk Sun added the comment:
> this PR has caused failures of 2 buildbots
The master branch should no longer get built on Windows 7 machines. The initial
build succeeds, but running "_freeze_importlib[_d].exe" fails with
STATUS_DLL_NOT_FOUND (0xC135, i.e. -1073741515) since
Eryk Sun added the comment:
This issue was already addressed for 3.x in bpo-31756, which added the a `text`
parameter and updated the documentation. As to 2.7, it was officially retired
as of the first of this month. Anyway, I don't think there was a pressing need
to clarif
Eryk Sun added the comment:
A Windows path reserves the following characters:
* null, as the string terminator
* slash and backslash, as path separators
* colon as the second character in the first component of
a non-UNC path, since it's a drive path
Additionally, a normalized
Change by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.9
___
Python tracker
<https://bugs.python.org/issue39
Change by Eryk Sun :
--
components: +Library (Lib), Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
___
Python tracker
<https://bugs.python.org/issue39
Eryk Sun added the comment:
> Right now PureWindowsPath does probably something like NTFS sorting,
> but NTFS is not Windows and from a function called 'WindowsPath' I
> expect a path that would be given in Windows Explorer.
NTFS stores the names in a directory as a
Eryk Sun added the comment:
> Perhaps it would be easy to do the replacement of underscores with
> hyphens on Windows in this function? I think that's safe enough, yes?
Recent releases of ucrt implement this translation from underscore to hyphen
for us, so this suggestion i
Eryk Sun added the comment:
> Even some well known locale names still use the utf-8 code page. Most
> seem to uncommon, but at least es-BR (Brazil) does and would still
> fall victim to these UCRT bugs.
es-BR is a custom locale for the Spanish language in Brazil, as opposed to th
Eryk Sun added the comment:
That the CRT caches the tzname strings as ANSI multibyte strings is frustrating
-- whether or not it's buggy. I would expect there to be a _wtzname cache of
the native OS strings that wcsftime uses directly, with no potential for failed
encodings (e.g.
Eryk Sun added the comment:
A binary float has the form (-1)**sign * (1 + frac) * 2**exp, where sign is 0
or 1, frac is a rational value in the range [0, 1), and exp is a signed integer
(but stored in non-negative, biased form). The smallest value of frac is
epsilon, and the smallest
Eryk Sun added the comment:
> I'm not sure what you're suggesting here. I shouldn't try to understand
> how floating-point numbers are stored?
No, that's the furthest thought from my mind. I meant only that I would not
recommend using one's own understa
Eryk Sun added the comment:
> On Windows 10 (version 1903), ANSI code page 1252, OEM code page 437,
> LC_CTYPE locale "French_France.1252"
The CRT default locale (i.e. the empty locale "") uses the user locale, which
is the "Format" value on the Regi
Eryk Sun added the comment:
It is not a duplicate of bpo-37945. The tests in test/test__locale.py need to
be fixed to work with Windows.
In msg354021, I discussed the problem reported with test_lc_numeric_localeconv.
The "ps_AF" (Pashto, Afghanistan) item in known_numerics
Eryk Sun added the comment:
> That means that libraries should assume they are being installed into
> venvs. Therefore makefiles should be invoking plain "python" rather
> than "pythonX.Y"
In Unix, 3.x virtual environments include a "python3" symlink o
Eryk Sun added the comment:
shared_memory is not the problem here. Your example assumes that a.dtype is
int64, but a numpy array defaults to "the minimum type required to hold the
objects in the sequence", and the actual minimum depends on the size of the
platform `long`. In
Eryk Sun added the comment:
> I seem to be consistingly hitting this issue.
It will help with test development if you can provide a minimal example that
reliably reproduces the problem.
In msg353064 I see DuplicateHandle calls failing with ERROR_ACCESS_DENIED (5).
Assuming the proc
Eryk Sun added the comment:
For reference see the section on comparisons in the language reference:
https://docs.python.org/3/reference/expressions.html#comparisons
--
nosy: +eryksun
resolution: -> not a bug
___
Python tracker
<
Eryk Sun added the comment:
> This is an os.lstat() limitation, nothing to do with pathlib.
In 3.8+, stat() and lstat() work with a broader rang of device paths, at least
for st_mode checks. For example:
>>> s = os.stat('//./PhysicalDrive0')
>>> stat.S
Eryk Sun added the comment:
The particular error reported here is due to pathlib, which is a duplicate of
issue 33898. That said, since the OP is using 3.7, I've left this issue open in
case someone wants to backport the win32_xstat_impl changes that enable stat()
(and in particular se
Eryk Sun added the comment:
> Sorry, but there is no documented relationship between byte
> offsets and tell() results for text-mode files in Windows:
The I/O stack in Python 3 does not use C FILE streams, and this issue is not
related to Windows. TextIOWrapper.tell returns a "co
Eryk Sun added the comment:
PowerShell translates single quotes to double quotes when they're used to
delimit a string in the command line, which complies with VC++ command-line
parsing and CommandLineToArgvW [1]. But PowerShell 5 has a bug here. It
translates 'C:\unu doi\' i
Eryk Sun added the comment:
Why are new versions getting added to an issue that was closed 5 years ago?
That said, I'd like to clarify that this was not and is not a bug. It happens
that the CMD shell strips quotes out, but that doesn't make it valid. PATH in
Windows is de
Change by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.9
___
Python tracker
<https://bugs.python.org/issue40
Eryk Sun added the comment:
> C:\Users>fsutil file queryfileid u:\test\test.jpg
> File ID is 0x29d504ae
ReFS uses a 128-bit file ID, which I gather consists of a 64-bit directory ID
and a 64-bit relative ID. (Take this with a grain of salt. AFAIK, Microsof
Eryk Sun added the comment:
> On Windows, os.waitpid() status also requires an operation (shif
> right by 8 bits) to get an exitcode from the waitpid status.
FWIW, I wouldn't recommend relying on os.waitpid to get the correct process
exit status in Windows. Status codes are
Eryk Sun added the comment:
> It's more the opposite, if tomorrow we want to encode the status
> of a terminated process differently, it will be easier if
> os.waitstatus_to_exitcode() is available, no?
This new status-to-exitcode function applies to Windows waitpid() only du
Eryk Sun added the comment:
> It's inherently racy, since deleting a file on Windows *doesn't
> actually delete it*, instead it marks the file for deletion. The
> system will eventually get around to deleting it, but under heavy
> load, this might be sometime after
Eryk Sun added the comment:
> Maybe something else was installed that put an incompatible
> _sqlite3.dll on PATH? Thereby proving the inherent risk of
> using unsafe DLL load settings
should_pass() sets the working directory of the test process to the `tmp`
directory. The loader
Eryk Sun added the comment:
> os.stat() seems to be striping significant trailing spaces off
> the path argument
The Windows file API normalizes paths to replace forward slashes with
backslashes; resolve relative paths and "." and ".." components; strip trailing
Eryk Sun added the comment:
> While I agree that Windows is safe to transform paths as he wishes to,
> the bug reported here is that os.stat/os.path.isdir behaves
> differently than os.scandir. Can we make them behave the same?
os.listdir and os.scandir can be modified to be
Eryk Sun added the comment:
> I'd say os.path.normpath() should perform the same (GetFullPathNameW?)
> normalization as os.stat() and friends do.
ntpath.abspath calls GetFullPathNameW (i.e. nt._getfullpathname) in Windows,
but ntpath.normpath is pure Python. I agree that norm
Eryk Sun added the comment:
An "Applications\python.exe" progid gets created by browsing for "python.exe"
when configuring the file association. For example, it gets created by the
Windows shell (Explorer) via "open with" -> "choose another app"
Eryk Sun added the comment:
> How do I get to the "rocket" launcher?
The py.exe launcher is installed by default with the Python 3 distribution from
python.org. Did you install that, or did you install the app distribution from
the Mi
Eryk Sun added the comment:
> I understand that py.exe is at least in part used to make handling
> multiple python versions easier.
On the command line the launcher supports multiple installed versions via the
"-X[.Y][-32|-64]" option. In scripts it supports multiple vers
Eryk Sun added the comment:
> the problem (or at least with these numbers) occurs only when
> the code is saved in a script, and this is run by double-
> clicking the file
The .py file association is probably using a different version of Python, or
it's associated with the p
Eryk Sun added the comment:
> But I'm not sure why that is getting loaded earlier than the
> current directory. Is that the behaviour we went for here?
I don't understand what's going on here if %PATH% is interfering. The current
directory (%__CD__%) should be checked b
Eryk Sun added the comment:
> it seems the search order we're getting for _sqlite3.dll (.pyd) is:
>
> * app directory
> * SQL server install directory (?)
> * Windows/System32
> * Windows
> * %PATH% (which is truncated at 2190 chars)
Thank you. It finally makes se
Eryk Sun added the comment:
> You mean the CI agent is doing it? Because there's nowhere in
> Python that should be doing it.
The ProcessParameters->DllPath value is inherited until a process in the tree
reverts to the original search path via SetDllDirectoryW(NULL), so
Eryk Sun added the comment:
> What do you mean by "portable version of mountpoint"?
posixpath.ismount is based on a portable method to detect a mountpoint in Unix
systems, since POSIX lacks a portable function for this. The implementation is
simple. A symlink is never
Eryk Sun added the comment:
Note that the implementation of relpath is pure and thus assumes it's working
with existing, resolved paths (i.e. "the filesystem is not accessed to confirm
the existence or nature of path or start"). For example:
>>> os.path.relpath(
Eryk Sun added the comment:
> This behavior is inconsistent with `os.path.abspath` where it always
> returns lowercased drive letter,
ntpath.abspath calls GetFullPathNameW, which generally preserves the input case
of the device/drive component. But it doesn't always preserve d
Eryk Sun added the comment:
> `os.path.abspath(".")` returned
> `'c:\\Users\\Kagami\\Documents\\GitHub\\gecko-dev'`.
> Should `ntpath.normpaoh` make the drive letter uppercase?
ntpath.abspath and ntpath.normpath should preserve the input case for all
components
Eryk Sun added the comment:
Prepending directories ahead of system directories in PATH affects programs
that implement their own search, which includes shells such as cmd.exe that do
so in order to support PATHEXT efficiently. That said, note that temporarily
prepending to PATH in a
Eryk Sun added the comment:
bpo-39393 improved the error message to mention "(or one of its dependencies)".
That's the best we can reasonably do. A developer can monitor "loader snaps"
messages in a debugger in order to discover the missing DLL and the directories
Eryk Sun added the comment:
> set "HOME" to override a location derived from ~
Using HOME in Windows is not reliable because it is not a system environment
variable. That makes it fair game for administrators, users, and applications
to use however they like.
Platform diffe
701 - 800 of 2119 matches
Mail list logo