Changes by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> bdist_wininst created binaries fail to start and find 32
Eryk Sun added the comment:
> work off its __name__ and __module__
Why is __module__ required? It seems to me this should only operate on the
current module.
I added a prototype to Python/bltinmodule.c that gets or creates the __all__
list from the current globals (i.e. PyEval_GetGlob
Eryk Sun added the comment:
> I would strongly argue to generally prohibit this
> with an exception
I agree. A warning in the tutorial isn't sufficient. ctypes should raise an
error when setting a union or bitfield struct type in argtypes or when passing
one by value.
Here's
Eryk Sun added the comment:
The `value` of a c_char_p or c_wchar_p pointer is a Python bytes or str object.
Since `value` won't consistently be the address value, it may be better to
introduce a read-only `as_void` attribute that can be implemented consistently
for all pointer
Eryk Sun added the comment:
As is documented for CreateProcess [1], the search path always includes the
following directories:
* The directory from which the application loaded.
* The current directory for the parent process.
* The Windows system directory. Use the
Eryk Sun added the comment:
> I'm inclined to believe that this is a bug in the ImDisk device driver
Junctions, and other filesystem reparse points, are implemented by volume
devices, not disk devices. NTFS and ReFS support reparse points, but FAT,
FAT32, and exFAT do not. Does the
Eryk Sun added the comment:
I see now. It's not a problem with the junction. In the stat implementation,
after verifying that the directory or file is a reparse point, it opens it
again without FILE_FLAG_OPEN_REPARSE_POINT, in order to open the target instead
of the link. I don't
Eryk Sun added the comment:
I don't disagree with using os.path.lexists. However, I think it should also
use a temporary target directory. Also, if it's possible to fix the behavior of
os.stat when GetFinalPathNameByHandle fails (considering we already have a
handle for the tar
Eryk Sun added the comment:
In Python 2, using the exec statement makes the compiler disable fast locals:
>>> def foo(): pass
...
>>> def bar(): exec ''
...
>>> foo.__code__.co_flags & inspect.CO_OPTIMIZED
1
>>>
Eryk Sun added the comment:
SilentGhost, msg263977 is spam copied from msg206393 to try to fool people into
clicking on the link. I've marked all of these messages from editor-buzzfeed as
spam.
--
nosy: +eryksun
___
Python tracker
Eryk Sun added the comment:
Generally the directory that an application needs for its configuration files
and data is either the script directory or an %AppData% or %LocalAppData%
subdirectory. If the initial working directory matters for some reason (e.g.
for writing output files), the
Eryk Sun added the comment:
python.dmp is from Windows 8.1 (NT 6.3):
0:000> ?? @$peb->OSMajorVersion; ?? @$peb->OSMinorVersion
unsigned long 6
unsigned long 3
with the following command line and working directory:
0:000> ?? @$peb->ProcessParameters->Comm
Eryk Sun added the comment:
The access control list of a file may not grant or may deny the current user
the right to read file attributes (i.e. lstat). Generally you don't have to
worry about granted access to parent directories when attempting to stat the
file or directory, since
Eryk Sun added the comment:
The Windows API loses information when mapping kernel status values to Windows
error codes. For example, the following status values are all mapped to
ERROR_ACCESS_DENIED:
STATUS_INVALID_LOCK_SEQUENCE 0xc01e
STATUS_INVALID_VIEW_SIZE 0xc01f
Eryk Sun added the comment:
I get the following warnings:
..\Modules\posixmodule.c(7422): warning C4090: 'function': different 'const'
qualifiers [...]
..\Modules\posixmodule.c(7423): warning C4090: 'function': different 'const'
qualifiers [...]
Eryk Sun added the comment:
It looks good to me. There are no errors or warnings.
--
___
Python tracker
<http://bugs.python.org/issue26708>
___
___
Python-bug
New submission from Eryk Sun:
importlib ignores the PYTHONCASEOK environment variable on Windows. _relax_case
checks for b'PYTHONCASEOK' in os.environ, which is never true because
os.environ is Unicode. On Windows, _make_relax_case should return a function
that instead
Eryk Sun added the comment:
When writing to a file or pipe, cmd's internal commands default to either the
current codepage of the attached console or, for a detached process, the system
locale codepage. It uses a best-fit encoding that tries to map characters to
similar characters i
Changes by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> IDLE crashes when pasting non-BMP unicode char on Py3
___
Python tracker
<http://bugs.python
Eryk Sun added the comment:
In Py2Reg, `(*retDataBuf==NULL)` needs spaces around the == operator.
Should the changes to the winreg docs be noted as new in 3.6?
Bikeshedding: in "What's New" you mention the change to QueryValueEx, but
Reg2Py and Py2Reg affect EnumValue, Qu
Eryk Sun added the comment:
What you're looking for is in the 2nd paragraph of the ast docs:
An abstract syntax tree can be generated by passing
ast.PyCF_ONLY_AST as a flag to the compile() built-in
function, or using the parse() helper provided in this
module. The result
Eryk Sun added the comment:
This is a consequence of several factors. It starts with the __init__ method of
ctypes.Array, Array_init. This function doesn't hard-code calling the base
sq_ass_item slot function, Array_ass_item. If it did, it wouldn't be nearly as
slow. Instead it
Changes by Eryk Sun :
--
versions: +Python 2.7, Python 3.5, Python 3.6
___
Python tracker
<http://bugs.python.org/issue27926>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
Probably Python 2's UTF-16 decoder should be as broken as the encoder, which
will match the broken behavior of the UTF-8 and UTF-32 codecs:
>>> u'\ud83d\uda12'.encode('utf-8').decode('utf-8')
u'\ud83d\uda12
Changes by Eryk Sun :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> null poiter dereference in set_conversion_mode due uncheck
_ctypes_conversion_errors
___
Python tracker
<http://bugs.python
Eryk Sun added the comment:
Victor, it seems the only option here (other than closing this as won't fix) is
to modify the UTF-16 decoder in 2.7 to allow lone surrogates, which would be
consistent with the UTF-8 and UTF-32 decoders. While it's too late to enforce
strict compliance
Eryk Sun added the comment:
py.exe is a console application. There's no point in using it to run
pythonw.exe. Use pyw.exe, as Zachary suggests. Or better yet, just run
`MyGuiApp.pyw %*`. Unless you've reconfigured the .pyw file association, it
should run via pyw.exe.
-
Eryk Sun added the comment:
> Naturally pyw -h produces no output
It needs help: `pyw -h 2>&1 | more`. This sets the StandardOutput and
StandardError as the write end of a pipe. more.com reads from the pipe and
pages the help text to the console.
Maybe this needs a new issue to ha
Eryk Sun added the comment:
Why do you need to call getpreferredencoding()? Isn't that already the default
if you call TextIOWrapper with encoding as None? For example:
text_mode = encoding or errors or universal_newlines
self.stdin = io.open(p2cwrite, 'wb', bufsize)
Eryk Sun added the comment:
The register() method should raise a TypeError if it's called with an object
that's not a type.
Consider the following:
from functools import singledispatch
class C:
pass
obj = C()
@singledispatch
def foo(x):
Eryk Sun added the comment:
This is implemented in Steve's latest patch in issue 27781. For example:
>>> sys.platform
'win32'
>>> os.mkdir('test')
>>> f = open('test/\U0001.txt', 'w')
>>> n
Eryk Sun added the comment:
It's not a bug that you can't read those keys. The DACL (discretionary access
control list) of those two keys doesn't grant any access to standard users.
However, administrators do have full control, in case your account is a UAC
restricted admin wit
Eryk Sun added the comment:
Martin, the console should be in line-input mode, in which case ReadConsole
will block if there isn't at least one line in the input buffer. It reads up to
the lesser of a complete line or the number of UTF-16 codes requested. If the
previous call read the e
Eryk Sun added the comment:
Considering the UTF-16 codec isn't self-consistent, it's a stretch to say it's
not a bug. It's misbehavior, and it either will be or won't be fixed. From
Victor's response it's looking like the latter.
--
___
Eryk Sun added the comment:
I wasn't trying to put words in your mouth, Victor. I was replying to Terry
(msg275406).
--
___
Python tracker
<http://bugs.python.org/is
Eryk Sun added the comment:
The leak is due the pointer-type cache that ctypes.POINTER uses. The type the
pointer refers to is used as the key. In this case, VS_FIXEDFILEINFO is created
each time win32_ver is called, so the pointer-type cache grows without bound.
Example leak:
>>&g
Eryk Sun added the comment:
Limiting the pointer-type cache could be a problem. It's expected that
POINTER() returns a reference to an existing pointer type. ctypes uses Python
types to ensure compatible C data types. For example:
LP_c_int = ctypes.POINTER(ctypes.c_int)
Eryk Sun added the comment:
Python 3's os.stat tries to open a handle for the file or directory in order to
call GetFileInformationByHandle. Opening a file handle via CreateFile requests
at least FILE_READ_ATTRIBUTES and SYNCHRONIZE access when it calls
NtCreateFile. If access is d
Eryk Sun added the comment:
I overlooked attempting to open a paging-file for any access, which is hard
coded as a sharing violation. The attached patch checks for both cases.
--
keywords: +patch
Added file: http://bugs.python.org/file44554/issue_28075_01.patch
Changes by Eryk Sun :
--
stage: -> patch review
___
Python tracker
<http://bugs.python.org/issue28075>
___
___
Python-bugs-list mailing list
Unsubscrib
Eryk Sun added the comment:
The attached patch adds tests and the suggested enhancement to
_WindowsFlavour.is_reserved.
Shouldn't it also return True if the name contains ASCII control characters?
They're only valid in NTFS stream names. Also, I think a name containing a
colon
Eryk Sun added the comment:
> It might be worth testing a patch that changes expanduser to
> decode the environment variables
If expanduser() is passed a unicode path, it can use
_winreg.ExpandEvironmentStrings(u'%USERPROFILE%') instead of decoding
os.environ['
New submission from Eryk Sun:
In 3.6, the Windows implementation of os.symlink can be simplified to directly
call CreateSymbolicLinkW, since this function was added in Windows Vista. The
support code for Py_CreateSymbolicLinkW can be removed from
Modules/posixmodule.c. enable_symlink can also
Eryk Sun added the comment:
This patch also updates Win32SymlinkTests and Win32JunctionTests to use the
user's %TEMP% directory instead of the source tree. It's much more likely that
%TEMP% is on the system volume, which should be an NTFS volume that supports
symbolic links and
Eryk Sun added the comment:
parse_envlist is calling PyUnicode_FromFormat with the format "%U=%U", but
passing it bytes:
|Debug Error!
Program: C:\Program Files\Python36\python_d.exe
abort() has been called
(Press Retry to debug the application)
(1e8.3
Eryk Sun added the comment:
Here's a snippet to reproduce this bug:
import os, sys
environb = {os.fsencode(k):os.fsencode(v) for k,v in os.environ.items()}
os.spawnve(os.P_WAIT, sys.executable, ('python', '--version'), environb)
(Now that Windows Python pro
Eryk Sun added the comment:
Berker, this is basically what I had in my initial patch on the Unix side. I
also addressed the Windows issues in parse_envlist and fsconvert_strdup. I'm
uploading that patch for reference. It needs a test. I also need to verify that
there are no addit
Eryk Sun added the comment:
PYTHONHOME should only be set temporarily for special cases. If running
python.exe without PYTHONHOME fails to find the standard library, then your
system is misconfigured. For additional help with this problem, ask on either
python-list or python-win32
Eryk Sun added the comment:
Thanks for the spawn test framework, Victor. I've added a use_bytes argument to
encode the args and env using os.fsencode. It's encoding args as well because
parse_arglist calls fsconvert_strdup, which was assuming Unicode strings on
Windows instea
Changes by Eryk Sun :
Added file: http://bugs.python.org/file44663/issue_28114_03.patch
___
Python tracker
<http://bugs.python.org/issue28114>
___
___
Python-bugs-list m
New submission from Eryk Sun:
When opening the CON device the underlying CreateFile call needs to use either
GENERIC_READ or GENERIC_WRITE access, but not both. Currently opening for
writing fails as follows:
>>> open('CON', 'wb', buffering=0)
Tra
New submission from Eryk Sun:
For a console readall(), if the first line starts with '\x1a' (i.e. Ctrl+Z), it
breaks out of its read loop before incrementing len. Thus the input isn't
handled properly as EOF, for which the check requires len > 0. Instead it ends
up calling W
New submission from Eryk Sun:
WindowsConsoleIO fileno() gets a file descriptor on demand by calling
_open_osfhandle. As a low I/O function this expects _open flags, but currently
the code is passing 'rb' (int 0x7262) and 'wb' (int 0x7762). It should use
_O_RDONLY | _O_
New submission from Eryk Sun:
_PyIO_get_console_type currently hard codes the names "CON", "CONIN$", and
"CONOUT$" and doesn't use a case-insensitive comparison. For example, opening
"conin$" doesn't get directed to WindowsConsoleIO:
>
New submission from Eryk Sun:
_PyOS_WindowsConsoleReadline should continue to read when interrupted by Ctrl+C
if SIGINT is ignored or the handler doesn't raise an exception. Currently it
breaks out of the read loop, which looks like an EOF:
>>> import signal
>
New submission from Eryk Sun:
On Unix, waiting on an instance of subprocess.Popen in the main thread is
interruptible by Ctrl+C. On Windows, it currently calls
_winapi.WaitForSingleObject, which isn't interruptible. It should instead call
_winapi.WaitForMultipleObjects, which automati
Eryk Sun added the comment:
This patch makes the trivial change to the Popen.wait() method and also
modifies _winapi.WaitForMultipleObjects to restart the wait if SIGINT is
ignored or the handler didn't raise an exception.
--
keywords: +patch
stage: needs patch -> patch revi
Changes by Eryk Sun :
Added file: http://bugs.python.org/file44674/issue_28168_02.patch
___
Python tracker
<http://bugs.python.org/issue28168>
___
___
Python-bugs-list m
Changes by Eryk Sun :
Removed file: http://bugs.python.org/file44674/issue_28168_02.patch
___
Python tracker
<http://bugs.python.org/issue28168>
___
___
Python-bugs-list m
Changes by Eryk Sun :
Added file: http://bugs.python.org/file44698/issue_28168_03.patch
___
Python tracker
<http://bugs.python.org/issue28168>
___
___
Python-bugs-list m
Changes by Eryk Sun :
Removed file: http://bugs.python.org/file44673/issue_28168_01.patch
___
Python tracker
<http://bugs.python.org/issue28168>
___
___
Python-bugs-list m
Eryk Sun added the comment:
Hopefully this is my last change until someone reviews this. I decided to make
it an error to pass an empty sequence, which previously would implicitly wait
on the SIGINT event. This way simplifies the code and prevents someone from
accidentally waiting forever on
New submission from Eryk Sun:
This suggestion may be controversial: os.putenv should decode bytes arguments
as UTF-8, the new Windows filesystem encoding. Moreover, os.environb should
also be implemented. This would be consistent with bytes support in os.spawnve
and os.execve.
The
Changes by Eryk Sun :
--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file44714/issue_28188_01.patch
___
Python tracker
<http://bugs.python.org/issu
Eryk Sun added the comment:
> check that a handle is actually a real console handle or
> what type it is
Did you mean a path here? Certainly you can check a handle, but that means
opening the path twice.
You can use GetFullPathName to classify the path, and then use GetFullPathName
Eryk Sun added the comment:
Here's the ctypes code (mentioned on issue 1602) for writing to the input
buffer and reading from the screen buffer. For output testing I also have a
context manager to create and temporarily activate a new screen buffer with a
given number of columns and row
Changes by Eryk Sun :
Added file: http://bugs.python.org/file44765/conout.py
___
Python tracker
<http://bugs.python.org/issue28217>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
For breaking out of the readall while loop, you only need to check if the
current read is empty:
/* when the read is empty we break */
if (n == 0)
break;
Also, the logic is wrong here:
if (len == 0 || buf[0] == '\x1a'
Eryk Sun added the comment:
The default encoding on your system is Windows codepage 1251. However, your
file is encoded using UTF-8:
>>> lines = open('ResourceStrings.rc', 'rb').read().splitlines()
>>> print(*lines, sep='\n')
b
Eryk Sun added the comment:
Codepage 1251 is a single-byte encoding and a superset of ASCII (i.e. ordinals
0-127). UTF-8 is also a superset of ASCII, so there's no problem as long as the
encoded text is strictly ASCII. But decoding non-ASCII UTF-8 as codepage 1251
produces nonsense, othe
Eryk Sun added the comment:
Specifically, while CreateProcess does execute batch scripts via the %ComSpec%
interpreter, the only extension it infers is ".exe". To run a ".cmd" or ".bat"
file, you have to use the full name with the extensi
Eryk Sun added the comment:
The GetWindowRect example seems fine, for the most part. The docs don't have to
show it being called. If I were to call it, I'd use GetForegroundWindow to get
a window handle. GetActiveWindow returns the active window attached to the
current thread'
Eryk Sun added the comment:
A CPython float uses the platform's double-precision floating point. The
significand of a double has 53 bits of precision, which is 15 decimal digits of
precision. However, uniquely representing a double in decimal requires 17
digits, which is why the str and
Eryk Sun added the comment:
Are you running python.exe without a script or command? That runs the REPL in
session 0, which will block reading from stdin. It's harmless to kill this
process. The REPL could detect that it's running in session 0 and exit.
However, I'm not in
Eryk Sun added the comment:
For some reason you're trying to schedule the installer to run in session 0. I
thought you were running python.exe in session 0 via the task scheduler, which
would hang in the REPL [1].
[1]: https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print
Eryk Sun added the comment:
Since this is 32-bit, are you using CDLL (cdecl) or WinDLL (stdcall)? Either
way, I made a simple test for the given function prototype, and it worked fine
in 32-bit 3.5.2 on Windows 10 for both calling conventions. You'll have to
provide a minimal example
Eryk Sun added the comment:
If you want a resolution to this issue, then you need to provide a minimal
example that reproduces the problem. It would also be helpful if you could
provide a download link for the library that you're wrapping. If not, at least
upload a dump file, preferably
Eryk Sun added the comment:
3.3 added os.replace, which on Windows entailed a switch from calling MoveFile
to MoveFileEx in order to specify the MOVEFILE_REPLACE_EXISTING flag. However,
not passing the MOVEFILE_COPY_ALLOWED broke compatibility with os.rename on
Windows for versions prior to
Eryk Sun added the comment:
In scanning over issue 8828, I see no discussion of the consequences of not
using MOVEFILE_COPY_ALLOWED in Antoine's patch, so it appears that this
behavior change was unintentional.
> For now I switched to shutil.move() but I suppose its not
> as
Eryk Sun added the comment:
In 2.7, the _handle attribute is a _subprocess_handle object, which
automatically calls CloseHandle when deallocated. For example:
>>> p = subprocess.Popen('python -c "import time; time.sleep(120)"')
CreateProcess returns both the
Eryk Sun added the comment:
Switching to ReadConsoleW in 3.6+ solves the problem with not seeing
ERROR_OPERATION_ABORTED in Windows 8+, and with proper handling this
potentially solves issues with Ctrl+C handling (when I last checked there were
still bugs with this in the 3.6 beta). However
Eryk Sun added the comment:
When I pointed this issue out in code reviews, I assumed you would add the
relatively simple fix to decode the prompt and call WriteConsoleW. The
long-term fix in issue 17620 has to be worked out with cross-platform support,
and ISTM that it can wait for 3.7.
Off
Eryk Sun added the comment:
I'm sure Steve already has this covered, but FWIW here's a patch to call
WriteConsoleW. Here's the result with the patch applied:
>>> sys.ps1 = '»»» '
»»» input("αβψδ: ")
αβψδ: spam
'spam'
and wi
Eryk Sun added the comment:
Here's an alternative patch, using PyUnicode_FSDecoder. It also adds
path_object_error and path_object_error2 helper functions.
--
Added file: http://bugs.python.org/file45017/issue_27998_01.patch
___
Python tr
Eryk Sun added the comment:
With the patch I uploaded, test_glob and test_os BytesWalkTests both pass, in
both Windows 10 and Linux. Without it those tests fail for me in Windows 10.
--
___
Python tracker
<http://bugs.python.org/issue27
Eryk Sun added the comment:
MultibyteToWideChar includes the trailing NUL when it gets the string length,
so the WriteConsoleW call needs to use (wlen - 1).
--
___
Python tracker
<http://bugs.python.org/issue28
Eryk Sun added the comment:
Due to a race condition, the Popen call in the second process is inadvertently
inheriting the handle for the write end of the pipe that's created for the
first process. Thus stdout.readline() in the first thread doesn't see EOF until
that handle is clo
Changes by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden
versions: +Python 3.7
___
Python tracker
<http://bugs.python.org/issue28
Eryk Sun added the comment:
Interning of strings is an implementation detail for the efficient storage of
variable and attribute names. A string with ':' in it cannot be a variable or
attribute name and thus is not interned. But you don't need to know which
strings are interned
Eryk Sun added the comment:
Kelvin is calling WlanScan [1], which returns an error code that apparently can
include HRESULT (signed) values cast as DWORD (unsigned) values, including
0x80342002 (ERROR_NDIS_DOT11_POWER_STATE_INVALID).
ctypes.FormatError calls FormatMessage [2] with the flag
Changes by Eryk Sun :
--
stage: -> resolved
___
Python tracker
<http://bugs.python.org/issue28490>
___
___
Python-bugs-list mailing list
Unsubscrib
Eryk Sun added the comment:
Issues with pip should be reported to its GitHub site. But installing to the
"Program Files" directory certainly isn't a problem for pip. You need to run it
with administrator rights.
--
nosy: +eryksun
resolution: -> not a bug
stage:
Eryk Sun added the comment:
> Windows 7 is very old.
3.8 will probably be the last Python version to support Windows 7 (2020-01
EOL). 3.6 is the last to support Vista.
--
nosy: +eryksun
___
Python tracker
<http://bugs.python.org/issu
Eryk Sun added the comment:
os.DirEntry exists in 3.6, but the change wasn't backported to 3.5. See issue
27038. As a workaround, you can scan a non-empty directory to get a reference
to the DirEntry type, e.g.:
import os
import tempfile
with tempfile.NamedTemporaryFile()
Eryk Sun added the comment:
I forgot to include the link to the python-list thread where this came up:
https://mail.python.org/pipermail/python-list/2016-October/715428.html
--
___
Python tracker
<http://bugs.python.org/issue28
Eryk Sun added the comment:
I installed "WinPython-64bit-3.6.0.0Zerorc2.exe" on Windows 10. As you can see
below, the included version of IDLEX depends on idlelib implementation details
that have changed between 3.5 and 3.6:
C:\WinPython36\python-3.6.0b2.amd64>.\python
P
Eryk Sun added the comment:
You may have uncovered a bug in Python that's causing the invalid parameter
handler to be invoked. It would help if you uploaded the zipped dump file for
the crashed process.
The status code you're getting (i.e. STATUS_STACK_BUFFER_OVERRUN, 0xC409)
Eryk Sun added the comment:
> ignore PYTHONPATH and the current working directory
Generally it's the script directory that isolated mode removes from sys.path.
It's the working directory when there is no script.
--
___
Python t
Eryk Sun added the comment:
To clarify, DirEntry is only exposed in the posix/nt and os modules starting in
3.6. To get a reference to it in 3.5 you have to fall back on something like
the following:
import os
try:
from os import DirEntry
except ImportError
Eryk Sun added the comment:
Supported versions of Windows Vista and later should have the CRT update [1]
installed via Windows Update. (3.5.2 is bundled with the older KB2999226 update
[2].) A Windows 7 system that I checked had this automatically installed last
March. But maybe for some
2001 - 2100 of 2119 matches
Mail list logo