[issue25803] pathlib.Path('/').mkdir() raises wrong error type

2015-12-05 Thread Eryk Sun
Changes by Eryk Sun : -- nosy: +pitrou versions: +Python 3.6 ___ Python tracker <http://bugs.python.org/issue25803> ___ ___ Python-bugs-list mailing list Unsub

[issue11361] suggestion for os.kill(pid,CTRL_C_EVENT) in tests

2015-12-05 Thread Eryk Sun
Eryk Sun added the comment: test_CTRL_C_EVENT can be removed from Lib/test/test_os.py. It's of no practical consequence. Ctrl+Break is always enabled in the child process, so test_CTRL_BREAK_EVENT should remain. When using CREATE_NEW_PROCESS_GROUP, the child process is started with C

[issue25492] subprocess with redirection fails after FreeConsole

2015-12-05 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> subprocess failing in GUI applications on Windows ___ Python tracker <http://bugs.python

[issue16458] subprocess.py throw "The handle is invalid" error on duplicating the STD_INPUT_HANDLE

2015-12-05 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> subprocess failing in GUI applications on Windows ___ Python tracker <http://bugs.python

[issue25815] Improper subprocess output of arguments with braces in them on windows

2015-12-06 Thread Eryk Sun
Eryk Sun added the comment: Using the cmd shell's "echo" command requires shell=True. You must have an "echo.exe" somewhere in your PATH. Check "where echo" in cmd. -- nosy: +eryksun ___ Python tracker

[issue25815] Improper subprocess output of arguments with braces in them on windows

2015-12-06 Thread Eryk Sun
Eryk Sun added the comment: AFAICT, there's no place where subprocess.Popen would be responsible for removing braces from the output. I think it's something unusual with the "echo.exe" program. In the cmd.exe shell -- i.e. no msys, bash, etc -- what do you get for the foll

[issue25824] 32-bit 2.7.11 installer creates registry keys that are incompatible with the installed python27.dll

