Eryk Sun added the comment:
ReadFileScatter and WriteFileGather also require a handle for a file that's
opened with FILE_FLAG_OVERLAPPED (asynchronous access; the file pointer is not
updated) and FILE_FLAG_NO_BUFFERING (buffers must be a multiple of the physical
sector size and aligned t
Changes by Eryk Sun :
--
components: +Library (Lib) -Extension Modules
___
Python tracker
<http://bugs.python.org/issue27346>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
To resolve the crash on Windows in 2.7 requires backporting checktm(). Using
asctime_s doesn't solve the problem. The CRT still calls the default invalid
parameter handler, which kills the process -- as shown by the following ctypes
example:
from ctypes i
Eryk Sun added the comment:
You missed "C:\\>".
--
nosy: +eryksun
resolution: fixed ->
stage: resolved ->
status: closed -> open
___
Python tracker
<http://b
Eryk Sun added the comment:
dirname() is implemented via split(), which begins by calling splitdrive(). The
'drive' for a UNC path is the r"\\server\share" component. For example:
>>> path = r'\\server\share\folder\file'
>>> os.path.spli
Changes by Eryk Sun :
--
Removed message: http://bugs.python.org/msg269406
___
Python tracker
<http://bugs.python.org/issue27403>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
dirname() is implemented via split(), which begins by calling splitdrive(). The
'drive' for a UNC path is the r"\\server\share" component. For example:
>>> path = r'\\server\share\folder\file'
>>> os.path.spli
Eryk Sun added the comment:
Paths starting with "\\.\" (or "//./") and "\\?\" are not UNC paths. I've
provided some explanations and examples below, and I also encourage you to read
"Naming Files, Paths, and Namespaces":
https://msdn.micros
Eryk Sun added the comment:
time.strftime calls the CRT's strftime function, which the Windows universal
CRT implements by calling wcsftime and encoding the result. The timezone name
is actually stored as a char string (tzname), so wcsftime has to decode it via
mbstowcs.
The problem is
Eryk Sun added the comment:
There's something wrong with however you're testing this.
>>> s = '\N{infinity}'
>>> s == '∞' == '\u221e'
True
'∞' isn't numeric. It's a math symbol (Sm):
>>
Eryk Sun added the comment:
> installer attempts to load DLLs from the current directory
It's actually the application directory that's the culprit, not the current
directory. All supported versions of Windows default to SafeDllSearchMode,
which moves the current directory
Changes by Eryk Sun :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue27412>
___
___
Eryk Sun added the comment:
pythoncom and comtypes use the value of sys.coinit_flags when imported, and
otherwise default to calling CoInitializeEx(NULL, COINIT_APARTMENTTHREADED).
Setting this value should ease problems, but something like -X:STA is still
necessary. Note that the launcher
Eryk Sun added the comment:
The attached patch suppresses the failed-assertion message boxes when running
test_os on a debug build.
--
keywords: +patch
nosy: +eryksun
stage: needs patch -> patch review
Added file: http://bugs.python.org/file43595/issue27423_1.pa
Eryk Sun added the comment:
test_os intentionally operates on invalid file descriptors. In the Windows CRT
this leads to failed assertions, such as from its _VALIDATE_RETURN macro. This
macro would also call the default invalid parameter handler, which would kill
the process, but that
Eryk Sun added the comment:
This is by design. Please read the answer for the frequently asked question
"How do I create a multidimensional list?":
https://docs.python.org/3/faq/programming.html#how-do-i-create-a-multidimensional-list
--
nosy: +eryksun
resolution: -> no
Eryk Sun added the comment:
Nothing can be done about this from Python. It's a bug in how Explorer handles
the dropped filename.
Note that it's not simply replacing Unicode characters with question marks.
It's using a best-fit ANSI encoding. For example, codepage 1252 maps
Eryk Sun added the comment:
I'm surprised it's not documented for the types module:
https://docs.python.org/3.5/library/types.html#types.MethodType
At least the docstring has the parameters:
>>> print(types.MethodType.__doc__)
method(function, instance)
Eryk Sun added the comment:
On second thought, it occurred to me that the problem isn't in Explorer or
shell32, but in the drop handler. It turns out the problem is that the drop
handler calls the ANSI API DragQueryFileA instead of DragQueryFileW. To see
this I attached a debugger to Exp
Eryk Sun added the comment:
Yes, a different drop handler solves the problem. It doesn't have to be the
exefile handler that's built into shell32.dll. Another handler could be used
that preserves Unicode filenames and long paths.
I tested in Windows
Eryk Sun added the comment:
This is only a problem for ctypes when python27.dll is used in an application
that isn't manifested to load the "Microsoft.VC90.CRT" assembly. ctypes doesn't
have this problem for a regular script run via the 2.7 version of python.exe,
since
Eryk Sun added the comment:
If your goal is to get a bytes object, I don't see the point of creating an
array. string_at is simpler and more efficient.
If you really must create an array, note that simple pointers (c_void_p,
c_char_p, c_wchar_p) need special handling. They don
Eryk Sun added the comment:
Did you try it? Using -D works fine for me, as it should [1]:
Options are specified by either a forward slash (/) or
a dash (–). If an option takes an argument, the option's
description documents whether a space is allowed between
the optio
Eryk Sun added the comment:
The WSH drop handler was added to resolve issue 1656675. It was chosen because
it supports long filenames. OTOH, the EXE drop handler probably uses short
filenames because the command line is limited to 32,768 characters. (Actually,
it only uses the short name for
Eryk Sun added the comment:
This is documented behavior for the built-in sequence types [1], and it's also
mentioned in the tutorial [2].
The indices() method of a slice object shows the resolved bounds for given
sequence length:
>>> slice(-1000, 1000, 1).indices(4
Changes by Eryk Sun :
--
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue27489>
___
___
Python-bugs-list
Eryk Sun added the comment:
"/opt/local/bin/../bin/python2.7" is an absolute path.
>>> os.path.isabs('/opt/local/bin/../bin/python2.7')
True
It's not relative to the working directory.
--
nosy: +eryksun
___
Eryk Sun added the comment:
Character names are in field 1 of UnicodeData.txt [1][2]. For controls the name
is just "". In Tools/unicode/makunicodedata.py, the makeunicodename
function skips names that start with "<". Instead of skipping the character, it
could fall
Changes by Eryk Sun :
--
components: +Unicode
nosy: +ezio.melotti, haypo
___
Python tracker
<http://bugs.python.org/issue27496>
___
___
Python-bugs-list mailin
Changes by Eryk Sun :
--
versions: +Python 2.7, Python 3.6
___
Python tracker
<http://bugs.python.org/issue27496>
___
___
Python-bugs-list mailing list
Unsub
Eryk Sun added the comment:
In 3.4+ it works correctly with the "spawn" start method. This uses
multiprocessing.spawn.spawn_main, which exits the child via sys.exit(exitcode).
"fork" and "forkserver" exit the child via os._exit(code), respectively in
multiproce
Eryk Sun added the comment:
> Per Eryk's point about the difference in multiprocessing's behavior
> when using spawn vs. fork, the explanation for why it's done that
> way is also described in the DeveloperWorks article I mentioned above.
Please spell this out for me.
Eryk Sun added the comment:
> all atexit handlers, for example, would be called multiple times.
Davin is (I think) proposing a multiprocessing atexit facility, which can be
used to ensure threading._shutdown is called. But could Python's regular atexit
handling be reset in the child,
Eryk Sun added the comment:
It looks like you haven't copied pyvenv.cfg to your application directory, so
Python isn't using the "applocal" configuration. That's why you're seeing the
default paths that are relative to the current directory. It's also wh
Eryk Sun added the comment:
Should this be backported to 2.7 posix__isdir()?
--
nosy: +eryksun
___
Python tracker
<http://bugs.python.org/issue27533>
___
___
Pytho
Eryk Sun added the comment:
OK. I thought fixing bugs in 2.7 was at the discretion of core developers,
including small tweaks for performance -- just not enhancements with
significant amounts of new code and features.
--
___
Python tracker
<h
Eryk Sun added the comment:
Thanks, Steve. I manually added this shell extension as the drop handler for
Python.File. It's working with non-ANSI filenames, e.g. "αβψδ εφγη ιξκλ μνοπ
ρστθ ωχυζ.txt" in a Western locale. Also, I was able to drop 939 files from the
System32 di
Eryk Sun added the comment:
Parsing the argument is also broken:
static PyObject *
msvcrt_ungetwch(PyObject *self, PyObject *args)
{
Py_UNICODE ch;
if (!PyArg_ParseTuple(args, "u:ungetwch", &ch))
return NULL;
if (_unge
Eryk Sun added the comment:
Steve committed part of the update for the new shell extension DLL in changeset
6b0023810108. I didn't notice because I have the patch from issue 27469
imported in order to build and test pyshellext.dll.
--
components: +Windows
nosy: +eryksun, paul.
Eryk Sun added the comment:
Steve, will you be uploading a new patch? The current patch doesn't include
"pyshellext.vcxproj" in the build, since that was accidentally committed and
then removed.
When you call ShellExecute, I suggest passing NULL for lpOperation, to use the
d
Eryk Sun added the comment:
> I assume you wouldn't expect to support shebang lines
> like "#!python3.6r"?
That's already supported in py.ini in the [commands] section, per PEP 397. I've
used this from Vinay's initial releases on Bitbucket, before the launc
Eryk Sun added the comment:
socket.gethostbyname calls the internal function setipaddr, which tries to
avoid a name resolution by first calling either inet_pton or inet_addr.
Otherwise it calls getaddrinfo.
Windows
---
setipaddr calls inet_addr, which supports octal [1]. ctypes example
Changes by Eryk Sun :
--
stage: -> resolved
___
Python tracker
<http://bugs.python.org/issue27631>
___
___
Python-bugs-list mailing list
Unsubscrib
Eryk Sun added the comment:
REPARSE_DATA_BUFFER is defined in the WDK filesystem header, km\ntifs.h. It's
not defined in the user-mode SDK.
--
nosy: +eryksun
___
Python tracker
<http://bugs.python.org/is
Eryk Sun added the comment:
Queuing the class doesn't do anything here. It gets pickled as a module
attribute; the queue isn't marshaling the class dict. For example:
>>> pickletools.dis(pickle.dumps(mccabe.McCabeChecker))
0: \x80 PROTO 3
2: c
Eryk Sun added the comment:
Apparently CoreFX adds the \\?\ prefix automatically:
https://blogs.msdn.microsoft.com/jeremykuhne/2016/06/21/more-on-new-net-path-handling
It's great that Windows 10 Anniversary Edition will be getting long path
support without requiring the extended path p
Eryk Sun added the comment:
See issue 18643, which added a Windows implementation of socketpair(). Since
it's not defined in the _socket extension module, it isn't added to
socket.__all__. Someone simply forgot to add
`__all__.append("sockpetpair")` after the de
Changes by Eryk Sun :
--
Removed message: http://bugs.python.org/msg272188
___
Python tracker
<http://bugs.python.org/issue27698>
___
___
Python-bugs-list mailin
Eryk Sun added the comment:
See issue 18643, which added a Windows implementation of socketpair(). Since
it's not defined in the _socket extension module, it isn't added to
socket.__all__. Someone simply forgot to add `__all__.append("socketpair")`
after the de
Eryk Sun added the comment:
Standard users have SeChangeNotifyPrivilege, which allows traversing a
directory that they can't access, so Python should only work with paths as
strings instead of trying to open a directory handle.
I think it's best to make Windows do as m
Eryk Sun added the comment:
The NT runtime API RtlDosPathNameToRelativeNtPathName_U_WithStatus returns an
informative error code, STATUS_NAME_TOO_LONG (0xC106). This gets translated
to the less information but still useful Windows code ERROR_PATH_NOT_FOUND
(0x0003). The CRT error table
Eryk Sun added the comment:
AFAIK this only affects Windows. It looks like a relatively simple fix. In
PyCArrayType_new, change the declaration of `length` to Py_ssize_t to match the
definition StgDictObject.length; ensure the _length_ attribute is an index via
PyIndex_Check instead of
Eryk Sun added the comment:
I overlooked some aspects of the problem:
* A short relative path may end up exceeding MAX_PATH when normalized as a
fully qualified path.
* The working directory may be a UNC path or may already have the \\?\ prefix.
It's not thread-safe to check this befor
Changes by Eryk Sun :
--
keywords: +easy
___
Python tracker
<http://bugs.python.org/issue27698>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eryk Sun added the comment:
To diagnose the access violation, it may help if you install the debug binaries
and try to reproduce the crash using python_d.exe. Attach the dump file to this
issue.
Regarding the multiprocessing question, if its a separate issue you need to
file it on its own
Changes by Eryk Sun :
--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
___
Python tracker
<http://bugs.python.org/issue27749>
___
___
Eryk Sun added the comment:
> Maybe it's time for a whole new set :)
Please keep a rocket in the upper left-hand corner for the launcher icon. It
distinguishes the launcher from other "Python" apps when modifying the shell's
file association, since the shell doesn&
Eryk Sun added the comment:
Should pyw.exe get its own icon? Otherwise these look good to me; they're less
busy than the existing icons, which is probably for the best. Is there a
potential licensing problem with borrowing the look of the Win+R dialog icon,
or is this fai
Eryk Sun added the comment:
> anything running under the python.exe will get it for free.
py.exe may as well get the manifest setting, but it's not critical. It isn't
common to store scripts in deeply nested paths. The same goes for the distlib
launchers that pip uses for entry
Eryk Sun added the comment:
In issue 20844 I suggested opening the file in binary mode, i.e. change the
call to _Py_wfopen(filename, L"rb") in Modules/main.c. That would also entail
documenting that PyRun_SimpleFileExFlags requires a FILE pointer that's opened
in binary mod
New submission from Eryk Sun:
pathlib._WindowsFlavour.is_reserved assumes Windows uses an exact match up to
the file extension for reserved DOS device names. However, this misses cases
involving trailing spaces and colons, such as the following examples:
Trailing colon:
>>> pat
Eryk Sun added the comment:
> on Windows? Will tell() and seek() reliably fail on a pipe
> or other unseekable file?
No they will not reliably fail.
The file position is stored in the FILE_OBJECT CurrentByteOffset. This value
can be queried and set using the WinAPI function SetFilePoi
Eryk Sun added the comment:
See section 2.7 in the ctypes docs:
Fundamental data types, when returned as foreign function call
results, or, for example, by retrieving structure field members
or array items, are transparently converted to native Python
types. In other words, if
Eryk Sun added the comment:
Terry, the provided example is incomplete and doesn't make sense as it stands.
For better or worse, windll.dllname attempts to load WinDLL(dllname) and cache
the resulting library on the windll loader. (The library in turn caches
function pointers, which means
Eryk Sun added the comment:
Also, "CONIN$" and "CONOUT$" need to be added to the list of reserved names.
Prior to Windows 8 these two names are reserved only for the current directory,
which for the most part also applies to "CON".
For Windows 8+, the redesig
Eryk Sun added the comment:
Windows Python determines sys.prefix (i.e. the location of the standard
library, \lib) via either the PYTHONHOME environment variable or by
searching for the landmark "lib/os.py", starting in the application directory
and reducing back to the root di
Eryk Sun added the comment:
I wish the name was "pushCleanup" to emphasize that cleanup functions are
popped and called in LIFO order.
--
nosy: +eryksun
___
Python tracker
<https://bugs.python.o
Eryk Sun added the comment:
Having rename() in pathlib is fine as long as it links to the os docs. This
probably needs a new issue, but I do see room for improvement in the latter.
For Unix, the os.rename and os.replace docs should clarify that an empty
destination directory can be replaced
Eryk Sun added the comment:
Unix waitpid() packs the process exit status and terminating signal number into
a single status value. As specified by POSIX [1], the WEXITSTATUS function
returns only the lower 8 bits of the process exit status. In theory, waitid()
and wait6() can return the full
Eryk Sun added the comment:
I can't reproduce this issue in 2.7.11 on Linux. I also don't see how it could
be related to ctypes. It doesn't meddle with signal handlers, and neither does
Linux libuuid -- not as far I as I can tell with breakpoints set on signal()
and siga
Eryk Sun added the comment:
The interpreter isn't initialized, so calling PyErr_Format in a release build
segfaults when it tries to dereference a NULL PyThreadState. OTOH, a debug
build should call PyThreadState_Get, which in this case calls Py_FatalError and
aborts the pr
Eryk Sun added the comment:
As a workaround you can open a file descriptor via os.open:
>>> import os
>>> fd = os.open(r'\\.\PhysicalDrive0', os.O_RDONLY | os.O_BINARY)
>>> os.read(fd, 512)[:8]
b'3\xc0\x8e\xd0\xbc\x00|\x8e'
>
Changes by Eryk Sun :
--
nosy: +eryksun
___
Python tracker
<http://bugs.python.org/issue25653>
___
___
Python-bugs-list mailing list
Unsubscribe:
Eryk Sun added the comment:
You have to subclass ctypes.Array with a _type_ and _length_. But ctypes types
also implement sequence repetition (*) to facilitate creating array types. For
example:
import array, ctypes
a1 = array.array('l')
a1.fromlist(range(1
Eryk Sun added the comment:
> Now we have an example, and can backport that patch.
More seriously it's possible to get a buffer over-read using NumPy:
>>> import numpy
>>> int(buffer(numpy.array('123', dtype='c')))
Traceback (mos
Eryk Sun added the comment:
I just made a quick modification to check that it works. I'm sure you could do
the same. But here it is anyway.
--
keywords: +patch
Added file: http://bugs.python.org/file41095/issue25678.patch
___
Python tracker
Changes by Eryk Sun :
Added file: http://bugs.python.org/file41101/issue25678_2.patch
___
Python tracker
<http://bugs.python.org/issue25678>
___
___
Python-bugs-list m
Eryk Sun added the comment:
> I think the tests should be using buffer(..., a, b) instead.
Thanks, you're right. :)
--
Added file: http://bugs.python.org/file41102/issue25678_3.patch
___
Python tracker
<http://bugs.python.org
Eryk Sun added the comment:
The problem from issue 10653 is that internally the CRT encodes the time zone
name using the ANSI codepage (i.e. the default system codepage). wcsftime
decodes this string using mbstowcs (i.e. multibyte string to wide-character
string), which uses Latin-1 in the C
Eryk Sun added the comment:
unicode_modifiable in Objects/unicodeobject.c should return 0 if there's cached
PyUnicode_UTF8 data. In this case PyUnicode_Append won't operate in place but
instead concatenate a new string.
--
nosy: +eryksun
Eryk Sun added the comment:
Serhiy, when does sharing UTF-8 data occur in a compact object? It has to be
ASCII since non-ASCII UTF-8 isn't sharable, but PyASCIIObject doesn't have the
utf8 field. So it has to be a PyCompactUnicodeObject. But isn't ASCII always
allocated as a P
Eryk Sun added the comment:
> Why do strings cache their UTF-8 encoding?
Strings also cache the wide-string representation. For example:
from ctypes import *
s = '\241\242\243'
pythonapi.PyUnicode_AsUnicodeAndSize(py_object(s), None)
pythonapi.PyUnicode_AsUTF8AndS
Eryk Sun added the comment:
For "del X.__new__", type_setattro in Objects/typeobject.c indirectly calls
update_one_slot. This finds object.__new__ fom the base object class when it
looks up __new__ on the type. Since __new__ for built-in types is special-cased
to be a built-in meth
Eryk Sun added the comment:
This is a duplicate of issue 23864, i.e. only the "one-trick ponies" work:
>>> issubclass(array.array, abc.Sized)
True
>>> issubclass(array.array, abc.Iterable)
True
>>> issubclass(array.array, abc.Container
Eryk Sun added the comment:
> LOCALAPPDATA is set by the operating system, typically to
> C:\Users\\AppData\Local (at least since Vista I
> think? Certainly since Win7
Vista introduced LOCALAPPDATA, so there's no problem referencing it in the docs
for 3.5+.
On a related
Eryk Sun added the comment:
The problem is that the compile_source function in Modules/zipimport.c calls
PyUnicode_EncodeFSDefault to get an encoded string to pass as the filename
argument of Py_CompileString. On Windows this uses the ANSI codepage (i.e.
'mbcs'). Apparently your sys
Changes by Eryk Sun :
--
resolution: -> not a bug
stage: -> resolved
___
Python tracker
<http://bugs.python.org/issue25763>
___
___
Python-bugs-list
Eryk Sun added the comment:
> The error code is from Windows Update (which we sometimes need to
> run as part of the install), and there's so much spam out there
> these days that it is impossible to find out what it means.
The error is WU_E_NOT_INITIALIZED [1], "the
Eryk Sun added the comment:
> Just FYI, 'super' is not a type
No, super is a type:
>>> super
It's one of 3 types defined in Objects/typeobject.c:
PyBaseObject_Type : "object"
PyType_Type : "type"
PySuper_Type :
Changes by Eryk Sun :
--
nosy: +benjamin.peterson, twouters
___
Python tracker
<http://bugs.python.org/issue25731>
___
___
Python-bugs-list mailing list
Unsub
Eryk Sun added the comment:
Based on matplotlib's win32InstalledFonts function [1], I created a small test
to check the data strings returned by winreg.EnumValue for the presence of null
characters. I tested on Windows 7 and 10 but couldn't reproduce the problem.
Please run nullc
Eryk Sun added the comment:
You should be able to run nullcheck.py in the command prompt by changing to the
directory where it's saved and entering nullcheck.py. For example, if you saved
it in your Downloads folder:
>cd /d C:\Users\Anshul\Downloads
>nullcheck.py
If
Eryk Sun added the comment:
I only wrote it for Python 3, but it would be interesting to see what you get
with Python 2. Please try nullcheck2.py.
--
Added file: http://bugs.python.org/file41213/nullcheck2.py
___
Python tracker
<h
Eryk Sun added the comment:
Here's a patch for Python 3 that modifies the Reg2Py function in PC/winreg.c
for the case of REG_SZ/REG_EXPAND_SZ. The existing code took a conservative
approach by only removing a null character at the end of a buffer. I modified
it to use wcsnlen instea
Eryk Sun added the comment:
REG_SZ and REG_EXPAND_SZ are documented as null-terminated strings [1], which
shouldn't have an embedded null character. As such, the default result in the
high-level environment of Python shouldn't have embedded nulls. However, since
the buffer is size
Eryk Sun added the comment:
> add a QueryRawValue[Ex] function
Or QueryValueEx and EnumValue could take a boolean argument named "raw" or
"binary", which if True forces the data to be returned as REG_BINARY regardles
Eryk Sun added the comment:
> I don't like the idea of having a mismatch between what we set and
> what we get, even if what we're setting technically shouldn't be
> allowed.
Currently if you set a string with null, you won't see it using either
regedit.exe o
Eryk Sun added the comment:
The error() function in PC/launcher.c should call exit(rc) instead of
ExitProcess(rc). This allows the CRT to terminate properly and flush the stderr
FILE stream. With this change it works as expected:
>>> import subprocess
>>> p = subpro
Eryk Sun added the comment:
Normally Python code calls built-in setattr, which calls the C API
PyObject_SetAttr. This API interns the attribute name before calling the type's
tp_setattro or tp_setattr function. Interning the string is a critical step,
since the implementation for upd
Changes by Eryk Sun :
Removed file: http://bugs.python.org/file41235/issue25794_1.patch
___
Python tracker
<http://bugs.python.org/issue25794>
___
___
Python-bugs-list m
1801 - 1900 of 2119 matches
Mail list logo