[issue27346] Implement os.readv() / os.writev()

2016-06-18 Thread Eryk Sun
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

[issue27346] Implement os.readv() / os.writev()

2016-06-18 Thread Eryk Sun
Changes by Eryk Sun : -- components: +Library (Lib) -Extension Modules ___ Python tracker <http://bugs.python.org/issue27346> ___ ___ Python-bugs-list mailin

[issue16137] Using time.asctime() with an array with negative tm_hour causes Python Crash.

2016-06-26 Thread Eryk Sun
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

[issue27393] Command to activate venv in Windows has wrong path

2016-06-27 Thread Eryk Sun
Eryk Sun added the comment: You missed "C:\\>". -- nosy: +eryksun resolution: fixed -> stage: resolved -> status: closed -> open ___ Python tracker <http://b

[issue27403] os.path.dirname doesn't handle Windows' URNs correctly

2016-06-27 Thread Eryk Sun
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

[issue27403] os.path.dirname doesn't handle Windows' URNs correctly

2016-06-27 Thread Eryk Sun
Changes by Eryk Sun : -- Removed message: http://bugs.python.org/msg269406 ___ Python tracker <http://bugs.python.org/issue27403> ___ ___ Python-bugs-list mailin

[issue27403] os.path.dirname doesn't handle Windows' URNs correctly

2016-06-27 Thread Eryk Sun
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

[issue27403] os.path.dirname doesn't handle Windows' URNs correctly

2016-06-27 Thread Eryk Sun
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

[issue26226] Various test suite failures on Windows

2016-06-28 Thread Eryk Sun
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

[issue27412] float('∞') returns 8.0

2016-06-29 Thread Eryk Sun
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): >>

[issue27410] DLL hijacking vulnerability in Python 3.5.2 installer

2016-06-29 Thread Eryk Sun
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

[issue27412] float('∞') returns 8.0

2016-06-29 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> third party stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue27412> ___ ___

[issue27417] Call CoInitializeEx on startup

2016-06-29 Thread Eryk Sun
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

[issue27423] Failed assertions when running test.test_os on Windows

2016-06-30 Thread Eryk Sun
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

[issue27423] Failed assertions when running test.test_os on Windows

2016-06-30 Thread Eryk Sun
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&#

[issue27459] unintended changes occur when dealing with list of list

2016-07-05 Thread Eryk Sun
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

[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-08 Thread Eryk Sun
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

[issue25435] Wrong function calls and referring to not removed concepts in descriptor HowTo (documentation)

2016-07-08 Thread Eryk Sun
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)