2015-12-08 Thread Eryk Sun
Eryk Sun added the comment: Issue 24508 backported the project files from 3.5 to 2.7. In the new pyproject.props, MS_DLL_ID (for the DLL string table) is defined as the value of SysWinVer. Currently the latter is defined in python.props as follows: $(MajorVersionNumber

[issue23948] Deprecate os.kill() on Windows

2015-12-09 Thread Eryk Sun
Eryk Sun added the comment: The signal module switched to using an enum for signal values: >>> print(*map(repr, sorted(signal.Signals)), sep='\n') We can use the console API when passed the CTRL_C_EVENT or CTRL_BREAK_EVE

[issue25851] installing 3.5 on windows server 2003 x86 R2 Standard Edition Sp2 ENU,

2015-12-12 Thread Eryk Sun
Eryk Sun added the comment: It's the correct behavior. 3.5 supports all versions of Windows that had mainstream or extended support as of its release on 2015-09-13. Windows Server 2003 R2 extended support ended on 2015-07-14 [1]. [1]: https://support.microsoft.com/en-us/lifecycle/search

[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows

2015-12-21 Thread Eryk Sun
Eryk Sun added the comment: The ANSI API is problematic because it returns a best-fit encoding to the system codepage. For example: >>> os.listdir('.') ['ƠƨưƸǀLjǐǘǠǨǰǸ'] >>> os.listdir(b'.') [b'O?u?|?iu?Kj?'] To so

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-21 Thread Eryk Sun
Eryk Sun added the comment: > To extend support for this to Windows, we can add a > feature to mkstmp to not use O_TEMPORARY O_TEMPORARY is only used for NamedTemporaryFile, not mkstemp. Regarding NamedTemporaryFile, that can be worked around to keep Windows from deleting the file

[issue12797] io.FileIO and io.open should support openat

2015-12-22 Thread Eryk Sun
Eryk Sun added the comment: Марк, os.open added dir_fd support in 3.3, which is implemented on POSIX systems by calling openat. The dir_fd parameter is available for many os functions. This is discussed in section 1.5, Files and Directories [1]. It would be nice if we could support dir_fd on

[issue25930] os.unlink != os.remove in python3.5

2015-12-22 Thread Eryk Sun
Eryk Sun added the comment: This is due to using argument clinic in Modules/posixmodule.c: /*[clinic input] os.remove = os.unlink builtin_function_or_method instances are equal if m_self (the module in this case) and m_ml->ml_meth (the C function) are the same. In 3.4, the funct

[issue25931] os.fork() command distributed in windows Python27 (in SocketServer module)

2015-12-22 Thread Eryk Sun
Eryk Sun added the comment: Starting a Windows process is expensive. Who not use threading, e.g. SocketServer.ThreadingTCPServer? It seems to me that it's a bug to even define ForkingMixIn, ForkingTCPServer, and ForkingUDPServer on Windows. Those should be conditionally defined dependi

[issue25911] Regression: os.walk now using os.scandir() breaks bytes filenames on windows

2015-12-23 Thread Eryk Sun
Eryk Sun added the comment: Considering there's no plan to implement bytes paths for scandir on Windows, then the following line in the os docs needs to be modified: "All functions accepting path or file names accept both bytes and string objects, and result in an object of the sam

[issue25939] _ssl.enum_certificates() fails with ERROR_ACCESS_DENIED if python.exe run with low integrity level

2015-12-24 Thread Eryk Sun
Eryk Sun added the comment: psexec.exe can be run from the the live server. >>> subprocess.call(r'\\live.sysinternals.com\tools\psexec.exe -s whoami') PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich Sysinternals - www.sysint

[issue25954] Python 3.5.1 installer fails on Windows 7

2015-12-25 Thread Eryk Sun
Eryk Sun added the comment: The main log file reports that installing the CRT exited with the code ERROR_INSTALL_ALREADY_RUNNING (0x652): Another installation is already in progress. Complete that installation before proceeding with this install. You may need to completely

[issue25954] Python 3.5.1 installer fails on Windows 7

2015-12-26 Thread Eryk Sun
Eryk Sun added the comment: Packages are installed from the ProgramData folder on the system volume. For example, the log shows the CRT update executed as follows: "C:\Windows\system32\wusa.exe" "C:\ProgramData\Package Cache\ D4036846864773E3D647F421DFE7F6CA536E307B\

[issue25939] _ssl.enum_certificates() fails with ERROR_ACCESS_DENIED if python.exe run with low integrity level

2015-12-28 Thread Eryk Sun
Eryk Sun added the comment: Testing based on integrity level doesn't require creating a child process. I'm attaching a ctypes-based example that defines a context manager that temporarily sets the integrity level of the current thread's impersonation token. To get the imperso

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-30 Thread Eryk Sun
Eryk Sun added the comment: For anyone interested, this issue is solvable on Windows by working around how O_TEMPORARY is implemented. To do this the _winapi module would need a wrapper for SetFileInformationByHandle (available in Vista+), which would need to support at least

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-01 Thread Eryk Sun
Eryk Sun added the comment: The current test works for 3.x because we keep the full string length via PyUnicode_AsWideCharString(value, &len) when creating a REG_SZ value. OTOH, 2.x Py2Reg gets the length via strlen. I'd prefer to make this consistent with 3.x by using the full stri

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-01 Thread Eryk Sun
Changes by Eryk Sun : Added file: http://bugs.python.org/file41470/issue25778_py36_2.patch ___ Python tracker <http://bugs.python.org/issue25778> ___ ___ Python-bug

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-01 Thread Eryk Sun
Changes by Eryk Sun : Added file: http://bugs.python.org/file41469/issue25778_py27_1.patch ___ Python tracker <http://bugs.python.org/issue25778> ___ ___ Python-bug

[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-01 Thread Eryk Sun
Eryk Sun added the comment: I've added a patch for 2.7 that updates Py2Reg to use PyString_GET_SIZE instead of strlen and updates Reg2Py to use strnlen instead of returning strings with embedded NULs. -- ___ Python tracker <http://bugs.py

[issue25999] Add support of native number in bin()

2016-01-03 Thread Eryk Sun
Eryk Sun added the comment: bin() returns a Python literal, which thankfully requires an explicit sign. 2's complement literals would be prone to human error. If you want 2's complement, you can write your own function. For example: def mybin(number, nbits=None, *, s

[issue26004] pip install lifetimes - throwing error and unable to install packages

2016-01-05 Thread Eryk Sun
Eryk Sun added the comment: You can build NumPy with only a C compiler, but it won't have accelerated BLAS/LAPACK. However, lifetimes requires SciPy, which in turn requires Fortran. This is a common requirement with a lot of the scientific-computing stack, so you may as well choose a com

[issue26024] Non-ascii Windows locale names

2016-01-06 Thread Eryk Sun
Eryk Sun added the comment: PyLocale_setlocale in Modules/_localemodule.c is incorrectly passing the locale as a UTF-8 string ("z") instead of using the codepage of the current locale. As you can see below "å" is passed as the UTF-8 string "\xc3\xa5": >&g

[issue26024] Non-ascii Windows locale names

2016-01-06 Thread Eryk Sun
Eryk Sun added the comment: Yes, it's ANSI. I should have said "system locale" instead of "current locale". To find the requested locale, the CRT function __get_qualified_locale calls EnumSystemLocalesA. The passed callback calls GetLocaleInfoA for each enumerated

[issue26024] Non-ascii Windows locale names

2016-01-09 Thread Eryk Sun
Eryk Sun added the comment: The issue isn't quite the same for 3.5+. The new CRT uses Windows Vista locale APIs. In this case it uses LOCALE_SENGLISHLANGUAGENAME instead of the old LOCALE_SENGLANGUAGE. This maps "Norwegian" to simply "Norwegian" inst

[issue24823] ctypes.create_string_buffer does not add NUL if len(init) == size

2016-01-09 Thread Eryk Sun
Eryk Sun added the comment: I didn't want to change the function in lieu of breaking someone's code. If this change is accepted, then it at least needs a documentation note to indicate the new behavior. -- versions: +Python 3.6 -

[issue24823] ctypes.create_string_buffer does not add NUL if len(init) == size

2016-01-09 Thread Eryk Sun
Changes by Eryk Sun : -- components: +Documentation, Library (Lib) ___ Python tracker <http://bugs.python.org/issue24823> ___ ___ Python-bugs-list mailin

[issue26065] python embedded 3.5 amd64 crash when using venv

2016-01-09 Thread Eryk Sun
Eryk Sun added the comment: 0xC409 (3221226505) is STATUS_STACK_BUFFER_OVERRUN due to the CRT calling __fastfail(FAST_FAIL_FATAL_APP_EXIT) in abort(). This is expected behavior in Windows 8+ [1]. Initially I couldn't reproduce this error because Python found the standard library fro

[issue26071] bdist_wininst created binaries fail to start and find 32bit Pythons

2016-01-09 Thread Eryk Sun
Eryk Sun added the comment: I would call SetDllDirectory instead of changing the current directory. This replaces the current directory in the DLL search. Then call SetDllDirectory(NULL) to restore the default before returning. When you say "the CRT assembly", you'r

[issue26071] bdist_wininst created binaries fail to start and find 32bit Pythons

2016-01-09 Thread Eryk Sun
Eryk Sun added the comment: > We'd have to statically link python##.dll. I was talking about the partially static build that you used for wininst-14.0-amd64.exe in rc3, in which vcruntime is linked statically but ucrt is linked dynamically (actually to the api-ms-win-crt-* API sets)

[issue26071] bdist_wininst created binaries fail to start and find 32bit Pythons

2016-01-09 Thread Eryk Sun
Eryk Sun added the comment: Steve, I think I understand the linking problem now -- in terms of the bad assumption I mentioned in the previous message. Mark said the "built binary links against the DLL version of the CRT", but I just checked in 3.5.1 that you actually didn't swi

[issue26071] bdist_wininst created binaries fail to start and find 32bit Pythons

2016-01-10 Thread Eryk Sun
Eryk Sun added the comment: > why isn't the directory containing the loaded DLL searched > for dependencies? That's possible. The loader provides several ways to go about solving this problem. The directory of the DLL can be added to the search path if you use LoadLibrary

[issue26078] Python launcher options enhancement

2016-01-10 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Let launcher autoselect best 32-bit Python on 64-bit system ___ Python tracker <http://bugs.python

[issue25636] Let launcher autoselect best 32-bit Python on 64-bit system

2016-01-10 Thread Eryk Sun
Changes by Eryk Sun : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware versions: +Python 3.6 ___ Python tracker <http://bugs.python.org/issue25

[issue26083] ValueError: insecure string pickle in subprocess.Popen on Python 2

2016-01-11 Thread Eryk Sun
Eryk Sun added the comment: > I strongly recommend people use https://pypi.python.org/pypi/subprocess32/ I think this warrants a note that draws more attention to itself than the "see also" text. -- nosy: +eryksun ___ Python t

[issue26086] Bug in standardmodule os

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

[issue26086] Bug in standardmodule os

2016-01-11 Thread Eryk Sun
Eryk Sun added the comment: The "yield from" syntax was added in Python 3.3, so somehow you're using the 3.5 standard library with either an old 3.x or 2.x version. The older version shouldn't use 3.5's standard library, unless you have either PYTHONHOME or PYTH

[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-14 Thread Eryk Sun
Eryk Sun added the comment: Probably this is related to issue 25824. When built as a console application and run from the command prompt, you should see an the error ImportError: No module named site If that's the case, the problem is that even the 64-bit build is incorrectly settin

[issue26111] On Windows, os.scandir will keep a handle on the directory until the iterator is exhausted

2016-01-14 Thread Eryk Sun
Eryk Sun added the comment: If you own the only reference you can also delete the reference, which deallocates the iterator and closes the handle. Can you provide concrete examples where os.remove and os.chmod fail? At least in Windows 7 and 10 the directory handle is opened with the normal

[issue26111] On Windows, os.scandir will keep a handle on the directory until the iterator is exhausted

2016-01-14 Thread Eryk Sun
Eryk Sun added the comment: > That behavior on Windows is quite counterintuitive. It's counter-intuitive from a POSIX point of view, in which anonymous files are allowed. In contrast, Windows allows any existing reference to unset the delete disposition, so the name cannot be unlink

[issue26132] 2.7.11 Windows Installer issues on Win2008R2

2016-01-16 Thread Eryk Sun
Eryk Sun added the comment: Steve, is this something that can only be reproduced on Windows 7/2008 for some reason? My "just for me" installation on Windows 10 seems to work fine. I installed from "python-2.7.11.amd64.msi" with the MD5 sum 25acca42662d4b02682eee0df3f3446

[issue26151] str(bytes) does __repr__() instead of __str__()

2016-01-19 Thread Eryk Sun
Eryk Sun added the comment: > Bad feature, as it is a violation of POLA. I would be astonished if the default __str__ conversion returned a Latin-1 decoding, which won't fail, or used the locale encoding or UTF-8, which could fail. The more explicit call x.decode() uses UTF-8 as the

[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Eryk Sun
Eryk Sun added the comment: Serhiy, why doesn't truncate do a seek(0, SEEK_CUR) to synchronize the buffer's file pointer before calling its truncate method? This also affects writing in "+" modes when the two file pointers are out of sync. -

[issue26158] File truncate() not defaulting to current position as documented

2016-01-19 Thread Eryk Sun
Eryk Sun added the comment: FYI, you can parse the cookie using struct or ctypes. For example: class Cookie(ctypes.Structure): _fields_ = (('start_pos', ctypes.c_longlong), ('dec_flags', ctypes.c_int), ('byt

[issue26162] thread error

2016-01-20 Thread Eryk Sun
Eryk Sun added the comment: It's no surprise to see a memory error at 845 threads if you're using 32-bit Python, which is limited to 2 GiB of address space. python.exe is built with a default stack reservation of 200 bytes, so 845 threads reserve a total of about 1.58 GiB. Con

[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-22 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: not a bug -> duplicate superseder: -> 32-bit 2.7.11 installer creates registry keys that are incompatible with the installed python27.dll ___ Python tracker <http://bugs.python.org/i

[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

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

[issue26189] Interpreter returns control to cmd.exe early

2016-01-23 Thread Eryk Sun
Eryk Sun added the comment: Try forcing cmd to wait using the "start" command: C:\>start /b /w python -c "raise SystemExit(42)" C:\>echo %errorlevel% 42 -- nosy: +eryksun ___ Python tracker <http

[issue26189] Interpreter returns control to cmd.exe early

2016-01-25 Thread Eryk Sun
Eryk Sun added the comment: That the wait failed to get the 42 exit code means that the "python" command (which may not actually be python.exe) is spawning a child process to run the command and not waiting for it to exit. Please try the following using the absolute path to python.e

[issue26189] Interpreter returns control to cmd.exe early

2016-01-25 Thread Eryk Sun
Eryk Sun added the comment: By shortcut I'm guessing you mean a batch file. A regular .LNK shortcut works fine if .LNK is in PATHEXT. I sometimes use a shortcut when I need to set the default to "Run as administrator". (I add a "runas" verb to the ProgIds to add th

[issue26189] Interpreter returns control to cmd.exe early

2016-01-25 Thread Eryk Sun
Eryk Sun added the comment: > An .lnk is launched with ShellExecute which returns control > immediately upon successful launch cmd calls ShellExecuteEx, not ShellExecute, and it uses the flags SEE_MASK_NO_CONSOLE (0x8000, don't create a new console) and SEE_MASK_NOCLOSEPROCESS (0x0

[issue26225] New misleading wording in execution model documenation

2016-01-27 Thread Eryk Sun
Eryk Sun added the comment: The class example defines "i" as a local variable, which means the CPython operation used for unoptimized code (class or module/exec) is LOAD_NAME, which searches locals, globals, and builtins. The result differs from the exec example because a class i

[issue26227] Windows: socket.gethostbyaddr(name) fails for non-ASCII hostname

2016-01-28 Thread Eryk Sun
Eryk Sun added the comment: The patch is missing the "errors" parameter of PyUnicode_DecodeLocale. But it should call PyUnicode_DecodeMBCS instead. In the "C" locale, PyUnicode_DecodeLocale is Latin-1 because the CRT mbstowcs just casts the values to wchar_t. socket_getn

[issue26189] Interpreter returns control to cmd.exe early

2016-01-28 Thread Eryk Sun
Eryk Sun added the comment: Ensure that the .lnk target is the expected path to python.exe: C:\Temp>py -3 -c ^ More? "from win32com import client^ More? More? lnk = client.Dispatch('WScript.Shell').^ More? CreateShortCut('python.lnk')^ More?

[issue26241] repr() and str() are identical for floats in 3.5

2016-01-30 Thread Eryk Sun
Eryk Sun added the comment: > A test with a 100 million random and selected IEEE 64-bit values > returned no differences The float type's tp_str and tp_repr both call float_repr in Objects/floatobject.c. See the 3.5.1 PyFloat_Type definition [1]. Perhaps you were reading s

[issue21328] Resize doesn't change reported length on create_string_buffer()

2016-02-04 Thread Eryk Sun
Eryk Sun added the comment: You can't reassign the array object's __class__, and you can't modify the array type itself, so I think modifying the internal b_length field of the object is a confused result. Even if you ignore this confusion, it's still not as simple a

[issue21328] Resize doesn't change reported length on create_string_buffer()

2016-02-05 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> not a bug stage: patch review -> resolved ___ Python tracker <http://bugs.python.org/issue21328> ___ ___ Pyth

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

2016-02-10 Thread Eryk Sun
Eryk Sun added the comment: I'm closing this as a duplicate of issue 25717. Martin's patch fixes this problem since it's just another case of _Py_fstat failing for a valid file. In this case the problem is volume and disk files (e.g. r"\\.\C:" and r"\\.\Physi

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

2016-02-10 Thread Eryk Sun
Eryk Sun added the comment: > There is a problem with os.chdir(): It doesn't work with > \\?\ notation. The process current directory is part of the Windows API, so it's subject to the MAX_PATH limit [1]. See SetCurrentDirectory [2]. Python can't do anything about this.

[issue22121] IDLE should start with HOME as the initial working directory

2016-02-10 Thread Eryk Sun
Eryk Sun added the comment: > What we want seems to be a normal thing to do, and achieved by > some, but perhaps by a post installation script. It would help to have a couple of the bdist_wininst functions available for a post-install script: create_shortcut (CreateSh

[issue23606] ctypes.util.find_library("c") no longer makes sense

2016-02-11 Thread Eryk Sun
Eryk Sun added the comment: If the examples continue to use printf, then msvcrt.dll is the best option. The universal CRT exports a single Swiss-Army-knife function, __stdio_common_vfprintf, which requires 5 parameters, including a va_list for the variadic argument list. That'

[issue26345] Extra newline appended to UTF-8 strings on Windows

2016-02-12 Thread Eryk Sun
Eryk Sun added the comment: This a third-party problem due to bugs in the console's support for codepage 65001. For the general problem of Unicode in the console, see issue 1602. The best way to resolve this problem is by using the wide-character APIs, WriteConsoleW and ReadConsol

[issue26350] Windoes: signal doc should state certains signals can't be registered

2016-02-12 Thread Eryk Sun
Eryk Sun added the comment: All of the implemented signals can be registered, and the associated handler can at least be executed by calling the C raise() function. However, for pure-Python code only SIGINT and SIGBREAK are really useful. FYI, Windows doesn't implement POSIX signals a

[issue26361] lambda in dict comprehension is broken

2016-02-14 Thread Eryk Sun
Eryk Sun added the comment: For Python 3 you can also make it a keyword-only argument by adding a bare '*' to the parameter list: funcs = [(lambda x, *, t=t: x * t) for t in range(5)] Code that accidentally calls funcs[0](3, 'silent bug ') will raise a TypeError bec

[issue14597] Cannot unload dll in ctypes until script exits

2016-02-16 Thread Eryk Sun
Eryk Sun added the comment: > My setup.py creates a .dll then later loads the dll for testing > using ctypes. Subsequent runs of setup.py that would force > rebuilding the .dll attempt to delete the old dll first if it > exists, but I get permission denied. > > Oddly,

[issue14597] Cannot unload dll in ctypes until script exits

2016-02-16 Thread Eryk Sun
Eryk Sun added the comment: The _ctypes extension module provides dlclose on POSIX and FreeLibrary on Windows. For the reasons already stated in this issue, ctypes should not automatically call these functions, but maybe they should be documented and imported to the ctypes module instead of

[issue14597] Cannot unload dll in ctypes until script exits

2016-02-16 Thread Eryk Sun
Eryk Sun added the comment: As to not being able to delete a loaded DLL on Windows, a workaround that may help in some instances is to rename it to a temporary name on the same volume. This is useful for upgrading in place. If you have admin privileges you can even flag the renamed DLL to be

[issue20010] time.strftime('%z') didn't make +HHMM return in windows xp

2016-02-17 Thread Eryk Sun
Eryk Sun added the comment: %z works correctly in the new CRT that's used by 3.5: Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license&qu

[issue26385] the call of tempfile.NamedTemporaryFile fails and leaves a file on the disk

2016-02-18 Thread Eryk Sun
Eryk Sun added the comment: > Does the unlink() work on Windows? Yes. O_TEMPORARY opens the file with FILE_SHARE_DELETE, so unlink won't raise an error. Opening a file creates and returns a handle for a kernel File object that references the underlying file/link/stream control bloc

[issue26385] the call of tempfile.NamedTemporaryFile fails and leaves a file on the disk

2016-02-20 Thread Eryk Sun
Eryk Sun added the comment: > By your explanation, it sounds like it would be better > to call unlink() before close(). Sorry, I was responding in general, because I thought you meant unlink would fail like it would for most open files on Windows, because the CRT normally doesn't

[issue4928] Problem with tempfile.NamedTemporaryFile

2016-02-20 Thread Eryk Sun
Eryk Sun added the comment: Maybe a note could be added to suggest using a SIGTERM signal handler (e.g. the handler could raise a SIGTERM exception): POSIX: The file will not be deleted if the process is terminated abruptly by a signal. A process may register a SIGTERM handler to ensure that

[issue26400] SyntaxError when running Python 2.7 interpreter with subprocess.call

2016-02-21 Thread Eryk Sun
Eryk Sun added the comment: The error you're getting indicates that stdin is set to binary mode for some reason. You can see this using the -u command line option: C:\>py -2 -u Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32 Ty

[issue26400] SyntaxError when running Python 2.7 interpreter with subprocess.call

2016-02-21 Thread Eryk Sun
Eryk Sun added the comment: Your example worked fine for me with the official 64-bit distribution of 2.7.10 installed in "C:\Program Files\Python27" on Windows 10. I created a junction from "C:\Py27x64" to the 2.7 installation directory in order to run the example as pr

[issue26413] python 3.5.1 uses wrong registry in system-wide installation

2016-02-22 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Windows AllUsers installation places uninstaller in user profile ___ Python tracker <http://bugs.python

[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2016-02-24 Thread Eryk Sun
Eryk Sun added the comment: mmap.mmap(-1, 2**31 + 5) could be used here. If the pages are never touched it won't increase the working set size. It merely maps the address range with demand-zero pages. Unpatched: >>> mmap.mmap(-1, 2**31 + 5).__len__() -21474

[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2016-02-24 Thread Eryk Sun
Eryk Sun added the comment: > the sq_length slot in the weakproxy type is set to proxy_length. Nice. Its tp_getattro gets in the way of using __len__ directly, but this can be side stepped by manually binding the descriptor: class Test(object): def __len__(s

[issue26429] os.path.dirname returns empty string instead of "." when file is in current directory

2016-02-24 Thread Eryk Sun
Eryk Sun added the comment: os.path.dirname is documented as the first element of os.path.split, which in turn is documented to be empty when there's no slash in the path. An empty string is treated as the current directory by os.path.abspath. This is in line with an empty element i

[issue26428] The range for xrange() is too narrow on Windows 64-bit

2016-02-24 Thread Eryk Sun
Eryk Sun added the comment: > xrange() still functions if you give it a value larger than `long` What do you mean? Did you mean to write range() instead of xrange()? Both range and xrange in Python 2 use a C long for the start, stop, step, and length values. With how they get used t

[issue26428] The range for xrange() is too narrow on Windows 64-bit

2016-02-24 Thread Eryk Sun
Eryk Sun added the comment: > No, I meant to write xrange(). My point is there is no crasher > if this change didn't occur. Oh, by 'still functions' you meant that it doesn't cause an access violation that crashes the process, as opposed to raising an Overflow

[issue26415] Out of memory, trying to parse a 35MB dict

2016-02-25 Thread Eryk Sun
Eryk Sun added the comment: I don't think this is Windows related. Are you using 32-bit Python? On Linux, if I limit the process address space to 2 gigs, it crashes almost immediately: $ ulimit -v 200 $ python-dbg -c 'import crash' Segmentation fault It run

[issue26415] Out of memory, trying to parse a 35MB dict

2016-02-25 Thread Eryk Sun
Eryk Sun added the comment: > My Python is 64-bit, but my computer only has 2GB physical RAM. That explains why it takes half an hour to crash. It's thrashing on page faults. Adding another paging file or increasing the size of your current paging file should allow this to finish

[issue26447] rstrip() is pilfering my 'p'

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

[issue26464] str.translate() unexpectedly duplicates characters

2016-03-01 Thread Eryk Sun
Changes by Eryk Sun : -- versions: +Python 3.6 ___ Python tracker <http://bugs.python.org/issue26464> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26464] str.translate() unexpectedly duplicates characters

2016-03-01 Thread Eryk Sun
Eryk Sun added the comment: It duplicates translated characters as well. For example: >>> table = str.maketrans('mnopqrb', 'rqponm\u0100', 'a') >>> 'aamnopqrb'.translate(table) 'rqponmrqponmĀ' 3.4 returns t

[issue26493] Bad formatting in WinError 193 when using subprocess.check_call

2016-03-06 Thread Eryk Sun
Eryk Sun added the comment: When Python creates an exception generically from a Windows error code, it calls WinAPI FormatMessage with the flag FORMAT_MESSAGE_IGNORE_INSERTS. The reason for this is explained in a blog post written by Raymond Chen[1]: "when you are not in control o

[issue26493] Bad formatting in WinError 193 when using subprocess.check_call

2016-03-07 Thread Eryk Sun
Eryk Sun added the comment: It would be possible for subprocess to replace "%1" with the filename parsed from the command line and then re-raise the exception. That said, it's not as if this is a deficiency in the Windows implementation relative to subprocess on POSIX. For exa

[issue26514] Object defines '__ne__' as 'not __eq__' if '__ne__' is not implemented

2016-03-08 Thread Eryk Sun
Changes by Eryk Sun : -- resolution: -> works for me stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue26514> ___ ___

[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2016-03-11 Thread Eryk Sun
Eryk Sun added the comment: This problem has come up in several issues now (see issue 25376 and issue 26531). I'm adding a patch for Python 3.6 to call ReadConsoleA instead of fgets in PyOS_Readline. This fixes Ctrl+C and EOF handling in Windows 10 for both the interactive shell and the

[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2016-03-11 Thread Eryk Sun
Eryk Sun added the comment: Background Discussion The Windows 10 console uses the condrv.sys device driver, which is set up as follows in the NT namespace: C:\>odir \ -r -n con;con*$;cond* Directory of \ Device ConDrv Driver condrv GLOBAL??

[issue23606] ctypes.util.find_library("c") no longer makes sense

2016-03-12 Thread Eryk Sun
Eryk Sun added the comment: I occasionally come across code snippets on Stack Overflow, and projects such as win-unicode-console (IIRC), that use ctypes to work with C stdio FILE streams (sometimes for dubious reasons, such as a DLL API that uses FILE streams). Maybe the _ctypes extension

[issue19914] help([object]) returns "Not enough memory." on standard Python types, object and object functions

2016-03-15 Thread Eryk Sun
Eryk Sun added the comment: For posterity for anyone that finds this old issue, I investigated this problem in the debugger in Windows 7. It turns out that more.com (the pager used by Python's help) calls MultiByteToWideChar [1] with dwFlags passed as MB_PRECOMPOSED (1), which is forb

[issue26596] numpy.all np.all .all

2016-03-20 Thread Eryk Sun
Eryk Sun added the comment: NumPy is not part of Python's standard library, so this is a 3rd party problem. However, please don't waste the time of the NumPy developers with this. You either haven't read the documentation or have misread it. numpy.all [1] is an AND red

[issue26630] Windows EXE extension installers not finding 32bit Python 3.5 installation

2016-03-23 Thread Eryk Sun
Changes by Eryk Sun : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> bdist_wininst created binaries fail to start and find 32

[issue26632] __all__ decorator

2016-03-24 Thread Eryk Sun
Eryk Sun added the comment: > work off its __name__ and __module__ Why is __module__ required? It seems to me this should only operate on the current module. I added a prototype to Python/bltinmodule.c that gets or creates the __all__ list from the current globals (i.e. PyEval_GetGlob

[issue26628] Undefined behavior calling C functions with ctypes.Union arguments

2016-03-24 Thread Eryk Sun
Eryk Sun added the comment: > I would strongly argue to generally prohibit this > with an exception I agree. A warning in the tutorial isn't sufficient. ctypes should raise an error when setting a union or bitfield struct type in argtypes or when passing one by value. Here's

[issue26565] [ctypes] Add value attribute to non basic pointers.

2016-03-24 Thread Eryk Sun
Eryk Sun added the comment: The `value` of a c_char_p or c_wchar_p pointer is a Python bytes or str object. Since `value` won't consistently be the address value, it may be better to introduce a read-only `as_void` attribute that can be implemented consistently for all pointer

<    15   16   17   18   19   20   21   22   >