[issue29250] islink and stat follow_symlinks are inconsistent on Windows

2017-01-12 Thread Eryk Sun
Changes by Eryk Sun : -- dependencies: +os.walk always follows Windows junctions ___ Python tracker <http://bugs.python.org/issue29250> ___ ___ Python-bugs-list m

[issue23407] os.walk always follows Windows junctions

2017-01-12 Thread Eryk Sun
Eryk Sun added the comment: I simply listed the tags that have the name-surrogate bit set out of those defined in km\ntifs.h. To keeps things simple it might be better to only include Microsoft tags (i.e. bit 31 is set). That way we don't have to deal with REPARSE_GUID_DATA_BUFFER s

[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-13 Thread Eryk Sun
Eryk Sun added the comment: In 3.6, type_new in Objects/typeobject.c sets the __classcell__ in the dict if it's a cell object. It happens that CreateSwappedType in Modules/_ctypes/_ctypes.c re-uses the dict to create the swapped type (e.g. big endian), which in turn updates the __classc

[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-13 Thread Eryk Sun
Eryk Sun added the comment: Here's a patch that deletes __classcell__ from the dict before calling type_new. -- keywords: +patch Added file: http://bugs.python.org/file46285/issue_29270_01.patch ___ Python tracker <http://bugs.python.org/is

[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-13 Thread Eryk Sun
Changes by Eryk Sun : -- stage: -> patch review ___ Python tracker <http://bugs.python.org/issue29270> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-14 Thread Eryk Sun
Eryk Sun added the comment: OK, this is completely broken and needs a more thoughtful solution than my simpleminded hack. Here's a practical example of the problem, tested in 3.5.2: class MyInt(ctypes.c_int): def __repr__(self): return super().__repr__()

[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-14 Thread Eryk Sun
Eryk Sun added the comment: Resolving this would be straightforward if we could use a subclass for the swapped type, but ctypes simple types behave differently for subclasses. A simple subclass doesn't automatically call the getfunc to get a converted value when returned as a function r

[issue29240] Implementation of the PEP 540: Add a new UTF-8 mode

2017-01-14 Thread Eryk Sun
Eryk Sun added the comment: > it should be replaced with sys.getfilesystemencodeerrors() > to support UTF-8 Strict mode. I did that in the patch for issue 28188. The focus of the patch is to add bytes support on Windows for os.putenv and os.environb, but I also tried to maximize consi

[issue29256] Windows select() errors out when given no fds to select on, which breaks SelectSelector

2017-01-14 Thread Eryk Sun
Eryk Sun added the comment: Some WinSock functions are just dispatchers that call a provider function. The dispatch table is set up when WinSock (i.e. ws2_32.dll) calls the WSPStartup function [1] of a provider DLL (e.g. mswsock.dll). In the case of select(), it calls the socket provider&#

[issue23407] os.walk always follows Windows junctions

2017-01-14 Thread Eryk Sun
Eryk Sun added the comment: Craig, can you add a patch for issue 29248, including a test based on the "All Users" link? -- dependencies: +os.readlink fails on Windows ___ Python tracker <http://bugs.python.o

[issue22302] Windows os.path.isabs UNC path bug

2017-01-14 Thread Eryk Sun
Changes by Eryk Sun : -- stage: -> needs patch versions: +Python 3.6, Python 3.7 -Python 3.3, Python 3.4 ___ Python tracker <http://bugs.python.org/issu

[issue22302] Windows os.path.isabs UNC path bug

2017-01-14 Thread Eryk Sun
Changes by Eryk Sun : -- Removed message: http://bugs.python.org/msg226094 ___ Python tracker <http://bugs.python.org/issue22302> ___ ___ Python-bugs-list mailin

[issue22302] Windows os.path.isabs UNC path bug

2017-01-15 Thread Eryk Sun
Eryk Sun added the comment: isabs also fails for device paths such as r"\\.\C:", which is an absolute path for opening the C: volume. UNC and device paths (i.e. \\server, \\?, and \\.) should always be considered absolute. Only logical drives (i.e. C:, D:, etc) support drive-rela

[issue29294] ctypes.windll.LoadLibrary refuses unicode argument

2017-01-17 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> duplicate stage: -> resolved superseder: -> In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects ___ Python tracker <http://bugs.python.or

[issue29285] Unicode errors occur inside of multi-line comments

2017-01-17 Thread Eryk Sun
Eryk Sun added the comment: > they do not appear in the byte code files It's simple to coonfirm that unassigned string literals get thrown away.: >>> code = compile('"doc"\n"unused"\n"us"+"ed"', '', 'exec&#

[issue29329] Incorrect documentation for custom `hex()` support on Python 2

2017-01-19 Thread Eryk Sun
Eryk Sun added the comment: Python 3 uses __index__ for bin(), oct(), and hex(), but Python 2 only uses __index__ for bin() and otherwise uses __oct__ and __hex__. Antoine overlooked this when updating the 2.7 docs for hex() in issue 16665. -- nosy: +eryksun

[issue29330] __slots__ needs documentation

2017-01-19 Thread Eryk Sun
Eryk Sun added the comment: Are you suggesting that the Helper class in Lib/pydoc.py should index [sub-]topics by special names such as "__slots__"? Currently you can see the __slots__ documentation via the topics "ATTRIBUTEMETHODS" and "SPECIALMETHODS". The lis

[issue29345] More lost updates with multiprocessing.Value and .Array

2017-01-22 Thread Eryk Sun
Eryk Sun added the comment: Change the last print to test the exit code, as follows: if p.exitcode != 0: print('Child failed with exit code:', p.exitcode) else: print(num.value) print(arr[:]) Note that when you fail to limit creating a new process t

[issue29345] More lost updates with multiprocessing.Value and .Array

2017-01-22 Thread Eryk Sun
Eryk Sun added the comment: >if p.exitcode != 0: >print('Child failed with exit code:', p.exitcode) Interestingly the exit code is always 1 when running under pythonw.exe. I just inspected what's going on by setting sys.stderr to a file and discovered

[issue29366] os.listdir has inconsistent behavior when run on a non-directory

2017-01-25 Thread Eryk Sun
Eryk Sun added the comment: Python appends "\*.*" to the path, so in the case in which the leaf element is a file, FindFirstFile naturally fails with ERROR_PATH_NOT_FOUND. Python 3.5+ could maybe switch to calling CreateFile to open a handle and GetFileInformationByHandleEx

[issue29366] os.listdir has inconsistent behavior when run on a non-directory

2017-01-26 Thread Eryk Sun
Eryk Sun added the comment: > FindFirstFile naturally fails with ERROR_PATH_NOT_FOUND Getting this error actually depends on the file system. I don't see it with NTFS, which returns STATUS_NOT_A_DIRECTORY, which gets translated to ERROR_DIRECTORY. On the other hand, VboxSF (VirtualBo

[issue29366] os.listdir has inconsistent behavior when run on a non-directory

2017-01-28 Thread Eryk Sun
Eryk Sun added the comment: Python has no specific use for ERROR_PATH_NOT_FOUND (3) and just maps it to FileNotFoundError -- like the CRT maps it to ENOENT. Even if we wanted listdir() to specially handle this error, given that it's implemented via FindFirstFile, there's nothing t

[issue29248] os.readlink fails on Windows

2017-01-29 Thread Eryk Sun
Eryk Sun added the comment: os.symlink calls CreateSymbolicLink, which creates the reparse data buffer with the print name stored first, so the offset is always 0. Otherwise we would have noticed this problem already. For example: >>> os.symlink('C:\\', 'link&#

[issue29391] Windows Defender finds trojan Spursint in Numpy for Py36 Win64

2017-01-30 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> third party stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue29391> ___ ___

[issue29392] msvcrt.locking crashes python

2017-01-30 Thread Eryk Sun
Eryk Sun added the comment: The old CRT doesn't do any parameter validation on the nbytes parameter. It just passes it directly to Windows LockFile as follows: LockFile((HANDLE)_get_osfhandle(fh), lockoffset, 0L, nbytes, 0L) which is locking (DWORD)-1 bytes, i.e. 0x. This a

[issue29392] msvcrt.locking crashes python

2017-01-30 Thread Eryk Sun
Changes by Eryk Sun : -- stage: -> needs patch versions: +Python 3.6, Python 3.7 ___ Python tracker <http://bugs.python.org/issue29392> ___ ___ Python-bugs-lis

[issue28164] _PyIO_get_console_type fails for various paths

2017-01-30 Thread Eryk Sun
Eryk Sun added the comment: I had reopened this issue with a suggestion for expanding the supported paths in msg276864, but it's languished for a while now. I've attached a patch implementing the change to _PyIO_get_console_type that I had suggested. Here are some example paths

[issue28164] _PyIO_get_console_type fails for various paths

2017-01-31 Thread Eryk Sun
Eryk Sun added the comment: I added some tests to ensure open() returns an instance of _WindowsConsoleIO for a few console paths. It also checks that opening a non-console file raises a ValueError, both for a path and an fd, as well for a negative file descriptor. -- Added file: http

[issue28164] _PyIO_get_console_type fails for various paths

2017-01-31 Thread Eryk Sun
Changes by Eryk Sun : Removed file: http://bugs.python.org/file46462/issue_28164_02.patch ___ Python tracker <http://bugs.python.org/issue28164> ___ ___ Python-bugs-list m

[issue28164] _PyIO_get_console_type fails for various paths

2017-01-31 Thread Eryk Sun
Changes by Eryk Sun : Added file: http://bugs.python.org/file46463/issue_28164_02.patch ___ Python tracker <http://bugs.python.org/issue28164> ___ ___ Python-bugs-list m

[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2017-01-31 Thread Eryk Sun
Eryk Sun added the comment: LoadLibraryEx with LOAD_WITH_ALTERED_SEARCH_PATH worked for me in Windows 10. I tested loading 64-bit python3.dll, for both 3.5 and 3.6, and getting the address of Py_Main. The DLLs were loaded from DLL35 and DLL36 subdirectories. It worked using both a relative

[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2017-01-31 Thread Eryk Sun
Eryk Sun added the comment: > Are you sure it really works on Windows 10? Neither the DLL35 nor DLL36 directory was set in PATH, nor any directory containing python3x.dll. Each of the latter two directories contained only the minimal set python3.dll, python3x.dll, and vcruntime140.dll. I

[issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior

2017-01-31 Thread Eryk Sun
Eryk Sun added the comment: I can confirm that LoadLibraryEx w/ LOAD_WITH_ALTERED_SEARCH_PATH unfortunately does not work in Windows 7. Actually I almost looked into this before on python-list: https://mail.python.org/pipermail/python-list/2016-September/thread.html#714622 but I got

[issue29409] Implement PEP 529 for io.FileIO

2017-01-31 Thread Eryk Sun
New submission from Eryk Sun: PEP 529 isn't implemented for io.FileIO, and I think it should be. If a UTF-8 path is passed to open(), it ends up calling C _open instead of decoding the path and calling C _wopen. Also, if a pathlike object is passed to io.FileIO, it calls PyUnicode_FSConv

[issue29409] Implement PEP 529 for io.FileIO

2017-01-31 Thread Eryk Sun
Changes by Eryk Sun : -- keywords: +patch Added file: http://bugs.python.org/file46473/issue_29409_01.patch ___ Python tracker <http://bugs.python.org/issue29

[issue29409] Implement PEP 529 for io.FileIO

2017-01-31 Thread Eryk Sun
Changes by Eryk Sun : -- stage: needs patch -> test needed ___ Python tracker <http://bugs.python.org/issue29409> ___ ___ Python-bugs-list mailing list Un

[issue29416] Path.mkdir can get into a recursive error loop

2017-02-01 Thread Eryk Sun
Eryk Sun added the comment: This case is similar to issue 29079. It should only attempt to make the parent to handle ENOENT if self and self.parent aren't equal. Here's the snippet from Path.mkdir: try: self._accessor.mkdir(self, mode) except FileExistsError:

[issue29426] Using pywin32 on Python3 on linux

2017-02-02 Thread Eryk Sun
Eryk Sun added the comment: I'm closing this as a third-party issue that's unrelated to the development of CPython. PyWin32 is a package of extension modules for accessing Windows C and COM APIs in Windows Python. You can't install it in Linux Python. You should be able to ac

[issue15451] PATH is not honored in subprocess.Popen in win32

2017-02-03 Thread Eryk Sun
Eryk Sun added the comment: > difference from the behaviour of Posix's execvpe() was deliberate POSIX doesn't define execvpe [1]. GNU glibc implemented it in 2009 [2]. On Windows, MSC has had execvpe and spawnvpe since at least 5.0 [3], and I think it arrived in 4.0 in 1986. G

[issue15451] PATH is not honored in subprocess.Popen in win32

2017-02-04 Thread Eryk Sun
Eryk Sun added the comment: Sure, let's close this in favor of the older documentation issue 8557. -- resolution: -> duplicate stage: needs patch -> resolved status: open -> closed superseder: -> subprocess PATH semantics and portability _

[issue8557] subprocess PATH semantics and portability

2017-02-04 Thread Eryk Sun
Changes by Eryk Sun : -- versions: +Python 3.5, Python 3.6, Python 3.7 -Python 2.6, Python 3.1, Python 3.2 ___ Python tracker <http://bugs.python.org/issue8

[issue15533] subprocess.Popen(cwd) documentation: Posix vs Windows

2017-02-04 Thread Eryk Sun
Eryk Sun added the comment: The Unix implementation of subprocess.Popen follows the behavior of os.execvpe, which is an outlier. Other execvpe implementations, such as the one added to glibc in 2009, search PATH in the current environment instead of the passed environment. As such, and given

[issue29443] Re-running Windows installer should have option to set PATH

2017-02-04 Thread Eryk Sun
Eryk Sun added the comment: The user is presented with 3 buttons: Back, Next, and Cancel. The "Next" button is the only way forward to modify the installation. Did you assume "Next" would start the modification rather than take you to another dialog with options? How ab

[issue28164] _PyIO_get_console_type fails for various paths

2017-02-05 Thread Eryk Sun
Eryk Sun added the comment: It's an ugly inconsistency that GetFullPathName fails for bare CONIN$ and CONOUT$ prior to Windows 8, in that it gives a different result from simply passing those names to CreateFile. Anyway, thanks for modifying it to work correctly in this case. We should

[issue29457] strftime('%x') does not use my locale

2017-02-05 Thread Eryk Sun
Eryk Sun added the comment: As Martin said, you need to set the LC_TIME category using an empty string to use the locale LC_* environment variables. Python 3 sets LC_CTYPE at startup (on Unix platforms only), but LC_TIME is left in the initial C locale: >>> locale.

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-08 Thread Eryk Sun
Eryk Sun added the comment: > it's not possible to tell by inspection the version of a Python > interpreter. If getting the version of python[w].exe is ever required, it should be simple for 3.5+, for which python[w].exe has standard file version information with the product v

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-08 Thread Eryk Sun
Eryk Sun added the comment: If the system doesn't have a "python3.exe" on PATH, then "env python3" will run a registered version, exactly like it currently does. IMO, this is slightly less confusing than the current behavior, which skips searching PATH in this ca

[issue29515] socket module missing IPPROTO_IPV6, IPPROTO_IPV4 on Windows

2017-02-09 Thread Eryk Sun
Eryk Sun added the comment: The macro is defined but not defined. If I insert the following line before the #ifdef check: #define IPPROTO_IPV6 IPPROTO_IPV6 then the constant gets added: >>> import _socket >>> _socket.IPPROTO_IPV6 41 The same applies t

[issue29515] socket module missing IPPROTO_IPV6, IPPROTO_IPV4 on Windows

2017-02-09 Thread Eryk Sun
Eryk Sun added the comment: Unless someone has a better (more automated) way to handle the Winsock IPPROTO enum, I suggest we either special-case the individual tests for MS_WINDOWS when we know that Winsock defines the value; or just define macros for the values in the enum: #ifdef

[issue29525] Python 2.7.13 for Windows broken (from prompt)

2017-02-10 Thread Eryk Sun
Eryk Sun added the comment: It doesn't appear to be a crash, but seems like the REPL is quitting because there's no input (e.g. like stdin is redirected to NUL). Echo %errorlevel%; it's probably 0. readline (pyreadline) is probably the culprit. Try the following she

[issue29561] Interactive mode gives sys.ps2 not sys.ps1 after comment-only line

2017-02-14 Thread Eryk Sun
Eryk Sun added the comment: For the tokenizer, a blank line is "[a] logical line that contains only spaces, tabs, formfeeds and possibly a comment" [1]. A blank line is normally ignored, except in the REPL an entirely blank line (i.e. no whitespace or comment) is used to end a

[issue22273] abort when passing certain structs by value using ctypes

2017-02-15 Thread Eryk Sun
Changes by Eryk Sun : -- priority: normal -> high versions: +Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <http://bugs.python.org/issue22273> ___ _

[issue22273] abort when passing certain structs by value using ctypes

2017-02-15 Thread Eryk Sun
Changes by Eryk Sun : -- stage: -> needs patch ___ Python tracker <http://bugs.python.org/issue22273> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue29565] Still broken ctypes calling convention on MSVC / 64-bit Windows (large structs)

2017-02-15 Thread Eryk Sun
Eryk Sun added the comment: Our support of passing structs and unions by value is really bad. Passing this particular struct by value is also broken on 64-bit Unix, but instead because it's small. It crashes Python due to an abort(). See issue 22273. -- nosy: +eryksun priority: n

[issue22273] abort when passing certain structs by value using ctypes

2017-02-15 Thread Eryk Sun
Eryk Sun added the comment: ctypes defines arrays as a pointer FFI type because they degenerate as pointers in C calls. But it's generally wrong to set a pointer FFI type for an array in the `elements` of a struct's FFI type. An integer array in a struct that's 16 bytes or

[issue29533] urllib2 works slowly with proxy on windows

2017-02-16 Thread Eryk Sun
Eryk Sun added the comment: gethostbyname_ex won't do a reverse lookup on an IP to get the fully-qualified domain name, which seems pointless for a function named getfqdn. I think calling gethostbyaddr is intentional here and goes back to the Python 1.x days. Also, FYI, socket_gethostb

[issue29583] Python 3.6 won't install on Windows 2012 R2

2017-02-16 Thread Eryk Sun
Eryk Sun added the comment: To install KB3118401 [3], you may first need to install KB2919442 [1] and KB2919355 [2]. The installation order would be as follows: KB2919442: Windows8.1-KB2919442-x64.msu KB2919355: clearcompressionflag.exe Windows8.1-KB2919355-x64.msu Windows8.1

[issue29586] Cannot run pip in fresh install of py 3.5.3

2017-02-17 Thread Eryk Sun
Eryk Sun added the comment: Please provide the complete traceback. Copy and paste it from the command prompt. Also, include the fully-qualified path for what "python" runs, e.g. run `where python` in the command prompt. Also, include the value of the environment variables PYTH

[issue29586] Cannot run pip in fresh install of py 3.5.3

2017-02-17 Thread Eryk Sun
Eryk Sun added the comment: That error looks like __init__.py[c] was left in "C:\python27\lib\site-packages\pip". Just to be sure, since I don't know what you did to clear the value, please run `set PYTHONPATH=` to clear the value for the current shell. Then try `python -m

[issue29583] Python 3.6 won't install on Windows 2012 R2

2017-02-17 Thread Eryk Sun
Eryk Sun added the comment: That's good news. As far as I can see, there isn't anything Python's installer can do if the CRT update fails for reasons beyond our control, so I'm closing this as a 3rd party issue. Thank you for the report. -- resolution:

[issue29586] Cannot run pip in fresh install of py 3.5.3

2017-02-17 Thread Eryk Sun
Eryk Sun added the comment: pip should be installed in site-packages, which for you is "C:\Python\Python35-32\Lib\site-packages". Try manually running ensurepip to make sure pip is installed: python -m ensurepip --verbose --upgrade --d

[issue29586] Cannot run pip in fresh install of py 3.5.3

2017-02-17 Thread Eryk Sun
Eryk Sun added the comment: If you have the 3.5 installation logs in your %TEMP% directory, please zip them up and attach them to this issue. -- ___ Python tracker <http://bugs.python.org/issue29

[issue29565] Still broken ctypes calling convention on MSVC / 64-bit Windows (large structs)

2017-02-17 Thread Eryk Sun
Eryk Sun added the comment: This issue is more straight-forward than #22273. ISTM, we just have to copy large values. For example, in ffi_call, we'd iterate over the arguments and alloca and memcpy the large values prior to calling ffi_call_AMD64: case FFI_SYSV: /* If a s

[issue29586] Cannot run pip in fresh install of py 3.5.3

2017-02-17 Thread Eryk Sun
Eryk Sun added the comment: The original install failed with the status code STATUS_DLL_NOT_FOUND (0xC135), as reported in "Python 3.5.3 (32-bit)_20170217102132_008_pip_JustForMe.log": MSI (s) (88:D8) [10:22:59:574]: Executing op: ActionStart(Name=UpdatePip,,) MSI (s) (

[issue22273] abort when passing certain structs by value using ctypes

2017-02-19 Thread Eryk Sun
Eryk Sun added the comment: Structs that are larger than 32 bytes get copied to the stack (see classify_argument in ffi64.c), so we don't have to worry about classifying their elements for register passing. Thus if a new field is added for this in StgDictObject, then PyCArrayType_new s

[issue22273] abort when passing certain structs by value using ctypes

2017-02-20 Thread Eryk Sun
Eryk Sun added the comment: classify_argument is in Modules/_ctypes/libffi/src/x86/ffi64.c. This file is for the 64-bit Unix ABI. libffi doesn't use it for 64-bit Windows. Some (all?) Linux distros link ctypes to the system libffi. In my experience, building 3.6 on Linux defaults t

[issue22273] abort when passing certain structs by value using ctypes

2017-02-20 Thread Eryk Sun
Eryk Sun added the comment: I see now why you couldn't find ffi64.c. I've been using a 3.6 worktree. The libffi sources have been removed from master. For the union and bitfield problem, also see the crash reported in #26628. -- ___ Pyth

[issue22273] abort when passing certain structs by value using ctypes

2017-02-21 Thread Eryk Sun
Eryk Sun added the comment: The 24-byte struct gets passed on the stack, as it should be. In this case ffi_call doesn't abort() because examine_argument returns 0, which is due to the following code in classify_argument: if (words > 2) { /* When size > 16 bytes, i

[issue22273] abort when passing certain structs by value using ctypes

2017-02-22 Thread Eryk Sun
Eryk Sun added the comment: Notes on fix-22273-02.diff: In the second pass over _fields_, you can (should) use dict->length and dict->proto for array types instead of the _length_ and _type_ attributes. When reassigning stgdict->ffi_type_pointer.elements, if use_broken_old_ctypes_

[issue22273] abort when passing certain structs by value using ctypes

2017-02-23 Thread Eryk Sun
Eryk Sun added the comment: > Perhaps you mean 16 rather than 8? Sorry, that was a misfire. It should be 16. -- ___ Python tracker <http://bugs.python.org/issu

[issue22273] abort when passing certain structs by value using ctypes

2017-02-23 Thread Eryk Sun
Eryk Sun added the comment: I had suggested inheriting the TYPEFLAG_NONARGTYPE flag in StructUnionType_new. It requires a minor change to get basedict unconditionally, and then assign if (basedict) dict->flags |= basedict->flags & TYPEFLAG_NONARGTYPE; We need more f

[issue22273] abort when passing certain structs by value using ctypes

2017-02-23 Thread Eryk Sun
Eryk Sun added the comment: > I'm not sure using this flag impacts on consistency with CFFI I meant consistency with respect to supported argument types. If someone contributed a workaround to CFFI, then I would rather port it, but it looks like they're also waiting for this to

[issue22273] abort when passing certain structs by value using ctypes

2017-02-23 Thread Eryk Sun
Eryk Sun added the comment: Perhaps it should instead use two specific flags, TYPEFLAG_HASBITFIELD and TYPEFLAG_HASUNION, which are propagated unconditionally from the base class and fields. As a base case, a union itself is flagged TYPEFLAG_HASUNION. Arrays are unrolled on X86_64 only if

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2017-02-24 Thread Eryk Sun
Eryk Sun added the comment: Nick wrote: > 1. Open the file in the current process > 2. Write content to the file > 3*. Close the file in the current process In step 1, do you mean calling NamedTemporaryFile with delete=False? In that case there's no immediate problem with op

[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2017-02-24 Thread Eryk Sun
Eryk Sun added the comment: Richard wrote: > while a handle is open with share mode X, you can only reopen > the file if you also use share mode X To clarify, the share mode is not a property of a handle. It's a property of a File object. A handle is a generic reference to any kin

[issue29702] Error 0x80070003: Failed to launch elevated child process

2017-03-02 Thread Eryk Sun
Eryk Sun added the comment: The error message is misleading. It happens that WiX is trying to run an elevated process (see the WiX functions CoreLaunchApprovedExe, CoreElevate, ElevationElevate, and PipeLaunchChildProcess). However, the actual error code has nothing to do with elevation

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Eryk Sun
Eryk Sun added the comment: All types are instances of `type`, so the single argument case makes sense to me as a 'constructor'. It always returns an instance of `type`, just not a new instance. >>> X = type('X', (type,), {}) >>> type(X)

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-30 Thread Eryk Sun
Eryk Sun added the comment: > why write `metatype == &PyType_Type` rather than > PyType_CheckExact(metatype)`? If only `type` should implement this special case, then it needs to be `metatype == &PyType_Type`. This was actually how it was implemented in 2.2a3: https://hg.pyth

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-30 Thread Eryk Sun
Eryk Sun added the comment: > Please treat this as a new feature (just in case) and only > apply it to 3.6. How about changing PyType_CheckExact to PyType_Check for 2.7 and 3.5? It solves the original problem by expanding the single-argument case to metaclasses that aren't an exa

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-30 Thread Eryk Sun
Changes by Eryk Sun : -- Removed message: http://bugs.python.org/msg266710 ___ Python tracker <http://bugs.python.org/issue27157> ___ ___ Python-bugs-list mailin

[issue27179] subprocess uses wrong encoding on Windows

2016-06-01 Thread Eryk Sun
Eryk Sun added the comment: There is no right encoding as far as I can see. If it's attached to a console (i.e. conhost.exe), then cmd.exe uses the console's output codepage when writing to a pipe or file, which is the scenario that your patch attempts to address. But i

[issue16192] ctypes - documentation example

2016-06-02 Thread Eryk Sun
Eryk Sun added the comment: > ``sizeof(long double) == sizeof(double)`` it is an alias to > :class:`c_double`. This should be "``sizeof(long) == sizeof(int)`` ... :class:`c_long`". -- resolution: fixed -> stage: resolved ->

[issue27184] Support path objects in the ntpath module

2016-06-02 Thread Eryk Sun
New submission from Eryk Sun: nt is the module name for posixmodule.c on Windows, so I'm changing the title to reference ntpath instead. Regarding nt, two of its built-in functions are exposed directly in ntpath. _isdir is imported as isdir, so it needs a wrapper to support __fspath__.

[issue27184] Support path objects in the ntpath module

2016-06-02 Thread Eryk Sun
Eryk Sun added the comment: Sorry, I must have missed or misunderstood something. PEP 519 discusses modifying os.path. For the os module it only discusses adding fspath and updating fsencode and fsdecode. It also discusses a new PyOS_FSPath C API, but without any discussion regarding its use

[issue27179] subprocess uses wrong encoding on Windows

2016-06-03 Thread Eryk Sun
Eryk Sun added the comment: > I would say almost all Windows console programs does use > console's encoding for input/output because otherwise > user wouldn't be able to read it. While some programs do use the console codepage, even when writing to a pipe or disk file

[issue27179] subprocess uses wrong encoding on Windows

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

[issue27179] subprocess uses wrong encoding on Windows

2016-06-03 Thread Eryk Sun
Eryk Sun added the comment: > I would say almost all Windows console programs does use > console's encoding for input/output because otherwise > user wouldn't be able to read it. While some programs do use the console codepage, even when writing to a pipe or disk file

[issue27179] subprocess uses wrong encoding on Windows

2016-06-04 Thread Eryk Sun
Eryk Sun added the comment: >> so ANSI is the natural default for a detached process > > To clarify - ANSI is the natural default *for programs that > don't support Unicode*. By natural, I meant in the context of using GetConsoleOutputCP(), since WideCharToMultiByte(0,

[issue27179] subprocess uses wrong encoding on Windows

2016-06-04 Thread Eryk Sun
Eryk Sun added the comment: Another set of counterexamples are the utilities in the GnuWin32 collection, which use ANSI in a pipe: >>> call('chcp.com') Active code page: 437 0 >>> 'ยก'.encode('1252') b'\xa1'

[issue27179] subprocess uses wrong encoding on Windows

2016-06-05 Thread Eryk Sun
Eryk Sun added the comment: > so if we default to UTF-8 it will be even worse than > defaulting to ANSI because there aren't many programs > on Windows which would use UTF-8 I didn't say subprocess should default to UTF-8. What I wish is for Python to default to using UTF

[issue27263] IDLE sets the HOME environment variable breaking scripts

2016-06-07 Thread Eryk Sun
Eryk Sun added the comment: This affects all Tkinter applications on Windows. For example, in Python 2.7: import Tkinter import ctypes libc = ctypes.CDLL('msvcr90') libc.getenv.restype = ctypes.c_char_p >>> libc.getenv(b"HOME&quo

[issue27264] python 3.4 vs. 3.5 strftime same locale different output on Windows

2016-06-08 Thread Eryk Sun
Eryk Sun added the comment: The universal CRT that's used by 3.5+ implements locales using Windows locale names [1], which were introduced in Vista. Examples for Spanish include 'es', 'es-ES', and 'es-ES_tradnl' . The latter is the traditional sort

[issue27268] Incorrect error message on float('')

2016-06-08 Thread Eryk Sun
Eryk Sun added the comment: > The message comes from Objects/floatobject.c:183 No, in this case the error is set in PyOS_string_to_double in Python/pystrtod.c, because `fail_pos == s`, and it doesn't get replaced in PyFloat_FromString because `end == last`. The format s

[issue27274] [ctypes] Allow from_pointer creation

2016-06-09 Thread Eryk Sun
Eryk Sun added the comment: Probably adding from_pointer is a good idea. That said, there's a simpler way to go about getting a bytes copy for a pointer. Say that you have a pointer p for the following array: >>> a = (c_float * 3)(1, 2, 3) >>> bytes(a) b&#x

[issue27264] python 3.4 vs. 3.5 strftime same locale different output on Windows

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

[issue27284] some new stuff

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

[issue27284] some new stuff

2016-06-10 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue27284> ___

[issue27305] Crash with "pip list --outdated" on Windows 10 with Python 2.7.12rc1

2016-06-13 Thread Eryk Sun
Eryk Sun added the comment: I get an access violation due to calling the ASN1_ITEM pointer as a function: > 810: ASN1_ITEM_ptr(method->it))); _ssl!_get_peer_alt_names+0x12a: 7ffe`17b1225a ffd0call

[issue27318] Add support for symlinks to zipfile

2016-06-14 Thread Eryk Sun
Eryk Sun added the comment: os.symlink needs the target_is_directory argument on Windows. Maybe extract() can search for the link target in namelist() to determine if it's a directory (i.e. ends in "/"). Note that the flag gets set automatically if the target exists, so this is

[issue27048] distutils._msvccompiler._get_vc_env() fails with UnicodeDecodeError if an env var is not encodable

2016-06-17 Thread Eryk Sun
Eryk Sun added the comment: vcvarsall.bat is mostly `set` and `echo` statements, which print using UTF-16LE with "/u". It also runs reg.exe, but with stdout and stderr redirected to nul, so that's no problem. The final `set` command prints cmd's UTF-16LE environment. U

<    13   14   15   16   17   18   19   20   21   22   >