[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-08 Thread Eryk Sun
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

[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-09 Thread Eryk Sun
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

[issue17213] ctypes loads wrong version of C runtime, leading to error message box from system

2016-07-09 Thread Eryk Sun
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

[issue27274] [ctypes] Allow from_pointer creation

2016-07-09 Thread Eryk Sun
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

[issue27475] define_macros uses incorrect parameter for msvc compilers

2016-07-10 Thread Eryk Sun
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

[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-10 Thread Eryk Sun
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

[issue27479] Slicing strings out of bounds does not raise IndexError

2016-07-10 Thread Eryk Sun
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

[issue27489] Win 10, choco install python gets message: Access to the path 'C:\WINDOWS\system32\**\**.exe.ignore' is denied.

2016-07-11 Thread Eryk Sun
Changes by Eryk Sun : -- stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue27489> ___ ___ Python-bugs-list

[issue13402] Document absoluteness of sys.executable

2016-07-11 Thread Eryk Sun
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 ___

[issue27496] unicodedata.name() doesn't have names for control characters

2016-07-12 Thread Eryk Sun
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

[issue27496] unicodedata.name() doesn't have names for control characters

2016-07-12 Thread Eryk Sun
Changes by Eryk Sun : -- components: +Unicode nosy: +ezio.melotti, haypo ___ Python tracker <http://bugs.python.org/issue27496> ___ ___ Python-bugs-list mailin

[issue27496] unicodedata.name() doesn't have names for control characters

2016-07-12 Thread Eryk Sun
Changes by Eryk Sun : -- versions: +Python 2.7, Python 3.6 ___ Python tracker <http://bugs.python.org/issue27496> ___ ___ Python-bugs-list mailing list Unsub

[issue18966] Threads within multiprocessing Process terminate early

2016-07-13 Thread Eryk Sun
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

[issue18966] Threads within multiprocessing Process terminate early

2016-07-13 Thread Eryk Sun
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.

[issue18966] Threads within multiprocessing Process terminate early

2016-07-14 Thread Eryk Sun
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,

[issue27516] Wrong initialization of python path with embeddable distribution

2016-07-14 Thread Eryk Sun
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

[issue27533] release GIL in nt._isdir

2016-07-16 Thread Eryk Sun
Eryk Sun added the comment: Should this be backported to 2.7 posix__isdir()? -- nosy: +eryksun ___ Python tracker <http://bugs.python.org/issue27533> ___ ___ Pytho

[issue27533] release GIL in nt._isdir

2016-07-16 Thread Eryk Sun
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

[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-17 Thread Eryk Sun
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

[issue27540] msvcrt.ungetwch() calls _ungetch()

2016-07-17 Thread Eryk Sun
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

[issue27545] missing pyshellext.vcxproj prevents puilding 3.6

2016-07-17 Thread Eryk Sun
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.

[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-17 Thread Eryk Sun
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

[issue27602] Enable py launcher to launch repository Python.

2016-07-23 Thread Eryk Sun
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

[issue27612] socket.gethostbyname resolving octal IP addresses incorrectly

2016-07-25 Thread Eryk Sun
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

[issue27631] .exe is appended to python executable based on filesystem case insensitivity

2016-07-27 Thread Eryk Sun
Changes by Eryk Sun : -- stage: -> resolved ___ Python tracker <http://bugs.python.org/issue27631> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue17599] mingw: detect REPARSE_DATA_BUFFER

2016-07-28 Thread Eryk Sun
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

[issue27649] multiprocessing on Windows does not properly manage class attributes

2016-07-29 Thread Eryk Sun
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

[issue18199] Windows: support path longer than 260 bytes using "\\?\" prefix

2016-08-03 Thread Eryk Sun
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

[issue27698] socketpair not in socket.__all__ on Windows

2016-08-08 Thread Eryk Sun
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

[issue27698] socketpair not in socket.__all__ on Windows

2016-08-08 Thread Eryk Sun
Changes by Eryk Sun : -- Removed message: http://bugs.python.org/msg272188 ___ Python tracker <http://bugs.python.org/issue27698> ___ ___ Python-bugs-list mailin

[issue27698] socketpair not in socket.__all__ on Windows

2016-08-08 Thread Eryk Sun
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

[issue27730] Update shutil to work with max file path length on Windows

2016-08-10 Thread Eryk Sun
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

[issue27729] Provide a better error message when the file path is too long on Windows

2016-08-11 Thread Eryk Sun
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

[issue27743] Python 2 has a wrong artificial limit on the amount of memory that can be allocated in ctypes

2016-08-12 Thread Eryk Sun
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

[issue27730] Update shutil to work with max file path length on Windows

2016-08-12 Thread Eryk Sun
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

[issue27698] socketpair not in socket.__all__ on Windows

2016-08-12 Thread Eryk Sun
Changes by Eryk Sun : -- keywords: +easy ___ Python tracker <http://bugs.python.org/issue27698> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27749] python 3.5.2 maybe crash

2016-08-12 Thread Eryk Sun
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

[issue27749] python 3.5.2 maybe crash

2016-08-12 Thread Eryk Sun
Changes by Eryk Sun : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker <http://bugs.python.org/issue27749> ___ ___

[issue27756] Add pyd icon for 3.6

2016-08-15 Thread Eryk Sun
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&

[issue27756] Add pyd icon for 3.6

2016-08-16 Thread Eryk Sun
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

[issue27731] Opt-out of MAX_PATH on Windows 10

2016-08-18 Thread Eryk Sun
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

[issue27797] ASCII file with UNIX line conventions and enough lines throws SyntaxError when ASCII-compatible codec is declared

2016-08-19 Thread Eryk Sun
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

[issue27827] pathlib is_reserved fails for some reserved paths on Windows

2016-08-22 Thread Eryk Sun
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

[issue12319] [http.client] HTTPConnection.request not support "chunked" Transfer-Encoding to send data

2016-08-24 Thread Eryk Sun
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

[issue27871] ctypes docs must be more explicit about the type a func returns

2016-08-26 Thread Eryk Sun
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

[issue27803] ctypes automatic byref failing on custom classes attributes

2016-08-26 Thread Eryk Sun
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

[issue27827] pathlib is_reserved fails for some reserved paths on Windows

2016-08-26 Thread Eryk Sun
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

[issue27874] inconsistent sys.path behavior when using PythonXX.zip

2016-08-27 Thread Eryk Sun
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

[issue26027] Support Path objects in the posix module

2016-08-27 Thread Eryk Sun
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

[issue27886] Docs: the difference between rename and replace is not obvious

2016-08-28 Thread Eryk Sun
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

[issue24045] Behavior of large returncodes (sys.exit(nn))

2016-08-29 Thread Eryk Sun
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

[issue27889] ctypes interfers with signal handling

2016-08-29 Thread Eryk Sun
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

[issue25631] Segmentation fault with invalid Unicode command-line arguments in embedded Python

2015-11-16 Thread Eryk Sun
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

[issue25639] open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: [WinError 1] Incorrect function

2015-11-16 Thread Eryk Sun
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' >

[issue25653] ctypes+callbacks+fork+selinux = crash

2015-11-18 Thread Eryk Sun
Changes by Eryk Sun : -- nosy: +eryksun ___ Python tracker <http://bugs.python.org/issue25653> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue25659] ctypes.Array.from_buffer segmentation fault when trying to create from array.array

2015-11-18 Thread Eryk Sun
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

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Eryk Sun
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

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Eryk Sun
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

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Eryk Sun
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

[issue25678] int() from a buffer reads past the buffer boundaries

2015-11-20 Thread Eryk Sun
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

[issue8304] time.strftime() and Unicode characters on Windows

2015-11-22 Thread Eryk Sun
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

[issue25709] greek alphabet bug it is very disturbing...

2015-11-23 Thread Eryk Sun
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

[issue25709] Problem with string concatenation and utf-8 cache.

2015-11-23 Thread Eryk Sun
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

[issue25709] Problem with string concatenation and utf-8 cache.

2015-11-23 Thread Eryk Sun
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

[issue25731] Assigning and deleting __new__ attr on the class does not allow to create instances of this class

2015-11-25 Thread Eryk Sun
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

[issue25737] array is not a Sequence

2015-11-26 Thread Eryk Sun
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

[issue25741] Usual Installation Directory

2015-11-28 Thread Eryk Sun
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

[issue25758] ensurepip/venv broken on Windows if path includes unicode

2015-11-28 Thread Eryk Sun
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

[issue25763] I cannot use absolute path in sqlite3 , python 2.7.9, windows

2015-11-29 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> not a bug stage: -> resolved ___ Python tracker <http://bugs.python.org/issue25763> ___ ___ Python-bugs-list

[issue25765] Installation error

2015-11-30 Thread Eryk Sun
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

[issue25772] Misleading descriptions about built-in `super.`

2015-12-01 Thread Eryk Sun
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 :

[issue25731] Assigning and deleting __new__ attr on the class does not allow to create instances of this class

2015-12-01 Thread Eryk Sun
Changes by Eryk Sun : -- nosy: +benjamin.peterson, twouters ___ Python tracker <http://bugs.python.org/issue25731> ___ ___ Python-bugs-list mailing list Unsub

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Eryk Sun
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

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Eryk Sun
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

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Eryk Sun
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

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-02 Thread Eryk Sun
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

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread Eryk Sun
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

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread Eryk Sun
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

[issue25778] winreg.EnumValue does not truncate strings correctly

2015-12-03 Thread Eryk Sun
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

[issue25789] py launcher stderr is not piped to subprocess.Popen.stderr

2015-12-03 Thread Eryk Sun
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

[issue25794] __setattr__ does not always overload operators

2015-12-04 Thread Eryk Sun
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

[issue25794] __setattr__ does not always overload operators

2015-12-04 Thread Eryk Sun
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

<    14   15   16   17   18   19   20   21   22   >