From report at bugs.python.org Thu Nov 1 00:31:09 2018 From: report at bugs.python.org (MasterZ) Date: Thu, 01 Nov 2018 04:31:09 +0000 Subject: [New-bugs-announce] [issue35130] add same file name to zipfile , result two files and same md5 Message-ID: <1541046669.26.0.788709270274.issue35130@psf.upfronthosting.co.za> New submission from MasterZ : step 1.I have one file named "1",then add this file to zipfile A.zip step 2.then I have another file named "1" too but different content, and add this file to zipfile A.zip result:in the A.zip exist 2 files both named "1" and both of their md5 is the name with step2's file ---------- components: IO files: a.py messages: 329041 nosy: MasterZ priority: normal severity: normal status: open title: add same file name to zipfile ,result two files and same md5 type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47898/a.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 1 05:56:37 2018 From: report at bugs.python.org (Valentin Zhao) Date: Thu, 01 Nov 2018 09:56:37 +0000 Subject: [New-bugs-announce] [issue35131] Cannot access to customized paths within .pth file Message-ID: <1541066197.73.0.788709270274.issue35131@psf.upfronthosting.co.za> New submission from Valentin Zhao : I want to manage all the packages that I installed so every time adding package I set "--target" so the package will be downloaded there. Then I wrote the directory in a .pth file which is located in "/Python36/Lib/site-packages" so I could still get accessed to all the packages even though they are not located within "Python36" folder. However, my current user name of Windows is a Chinese name, which means the customized path I mentioned before has Chinese characters within it, thus the .pth file will be also encoded with 'gbk'. Every time I would like to import these packages will get "UnicodeDecodeError: 'gbk' can't decode byte xxx...". Fortunately I have found the reason and cracked the problem: python read .pth files without setting any encoding. The code is located in "Python36/Lib/site.py" def addpackage(sitedir, name, known_paths): if known_paths is None: known_paths = _init_pathinfo() reset = True else: reset = False fullname = os.path.join(sitedir, name) try: # here should set the second param as encoding='utf-8' f = open(fullname, "r") except OSError: return # other codes And after I doing this, everything goes well. ---------- components: Library (Lib) files: IMG_20181101_173328_[B at ae031df.jpg messages: 329050 nosy: Valentin Zhao priority: normal severity: normal status: open title: Cannot access to customized paths within .pth file type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47899/IMG_20181101_173328_[B at ae031df.jpg _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 1 06:40:19 2018 From: report at bugs.python.org (Dylan Cali) Date: Thu, 01 Nov 2018 10:40:19 +0000 Subject: [New-bugs-announce] [issue35132] python-gdb error: Python Exception Type does not have a target Message-ID: <1541068819.38.0.788709270274.issue35132@psf.upfronthosting.co.za> New submission from Dylan Cali : Python version: 3.6.6-debug System: Kernel: 4.15.0-38-generic x86_64 Distro: Linux Mint 18.2 Sonya CPU: Quad core Intel Xeon E3-1505M Memory: 32018.6MB Expected: py-list and py-bt to print the current python frame and traceback when attaching to a hung python process with gdb, a debug build of python, and cpython/Tools/gdb/libpython.py loaded. Actual: py-list and py-bt fail with: Python Exception Type does not have a target.: Error occurred in Python command: Type does not have a target. Invoking 'set python print-stack full' in gdb produces the more useful: Traceback (most recent call last): File "", line 1, in File "~/git/cpython/Tools/gdb/libpython.py", line 916, in filename File "~/git/cpython/Tools/gdb/libpython.py", line 1158, in proxyval RuntimeError: Type does not have a target. so it is failing at: fields = gdb.lookup_type('PyUnicodeObject').target().fields() in libpython.py [1]. Reproduce: I haven't been able to create a simple standalone program that triggers the failure. I am working on a PR for Keras to try and fix the multiprocessing support in some of their utility classes. Currently the tests are sporadically hanging and my intention was to use python's gdb integration to identify exactly where and why the hangs are occuring... but I can't get that information at the moment because of the error above when invoking py-list and py-bt. So, unfortunately, the shortest path to reproduce is to checkout the PR branch, run the offending tests, connect with gdb, and invoke py-list/py-bt: * install a debug version of 3.6.6 if one isn't already available * git clone https://github.com/calid/keras.git -b fix-multiprocessing-hang * cd keras * pip install -e .[tests] * pip install tensorflow * py.test tests/keras/utils/data_utils_test.py * wait for hang * gdb -p * invoke py-list or py-bt I am happy to poke around in libpython.py and try to fix/submit a PR myself, but I'm not at all familiar with the python internals so I would need some guidance. And obviously let me know if this isn't actually a bug but rather environment related/user error. Thank you! [1] https://github.com/python/cpython/blob/v3.6.6/Tools/gdb/libpython.py#L1158 ---------- components: Demos and Tools messages: 329052 nosy: Dylan Cali priority: normal severity: normal status: open title: python-gdb error: Python Exception Type does not have a target type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 1 08:35:09 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 01 Nov 2018 12:35:09 +0000 Subject: [New-bugs-announce] [issue35133] Bugs in concatenating string literals on different lines Message-ID: <1541075709.76.0.788709270274.issue35133@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The following PR fixes many bugs related to concatenating string literals on different lines. There are two kinds of errors: 1. Missed space. The first line is ended with a word, and the second line is started with a word. When they are concatenated, there is no space between words. This is the same issue as issue35128, but not only in warning messages, and not only in Python. 2. Missed comma in a list of string literals. This leads to concatenating the last string in the first line and the first list in the second line. ---------- components: Library (Lib) messages: 329059 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Bugs in concatenating string literals on different lines type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 1 08:46:49 2018 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Nov 2018 12:46:49 +0000 Subject: [New-bugs-announce] [issue35134] Move Py_LIMITED_API to Include/pycapi/ Message-ID: <1541076409.33.0.788709270274.issue35134@psf.upfronthosting.co.za> New submission from STINNER Victor : The PEP 384 "Defining a Stable ABI" introduced Py_LIMITED_API define to exclude functions from the Python C API. The problem is when a new API is introduced, it has to explicitly be excluded using "#ifndef Py_LIMITED_API". If the author forgets it, the function is added to be stable API by mistake. I propose to move the API which should be excluded from the stable ABI to a new subdirectory: Include/pycapi/. To not break the backward compatibility, I propose to automatically include new header files from existing header files. For example, Include/pycapi/pyapi_objimpl.h would be automatically included by Include/pycapi/pycapi_objimpl.h. New header files would have a "pycapi_" prefix to avoid conflict Include/ header files, if Include/pycapi/ directory is in the header search paths. This change is a follow-up of bpo-35081 which moved Py_BUILD_CORE code to Include/internal/. It is also part of a larger project to cleanup the C API, see: * https://pythoncapi.readthedocs.io/split_include.html * https://pythoncapi.readthedocs.io/ The change is backward compatible: #include will still provide exactly the same API. ---------- components: Interpreter Core messages: 329060 nosy: vstinner priority: normal severity: normal status: open title: Move Py_LIMITED_API to Include/pycapi/ versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 1 10:09:14 2018 From: report at bugs.python.org (Pedro) Date: Thu, 01 Nov 2018 14:09:14 +0000 Subject: [New-bugs-announce] [issue35135] pip install --download option does not exist Message-ID: <1541081354.04.0.788709270274.issue35135@psf.upfronthosting.co.za> New submission from Pedro : https://pip.pypa.io/en/stable/user_guide/#installing-from-local-packages states that you can use a --directory option with the install subcommand. This fails with pip 18.1 on both Python 2.7 on SLES12 and Python 3.6 on Windows 10: ========== pip install --download my_dir -r reqs.txt Usage: pip install [options] [package-index-options] ... pip install [options] -r [package-index-options] ... pip install [options] [-e] ... pip install [options] [-e] ... pip install [options] ... no such option: --download ---------- assignee: docs at python components: Documentation messages: 329069 nosy: docs at python, pgacv2 priority: normal severity: normal status: open title: pip install --download option does not exist type: behavior versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 1 10:19:22 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Thu, 01 Nov 2018 14:19:22 +0000 Subject: [New-bugs-announce] [issue35136] test_ssl fails in AMD64 FreeBSD CURRENT Shared 3.6 buildbot Message-ID: <1541081962.85.0.788709270274.issue35136@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : https://buildbot.python.org/all/#/builders/172/builds/40/steps/4/logs/stdio ====================================================================== ERROR: test_ciphers (test.test_ssl.SimpleBackgroundTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1672, in test_ciphers s.connect(self.server_addr) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1109, in connect self._real_connect(addr, False) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1100, in _real_connect self.do_handshake() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1077, in do_handshake self._sslobj.do_handshake() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 689, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [Errno 54] Connection reset by peer Stdout: server: new connection from ('127.0.0.1', 12982) server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256) server: selected protocol is now None Test server failure: Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1938, in run msg = self.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1915, in read return self.sslconn.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 874, in read return self._sslobj.read(len, buffer) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 633, in read v = self._sslobj.read(len) ConnectionResetError: [Errno 54] Connection reset by peer ====================================================================== ERROR: test_connect (test.test_ssl.SimpleBackgroundTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1497, in test_connect s.connect(self.server_addr) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1109, in connect self._real_connect(addr, False) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1100, in _real_connect self.do_handshake() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1077, in do_handshake self._sslobj.do_handshake() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 689, in do_handshake self._sslobj.do_handshake() BrokenPipeError: [Errno 32] Broken pipe Stdout: server: new connection from ('127.0.0.1', 12985) server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256) server: selected protocol is now None Test server failure: Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1938, in run msg = self.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1915, in read return self.sslconn.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 874, in read return self._sslobj.read(len, buffer) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 633, in read v = self._sslobj.read(len) ConnectionResetError: [Errno 54] Connection reset by peer ====================================================================== ERROR: test_connect_cadata (test.test_ssl.SimpleBackgroundTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1614, in test_connect_cadata s.connect(self.server_addr) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1109, in connect self._real_connect(addr, False) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1100, in _real_connect self.do_handshake() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1077, in do_handshake self._sslobj.do_handshake() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 689, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [Errno 54] Connection reset by peer Stdout: server: new connection from ('127.0.0.1', 12988) server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256) server: selected protocol is now None Test server failure: Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1938, in run msg = self.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1915, in read return self.sslconn.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 874, in read return self._sslobj.read(len, buffer) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 633, in read v = self._sslobj.read(len) ConnectionResetError: [Errno 54] Connection reset by peer ====================================================================== ERROR: test_connect_capath (test.test_ssl.SimpleBackgroundTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1593, in test_connect_capath s.connect(self.server_addr) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1109, in connect self._real_connect(addr, False) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1100, in _real_connect self.do_handshake() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1077, in do_handshake self._sslobj.do_handshake() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 689, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [Errno 54] Connection reset by peer Stdout: server: new connection from ('127.0.0.1', 12991) server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256) server: selected protocol is now None Test server failure: Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1938, in run msg = self.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1915, in read return self.sslconn.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 874, in read return self._sslobj.read(len, buffer) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 633, in read v = self._sslobj.read(len) ConnectionResetError: [Errno 54] Connection reset by peer ====================================================================== ERROR: test_connect_with_context (test.test_ssl.SimpleBackgroundTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1555, in test_connect_with_context s.connect(self.server_addr) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1109, in connect self._real_connect(addr, False) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1100, in _real_connect self.do_handshake() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1077, in do_handshake self._sslobj.do_handshake() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 689, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [Errno 54] Connection reset by peer Stdout: server: new connection from ('127.0.0.1', 12998) server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256) server: selected protocol is now None Test server failure: Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1938, in run msg = self.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1915, in read return self.sslconn.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 874, in read return self._sslobj.read(len, buffer) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 633, in read v = self._sslobj.read(len) ConnectionResetError: [Errno 54] Connection reset by peer test test_ssl failed ====================================================================== ERROR: test_get_server_certificate (test.test_ssl.SimpleBackgroundTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1659, in test_get_server_certificate _test_get_server_certificate(self, *self.server_addr, cert=SIGNING_CA) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1819, in _test_get_server_certificate pem = ssl.get_server_certificate((host, port), ca_certs=cert) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 1231, in get_server_certificate with create_connection(addr) as sock: File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/socket.py", line 724, in create_connection raise err File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/socket.py", line 713, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 61] Connection refused Stdout: server: new connection from ('127.0.0.1', 13007) server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256) server: selected protocol is now None Test server failure: Traceback (most recent call last): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1938, in run msg = self.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_ssl.py", line 1915, in read return self.sslconn.read() File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 874, in read return self._sslobj.read(len, buffer) File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/ssl.py", line 633, in read v = self._sslobj.read(len) ConnectionResetError: [Errno 54] Connection reset by peer ---------------------------------------------------------------------- ---------- assignee: christian.heimes components: SSL, Tests messages: 329070 nosy: christian.heimes, koobs, pablogsal priority: normal severity: normal status: open title: test_ssl fails in AMD64 FreeBSD CURRENT Shared 3.6 buildbot versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 1 12:43:59 2018 From: report at bugs.python.org (Anthony Sottile) Date: Thu, 01 Nov 2018 16:43:59 +0000 Subject: [New-bugs-announce] [issue35137] Exception in isinstance when __class__ property raises Message-ID: <1541090639.85.0.788709270274.issue35137@psf.upfronthosting.co.za> New submission from Anthony Sottile : This may be intentional, but the behaviour changed between python2 and python3. Want to make sure it's intentional as we're working (hacking) around this in pytest: https://github.com/pytest-dev/pytest/pull/4284 The actual impact on pytest is the use of `inspect.isclass` Simplest reproduction: class C(object): @property def __class__(self): raise AssertionError('fail') isinstance(C(), type) In python2.x: $ python2 t.py $ In python 3.x: $ python3.7 t.py Traceback (most recent call last): File "t.py", line 6, in isinstance(C(), type) File "t.py", line 4, in __class__ raise AssertionError('fail') AssertionError: fail In python2.x it appears there's code which intentionally avoids this case: https://github.com/python/cpython/blob/ca079a3ea30098aff3197c559a0e32d42dda6d84/Objects/abstract.c#L2906-L2909 Mostly want to see if this is intentional or not, it does feel odd that `inspect.isclass` raises instead of returning `False` in this case, but it's unclear if it's a problem with `isclass` or `isinstance` ---------- components: Library (Lib) messages: 329078 nosy: Anthony Sottile priority: normal severity: normal status: open title: Exception in isinstance when __class__ property raises type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 1 12:45:34 2018 From: report at bugs.python.org (davidak) Date: Thu, 01 Nov 2018 16:45:34 +0000 Subject: [New-bugs-announce] [issue35138] timeit documentation should have example with function arguments Message-ID: <1541090734.49.0.788709270274.issue35138@psf.upfronthosting.co.za> New submission from davidak : It is described here: https://www.pythoncentral.io/time-a-python-function/ I have just tested it. Works as expected. Best would be if timeit supports this natively. ---------- assignee: docs at python components: Documentation messages: 329079 nosy: davidak, docs at python priority: normal severity: normal status: open title: timeit documentation should have example with function arguments versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 1 17:56:10 2018 From: report at bugs.python.org (Maxime Belanger) Date: Thu, 01 Nov 2018 21:56:10 +0000 Subject: [New-bugs-announce] [issue35139] Statically linking pyexpat in Modules/Setup fails to compile on macOS Message-ID: <1541109370.92.0.788709270274.issue35139@psf.upfronthosting.co.za> New submission from Maxime Belanger : Uncommenting the following line in `Modules/Setup` leads to a compiler error on macOS (tested w/ Xcode 10): ``` ./Modules/expat/xmlparse.c:92:3: error: You do not have support for any sources of high quality entropy enabled. For end user security, that is probably not what you want. Your options include: * Linux + glibc >=2.25 (getrandom): HAVE_GETRANDOM, * Linux + glibc <2.25 (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, * BSD / macOS >=10.7 (arc4random_buf): HAVE_ARC4RANDOM_BUF, * BSD / macOS <10.7 (arc4random): HAVE_ARC4RANDOM, * libbsd (arc4random_buf): HAVE_ARC4RANDOM_BUF + HAVE_LIBBSD, * libbsd (arc4random): HAVE_ARC4RANDOM + HAVE_LIBBSD, * Linux / BSD / macOS (/dev/urandom): XML_DEV_URANDOM * Windows (RtlGenRandom): _WIN32. If insist on not using any of these, bypass this error by defining XML_POOR_ENTROPY; you have been warned. If you have reasons to patch this detection code away or need changes to the build system, please open a bug. Thank you! ``` I believe this is due to `setup.py` being out of sync with `Modules/Setup`, which defines `XML_POOR_ENTROPY`. I'll attach a patch that resolves the issue for me. ---------- components: Build, Extension Modules, macOS messages: 329089 nosy: Maxime Belanger, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Statically linking pyexpat in Modules/Setup fails to compile on macOS type: compile error versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 1 22:34:13 2018 From: report at bugs.python.org (=?utf-8?b?5a6J6L+3?=) Date: Fri, 02 Nov 2018 02:34:13 +0000 Subject: [New-bugs-announce] [issue35141] encoding problem: gbk Message-ID: <1541126053.67.0.788709270274.issue35141@psf.upfronthosting.co.za> New submission from ?? : Windows10x64 Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 ---------- components: Windows files: encoding_problem_gbk.py messages: 329099 nosy: anmikf, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: encoding problem: gbk type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file47902/encoding_problem_gbk.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 2 01:03:45 2018 From: report at bugs.python.org (Daniel Lovell) Date: Fri, 02 Nov 2018 05:03:45 +0000 Subject: [New-bugs-announce] [issue35142] html.entities.html5 should require a trailing semicolon Message-ID: <1541135025.26.0.788709270274.issue35142@psf.upfronthosting.co.za> New submission from Daniel Lovell : html.entities.html5 keys should either require a trailing semicolon. The Python docs say: html.entities.html5 "A dictionary that maps HTML5 named character references [1] to the equivalent Unicode character(s), e.g. html5['gt;'] == '>'. Note that the trailing semicolon is included in the name (e.g. 'gt;'), however some of the names are accepted by the standard even without the semicolon: in this case the name is present with and without the ';'. See also html.unescape()." https://docs.python.org/3/library/html.entities.html?highlight=html However, it is not clear without looking at the source which keys require the semicolon and which do not. Taking a look at the source, the number which require a trailing semicolon vastly outnumber the others. For simplicity and continuity with the w3.org standard HTML5 Character Entity Reference Chart - I recommend that the trailing semicolon be required. As they are in HTML5: https://dev.w3.org/html5/html-author/charref My recommendation could then be extrapolated to say we should require the ampersand as HTML5 does, but I don't think this revision should be taken this far unless others agree. ---------- components: Library (Lib) messages: 329105 nosy: daniellovell priority: normal severity: normal status: open title: html.entities.html5 should require a trailing semicolon type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 2 04:28:53 2018 From: report at bugs.python.org (Kay Hayen) Date: Fri, 02 Nov 2018 08:28:53 +0000 Subject: [New-bugs-announce] [issue35143] Annotations future requires unparse, but not accessible from Pythpn Message-ID: <1541147333.05.0.788709270274.issue35143@psf.upfronthosting.co.za> New submission from Kay Hayen : Hello, in trying to know what to put into "__annotations__" at run time, the "from __future__ import annotations" pose a new problem. It is now necessary to "unparse" to ast code that is still there. Code to do so, is in C API "_PyAST_ExprAsUnicode", but won't work with the Python level ast objects. I have a kludge, using "compile" and "exec", to get past that. It's pretty ugly to do it like this, and Nuitka cannot be alone in trying to predict the value of "__annotations__". This code is my "ast.unparse" replacement: def unparse(node): _host_node = ast.parse("x:1") _host_node.body[0].annotation = node r = compile(_host_node, "", "exec", 1048576, dont_inherit = True) # Using exec here, to compile the ast node tree back to string, # there is no accessible "ast.unparse", and this works as a hack # to convert our node to a string annotation, pylint: disable=exec-used m = {} exec(r, m) return m["__annotations__"]['x'] I am caching "_host_node" in the real code. Having a real "ast.unparse" would be better however. It seems that the building blocks are all there, just not in that form. Yours, Kay ---------- messages: 329114 nosy: kayhayen priority: normal severity: normal status: open title: Annotations future requires unparse, but not accessible from Pythpn type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 2 04:40:08 2018 From: report at bugs.python.org (lilydjwg) Date: Fri, 02 Nov 2018 08:40:08 +0000 Subject: [New-bugs-announce] [issue35144] TemporaryDirectory can't be cleaned up if there are unsearchable directories Message-ID: <1541148008.66.0.788709270274.issue35144@psf.upfronthosting.co.za> New submission from lilydjwg : If the title doesn't explain clearly, here's a demo program that will fail: import tempfile import pathlib def test(): with tempfile.TemporaryDirectory(prefix='test-bad-') as tmpdir: tmpdir = pathlib.Path(tmpdir) subdir = tmpdir / 'sub' subdir.mkdir() with open(subdir / 'file', 'w'): pass subdir.chmod(0o600) if __name__ == '__main__': test() I didn't expect this, and I didn't find an easy way to handle this except not using TemporaryDirectory at all: import tempfile import pathlib import shutil import os def rmtree_error(func, path, excinfo): if isinstance(excinfo[1], PermissionError): os.chmod(os.path.dirname(path), 0o700) os.unlink(path) print(func, path, excinfo) def test(): tmpdir = tempfile.mkdtemp(prefix='test-good-') try: tmpdir = pathlib.Path(tmpdir) subdir = tmpdir / 'sub' subdir.mkdir() with open(subdir / 'file', 'w'): pass subdir.chmod(0o600) finally: shutil.rmtree(tmpdir, onerror=rmtree_error) if __name__ == '__main__': test() This works around the issue, but the dirfd is missing in the onerror callback. I have this issue because my program extracts tarballs to a temporary directory for examination. I expected that TemporaryDirectory cleaned up things when it could. What do you think? rm -rf can't remove such a directory either but this is annoying and I think Python can do better. ---------- components: Library (Lib) messages: 329116 nosy: lilydjwg priority: normal severity: normal status: open title: TemporaryDirectory can't be cleaned up if there are unsearchable directories type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 2 08:16:24 2018 From: report at bugs.python.org (Robert Pollak) Date: Fri, 02 Nov 2018 12:16:24 +0000 Subject: [New-bugs-announce] [issue35145] sqlite3: "select *" should autoconvert datetime fields Message-ID: <1541160984.12.0.788709270274.issue35145@psf.upfronthosting.co.za> New submission from Robert Pollak : Currently, fields are converted to datetime as described in https://docs.python.org/3/library/sqlite3.html#sqlite3.PARSE_COLNAMES : 'select x as "x [datetime]" from table' In my use case I don't know the names and locations of the datetime fields in advance. So I would need to do pandas.read_sql_query('select * from table', con) and get correct datetime columns. (My current workaround is try calling pandas.to_datetime on each text column afterwards.) The type info has to be available in the sqlite database, because I see that SQLiteStudio correctly detects the datetime columns. ---------- components: Library (Lib) messages: 329128 nosy: jondo priority: normal severity: normal status: open title: sqlite3: "select *" should autoconvert datetime fields type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 2 09:43:06 2018 From: report at bugs.python.org (Dan Boxall) Date: Fri, 02 Nov 2018 13:43:06 +0000 Subject: [New-bugs-announce] [issue35146] Bad Regular Expression Broke re.findall() Message-ID: <1541166186.22.0.788709270274.issue35146@psf.upfronthosting.co.za> New submission from Dan Boxall : Hi, I'm new to regular expressions and while playing around with them I tried this: >>> rex = '*New Revision:.* ([0-9]+)' >>> re.findall(rex, text) and got this: Traceback (most recent call last): File "", line 1, in File "C:\Python\Python37\lib\re.py", line 223, in findall return _compile(pattern, flags).findall(string) File "C:\Python\Python37\lib\re.py", line 286, in _compile p = sre_compile.compile(pattern, flags) File "C:\Python\Python37\lib\sre_compile.py", line 764, in compile p = sre_parse.parse(p, flags) File "C:\Python\Python37\lib\sre_parse.py", line 930, in parse p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0) File "C:\Python\Python37\lib\sre_parse.py", line 426, in _parse_sub not nested and not items)) File "C:\Python\Python37\lib\sre_parse.py", line 651, in _parse source.tell() - here + len(this)) re.error: nothing to repeat at position 0 ---------- components: Regular Expressions messages: 329130 nosy: Callipygean, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: Bad Regular Expression Broke re.findall() versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 2 12:03:19 2018 From: report at bugs.python.org (Alexey Izbyshev) Date: Fri, 02 Nov 2018 16:03:19 +0000 Subject: [New-bugs-announce] [issue35147] _Py_NO_RETURN is always empty on GCC Message-ID: <1541174599.42.0.788709270274.issue35147@psf.upfronthosting.co.za> New submission from Alexey Izbyshev : Non-existing __GNUC_MAJOR__ macro is used to check for GCC version at https://github.com/python/cpython/blob/b942707fc23454a998323c17e30be78ff1a4f0e7/Include/pyerrors.h#L97 . __GNUC__ should be used instead. ---------- components: Interpreter Core messages: 329136 nosy: benjamin.peterson, berker.peksag, brett.cannon, izbyshev, serhiy.storchaka priority: normal severity: normal status: open title: _Py_NO_RETURN is always empty on GCC type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 2 12:39:43 2018 From: report at bugs.python.org (Martin Bijl-Schwab) Date: Fri, 02 Nov 2018 16:39:43 +0000 Subject: [New-bugs-announce] [issue35148] cannot activate a venv environment on a Swiss German windows Message-ID: <1541176783.96.0.788709270274.issue35148@psf.upfronthosting.co.za> New submission from Martin Bijl-Schwab : There is a small bug in the activate.bat script causing problems on internationalized Windows systems. C:\repo\gui>python -m venv venv C:\repo\gui>call venv\Scripts\activate.bat Parameterformat falsch - 850. This translates to "Wrong parameter - 850." For the user it is not obvious what went wrong. The virtual environment is setup and will work in most cases. Link to https://bugs.python.org/issue32409. ---------- components: Library (Lib) messages: 329140 nosy: Martin Bijl-Schwab priority: normal pull_requests: 9610 severity: normal status: open title: cannot activate a venv environment on a Swiss German windows type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 2 13:27:26 2018 From: report at bugs.python.org (Dileep) Date: Fri, 02 Nov 2018 17:27:26 +0000 Subject: [New-bugs-announce] [issue35149] pip3 show causing Error for ConfigParaser Message-ID: <1541179646.4.0.788709270274.issue35149@psf.upfronthosting.co.za> New submission from Dileep : I' receiving error while viewing the package info of ConfigParser. The command `pip3 show ConfigParser` doesn't cause any error where as following batch script is resulting this error It has something to do with Autor name or Unicode handling of the Pip3 `for /f "tokens=1,2 delims=:" %a in ('pip3 show ConfigParser') do echo %a : %b` Traceback (most recent call last): File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\logging\__init__.py", line 995, in emit stream.write(msg) File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_vendor\colorama\ansitowin32.py", line 141, in write self.write_and_convert(text) File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_vendor\colorama\ansitowin32.py", line 169, in write_and_convert self.write_plain_text(text, cursor, len(text)) File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_vendor\colorama\ansitowin32.py", line 174, in write_plain_text self.wrapped.write(text[start:end]) File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u0141' in position 8: character maps to Call stack: File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Scripts\pip3.exe\__main__.py", line 9, in sys.exit(main()) File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_internal\__init__.py", line 78, in main return command.main(cmd_args) File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_internal\cli\base_command.py", line 143, in main status = self.run(options, args) File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_internal\commands\show.py", line 47, in run results, list_files=options.files, verbose=options.verbose): File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages\pip\_internal\commands\show.py", line 145, in print_results logger.info("Author: %s", dist.get('author', '')) Message: 'Author: %s' Arguments: ('?ukasz Langa',) ---------- messages: 329144 nosy: mdileep priority: normal severity: normal status: open title: pip3 show causing Error for ConfigParaser _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 2 14:08:52 2018 From: report at bugs.python.org (Robert Henry) Date: Fri, 02 Nov 2018 18:08:52 +0000 Subject: [New-bugs-announce] [issue35150] Misc/README.valgrind out-of-date Message-ID: <1541182132.22.0.788709270274.issue35150@psf.upfronthosting.co.za> New submission from Robert Henry : File Misc/README.valgrind is out of date with respect to python3.8. There are important sections of this file that are 15 years old! Example: the README.valgrind refers to "Uncomment Py_USING_MEMORY_DEBUGGER in Objects/obmalloc.c" but there's no such symbol in obmalloc.c (There is in Python/dtoa.c) I have no idea if the valgrind suppression file Misc/valgrind-python.supp is up to date, but it bears examination by an expert. ---------- assignee: docs at python components: Documentation messages: 329151 nosy: docs at python, rrh priority: normal severity: normal status: open title: Misc/README.valgrind out-of-date versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 2 20:20:18 2018 From: report at bugs.python.org (Joshua Honeycutt) Date: Sat, 03 Nov 2018 00:20:18 +0000 Subject: [New-bugs-announce] [issue35151] Python 2 xml.etree.ElementTree documentation tutorial uses undocumented arguments Message-ID: <1541204418.39.0.788709270274.issue35151@psf.upfronthosting.co.za> New submission from Joshua Honeycutt : In python 2 documentation 19.7.1.6 (https://docs.python.org/2/library/xml.etree.elementtree.html#parsing-xml-with-namespaces) a second argument (ns) is passed to find and findall. However 19.7.3.2 (https://docs.python.org/2/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.find) only specifies the single match argument. If we compare the python 3 documentation the namespaces argument is included in the find method. (https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.find) Maybe the tutorial was created for python 3 version? I assume the function arguments are automatically generated, but I have not tested or tried these functions in python 2. I just stumbled on the docs while working with python 3. ---------- assignee: docs at python components: Documentation messages: 329174 nosy: docs at python, epakai priority: normal severity: normal status: open title: Python 2 xml.etree.ElementTree documentation tutorial uses undocumented arguments versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 3 04:00:06 2018 From: report at bugs.python.org (Oleksandr Buchkovskyi) Date: Sat, 03 Nov 2018 08:00:06 +0000 Subject: [New-bugs-announce] [issue35152] too small type for struct.pack/unpack in mutliprocessing.Connection Message-ID: <1541232006.36.0.788709270274.issue35152@psf.upfronthosting.co.za> New submission from Oleksandr Buchkovskyi : the problem is reproduced on big multiprocessing.Process output when the size of the output gets bigger than signed int a struct error is raised ``` python3 test.py Process ForkPoolWorker-1: Traceback (most recent call last): File "/usr/lib64/python3.5/multiprocessing/pool.py", line 125, in worker put((job, i, result)) File "/usr/lib64/python3.5/multiprocessing/queues.py", line 347, in put self._writer.send_bytes(obj) File "/usr/lib64/python3.5/multiprocessing/connection.py", line 200, in send_bytes self._send_bytes(m[offset:offset + size]) File "/usr/lib64/python3.5/multiprocessing/connection.py", line 393, in _send_bytes header = struct.pack("!i", n) struct.error: 'i' format requires -2147483648 <= number <= 2147483647 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib64/python3.5/multiprocessing/process.py", line 252, in _bootstrap self.run() File "/usr/lib64/python3.5/multiprocessing/process.py", line 93, in run self._target(*self._args, **self._kwargs) File "/usr/lib64/python3.5/multiprocessing/pool.py", line 130, in worker put((job, i, (False, wrapped))) File "/usr/lib64/python3.5/multiprocessing/queues.py", line 347, in put self._writer.send_bytes(obj) File "/usr/lib64/python3.5/multiprocessing/connection.py", line 200, in send_bytes self._send_bytes(m[offset:offset + size]) File "/usr/lib64/python3.5/multiprocessing/connection.py", line 393, in _send_bytes header = struct.pack("!i", n) struct.error: 'i' format requires -2147483648 <= number <= 2147483647 ``` this error can be fixed by changing types that are used her? for struct.pack/unpack to !Q ---------- components: Library (Lib) files: error_on_bug_multiprocessing_output.py messages: 329189 nosy: ahcub priority: normal severity: normal status: open title: too small type for struct.pack/unpack in mutliprocessing.Connection type: crash versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47903/error_on_bug_multiprocessing_output.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 3 07:26:11 2018 From: report at bugs.python.org (=?utf-8?q?C=C3=A9dric_Krier?=) Date: Sat, 03 Nov 2018 11:26:11 +0000 Subject: [New-bugs-announce] [issue35153] Allow to set headers in xmlrpc.client.ServerProxy Message-ID: <1541244371.62.0.788709270274.issue35153@psf.upfronthosting.co.za> New submission from C?dric Krier : If we want to support other authentication method than basic, we need to be able to set headers to the request sent. I propose to add an argument headers to ServerProxy which is a list of header tuples that will be put as header. ---------- components: Library (Lib) messages: 329191 nosy: ced priority: normal severity: normal status: open title: Allow to set headers in xmlrpc.client.ServerProxy type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 3 16:55:53 2018 From: report at bugs.python.org (Roffild) Date: Sat, 03 Nov 2018 20:55:53 +0000 Subject: [New-bugs-announce] [issue35154] subprocess.list2cmdline() does not allow running some commands. Message-ID: <1541278553.41.0.788709270274.issue35154@psf.upfronthosting.co.za> New submission from Roffild : This issue has already been discussed in #23862 Have to use this hack: import subprocess def list2cmdlineHack(seq): return " ".join(seq) subprocess.list2cmdline = list2cmdlineHack There must be an argument in subprocess.run() to disable subprocess.list2cmdline(). Let the programmer set the start line of the command himself. ---------- components: IO, Library (Lib), Windows messages: 329207 nosy: Roffild, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: subprocess.list2cmdline() does not allow running some commands. type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 3 19:11:13 2018 From: report at bugs.python.org (Denton Liu) Date: Sat, 03 Nov 2018 23:11:13 +0000 Subject: [New-bugs-announce] [issue35155] Clarify Protocol Handlers in urllib.request Docs Message-ID: <1541286673.86.0.788709270274.issue35155@psf.upfronthosting.co.za> New submission from Denton Liu : The urllib.request documentation that they can add their own protocol handlers, however they are unclear on how they should be named. We should replace instances of things like protocol_request with _request to make it clear that we are literally replacing "protocol" with the literal protocol. I am creating this issue because I had to actually read the urllib.request source code in order to figure out how to use the protocol handler APIs. ---------- assignee: docs at python components: Documentation messages: 329210 nosy: Denton-L, docs at python priority: normal severity: normal status: open title: Clarify Protocol Handlers in urllib.request Docs type: enhancement versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 3 19:34:29 2018 From: report at bugs.python.org (Jorge Ramos) Date: Sat, 03 Nov 2018 23:34:29 +0000 Subject: [New-bugs-announce] [issue35156] Consider revising documentation on Python Builds from source Message-ID: <1541288069.11.0.788709270274.issue35156@psf.upfronthosting.co.za> New submission from Jorge Ramos : I want to build from source a 3.6 Python, using PGO for windows. Followed instructions at https://devguide.python.org/setup/ (the original search from google was "build python from source windows"). From a newbie perspective there are several problems: 1) it is suggested that you should build first a "debug" python (header 1.3) but they don't tell you how. 2) it is suggested that you should first build via "PCBuild\build.bat" but they don't tell you that this builds a win32 platform. What if I want to build a x64 version? (lost much time here figuring out how) 3) I ran into problems when building with "PCBuild\build.bat" (header 1.3.2) because the dependencies where not all downloaded in the first pass (but this is a bug I could fill later). Lost much time here figuring why the build did not succeed. 4) in (1.3.2) it is suggested you keep reading in a readme file: https://github.com/python/cpython/blob/master/PCbuild/readme.txt This is the first time an optimization is mentioned (other than simply compiling from your machine. I did not know that using PGO was mandatory for real speedups compared to the downloadable ?general? binaries). 5) In this very same readme, it says that there are other "subprojects" that you need to consider building with Python. Lost much time here trying to figure out that these subprojects are downloaded via "get_externals.bat" in the "Getting External Sources" section. Why not simply put the "Getting External Sources" section first and avoid worrying the newcomer of potential projects that are "not included with python"? 6) They tell you that PGO is automated via a "build_pgo.bat" file. But this does not exist. 7) They tell you that first, you have to run the PGInstrument option in the build, but it is not clear what should be run next: PCBuild\build.bat -c PGUpdate -p x64" or "PCBuild\build.bat --pgo -p x64" 8) After 2 days of trying to build (and learn in the process by trial and error) I stumble upon YET ANOTHER WAY TO BUILD: the one found in "cpython\Tools\msi" NOT the first one: "cpython\PCbuild" And this is the one I was interested in the first place: building an installable version of python (yet I have to figure out how to pack all cab files and such into one exe), not a developer?s python for testing. And after now 3 days with this, I noticed that all previous testing and building techniques are indeed reachable from "cpython\Tools\msi\buildrelease.bat -x64" which tries to build a python in x64 version AND using GPO (by default -in the x64 but not in the win32-, which is not mentioned in the documentation, by the way) also generating the dependencies required (I could have avoided losing some time if knowing this from the very beginning- see point 5) As you can see, I lost few hours here, few there. And because I am not a developer (my intention is to have an optimized python for my PC for AI research) I lost much time trying to figure out things that are not explicitly said in the documentation: I managed to learn from other sources (googling around), by careful observation of the compilation results, and digging into the help section of each of the files used. Hope I successfully communicated Python?s lack of proper documentation (just for the case of building from source!) ---------- assignee: docs at python components: Documentation messages: 329211 nosy: docs at python, neyuru priority: normal severity: normal status: open title: Consider revising documentation on Python Builds from source type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 3 19:52:48 2018 From: report at bugs.python.org (Jorge Ramos) Date: Sat, 03 Nov 2018 23:52:48 +0000 Subject: [New-bugs-announce] [issue35157] Missing pyconfig.h when building from source Message-ID: <1541289168.57.0.788709270274.issue35157@psf.upfronthosting.co.za> New submission from Jorge Ramos : When testing the builds when PGO is enabled, or by simply running rt.bat, the following error is (always) issued: cpython\include\Python.h(8): fatal error C1083: Cannot include: 'pyconfig.h': No such file or directory One example of steps taken is: git clone git at github.com:python/cpython.git cd cpython git checkout 3.6 PCBuild\get_externals.bat Tools\msi\get_externals.bat PCBuild\build.bat -p x64 I have to manually copy a pyconfig.h file from a working Python's include directory to the repositorie's include directory to fix this error. By the way, I had PYTHONHOME environment variable pointing to ...\Python36\DLLs; ...\Python36\Lib; ...\Python36\Lib\site-packages; ...\Python36\include with no success. ---------- components: Build messages: 329212 nosy: neyuru priority: normal severity: normal status: open title: Missing pyconfig.h when building from source type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 3 20:07:33 2018 From: report at bugs.python.org (Joy Diamond) Date: Sun, 04 Nov 2018 00:07:33 +0000 Subject: [New-bugs-announce] [issue35158] Fix PEP 3115 to NOT imply that the class dictionary is used in the final created class Message-ID: <1541290053.55.0.788709270274.issue35158@psf.upfronthosting.co.za> New submission from Joy Diamond : Fix the following in https://www.python.org/dev/peps/pep-3115/ REPLACE: """ def __new__(cls, name, bases, classdict): # Note that we replace the classdict with a regular # dict before passing it to the superclass, so that we # don't continue to record member names after the class # has been created. result = type.__new__(cls, name, bases, dict(classdict)) result.member_names = classdict.member_names return result """ WITH: """ def __new__(cls, name, bases, classdict): result = type.__new__(cls, name, bases, classdict) result.member_names = classdict.member_names return result """ REMOVING the incorrect comment & copying of `classdict` According to: https://docs.python.org/3/reference/datamodel.html#preparing-the-class-namespace "When a new class is created by type.__new__, the object provided as the namespace parameter is copied to a new ordered mapping and the original object is discarded." Hence there is no need to copy `classdict` ---------- messages: 329213 nosy: joydiamond priority: normal severity: normal status: open title: Fix PEP 3115 to NOT imply that the class dictionary is used in the final created class _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 4 02:57:09 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Sun, 04 Nov 2018 07:57:09 +0000 Subject: [New-bugs-announce] [issue35159] Add a link to the devguide in the sidebar of the documentation Message-ID: <1541318229.4.0.788709270274.issue35159@psf.upfronthosting.co.za> New submission from St?phane Wirtel : I think a link to the devguide could be useful for a future contributor and the right place could be the sidebar in the index page. ---------- assignee: docs at python components: Documentation messages: 329219 nosy: docs at python, matrixise priority: normal severity: normal status: open title: Add a link to the devguide in the sidebar of the documentation _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 4 06:52:05 2018 From: report at bugs.python.org (Serafeim Mellos) Date: Sun, 04 Nov 2018 11:52:05 +0000 Subject: [New-bugs-announce] [issue35160] PyObjects initialized with PyObject_New have uninitialized pointers to set to 0x1 Message-ID: <1541332325.94.0.788709270274.issue35160@psf.upfronthosting.co.za> New submission from Serafeim Mellos : I looked but I couldn't find any mention of this either in the bug tracker or the docs so I assume this is not a desired behavior or a known proble but feel free to correct me if I'm wrong. I have noticed a weird behavior in Python3.7 onwards with the way PyObject_New() works. I'm not sure what is the exact cause for the issue but even though the documentation mentions that it should initialize all fields described in the associated PyTypeObject, I think there's a problem that somehow causes uninitialized pointers to get initialized with strange values that break other functionality (eg Py_XDECREF). In more detail, it seems like uninitialized pointers in PyObjects get initialized to 0x1 which can lead to SEGFAULTs when calling Py_XDECREF() on them since they are no longer valid pointers. I have taken the example extension from the python docs (https://docs.python.org/3/extending/newtypes_tutorial.html) and modified lightly in order to surface the issue. You can find the sample extension in my github: https://github.com/fim/python_pyobjectnew_example I have checked versions 3.5, 3,6 which are fine but 3.7.0, 3.7.1 and 3.8 seem to reproduce this issue. You can see a simple transcript of how the issue manifests below: $ python setup.py build [...] $ pip install . [...] $ python -c 'import custom; custom.Custom()' weird pointer has value of: 0x8ec480 deallocating weird pointer $ python Python 3.7.1 (default, Nov 3 2018, 09:33:27) [GCC 5.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import custom, gc >>> custom.Custom() weird pointer has value of: 0x1 >>> gc.collect() deallocating weird pointer zsh: segmentation fault python ---------- components: Extension Modules messages: 329224 nosy: fim priority: normal severity: normal status: open title: PyObjects initialized with PyObject_New have uninitialized pointers to set to 0x1 type: crash versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 4 09:26:54 2018 From: report at bugs.python.org (Alexey Izbyshev) Date: Sun, 04 Nov 2018 14:26:54 +0000 Subject: [New-bugs-announce] [issue35161] ASAN: stack-use-after-scope in grp.getgr{nam, gid} and pwd.getpw{nam, uid} Message-ID: <1541341614.35.0.788709270274.issue35161@psf.upfronthosting.co.za> New submission from Alexey Izbyshev : ==24122==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7fffb1c62550 at pc 0x0000006ec66c bp 0x7fffb1c62450 sp 0x7fffb1c62448 READ of size 8 at 0x7fffb1c62550 thread T0 #0 0x6ec66b in mkpwent /scratch2/izbyshev/cpython/Modules/pwdmodule.c:79 #1 0x6ecdc9 in pwd_getpwnam_impl /scratch2/izbyshev/cpython/Modules/pwdmodule.c:260 #2 0x6ecfee in pwd_getpwnam /scratch2/izbyshev/cpython/Modules/clinic/pwdmodule.c.h:39 #3 0x454146 in _PyMethodDef_RawFastCallKeywords /scratch2/izbyshev/cpython/Objects/call.c:644 [======= snip =======] Address 0x7fffb1c62550 is located in stack of thread T0 at offset 160 in frame #0 0x6eca60 in pwd_getpwnam_impl /scratch2/izbyshev/cpython/Modules/pwdmodule.c:203 This frame has 3 object(s): [32, 40) 'name_chars' [96, 104) 'p' [160, 208) 'pwd' <== Memory access at offset 160 is inside this variable Variables declared in the block scope created with Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS are referred to via a pointer outside of that scope (i.e., after their lifetime ends). The bug was introduced in https://github.com/python/cpython/commit/23e65b25557f957af840cf8fe68e80659ce28629 . ---------- components: Extension Modules messages: 329230 nosy: berker.peksag, izbyshev, serhiy.storchaka, vstinner, wg priority: normal severity: normal status: open title: ASAN: stack-use-after-scope in grp.getgr{nam,gid} and pwd.getpw{nam,uid} type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 4 09:46:46 2018 From: report at bugs.python.org (Barney Stratford) Date: Sun, 04 Nov 2018 14:46:46 +0000 Subject: [New-bugs-announce] [issue35162] Inconsistent behaviour around __new__ Message-ID: <1541342806.22.0.788709270274.issue35162@psf.upfronthosting.co.za> New submission from Barney Stratford : >>> class Eggs (object): ... def __init__ (self, number): ... self.__number = number ... def __repr__ (self): ... return "{} eggs".format (self.__number) ... >>> Eggs (4) 4 eggs >>> del Eggs.__new__ Traceback (most recent call last): File "", line 1, in AttributeError: __new__ >>> # As expected ... >>> Eggs (4) 4 eggs >>> Eggs.__new__ = None >>> del Eggs.__new__ >>> Eggs (4) Traceback (most recent call last): File "", line 1, in TypeError: object() takes no parameters >>> # Wrong! Eggs has no __new__, so this should respond as earlier ... This bug seems to be because the slotdef isn't updated when __new__ is deleted. ---------- messages: 329231 nosy: Barney Stratford priority: normal severity: normal status: open title: Inconsistent behaviour around __new__ type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 4 10:54:37 2018 From: report at bugs.python.org (Carmen Bianca Bakker) Date: Sun, 04 Nov 2018 15:54:37 +0000 Subject: [New-bugs-announce] [issue35163] locale: setlocale(..., 'eo') sets non-existing locale Message-ID: <1541346877.51.0.788709270274.issue35163@psf.upfronthosting.co.za> New submission from Carmen Bianca Bakker : See the following script: >>> import locale >>> locale.setlocale(locale.LC_ALL, 'eo') 'eo' >>> my_locale = locale.getlocale() >>> my_locale ('eo_XX', 'ISO8859-3') >>> locale.setlocale(locale.LC_ALL, my_locale) Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.7/locale.py", line 604, in setlocale return _setlocale(category, locale) locale.Error: unsupported locale setting 'eo_XX.ISO8859-3' does not exist on Fedora 29 or Debian Stretch. The only Esperanto locales that exists are 'eo' and 'eo.utf8'. Even so, locale.py defines the Esperanto locales as follows: 'eo': 'eo_XX.ISO8859-3', 'eo.utf8': 'eo.UTF-8', 'eo_eo': 'eo_EO.ISO8859-3', 'eo_us.utf8': 'eo_US.UTF-8', 'eo_xx': 'eo_XX.ISO8859-3', eo_EO used to exist on Debian in the early 2000s, and eo_XX on some other distributions. Since glibc 2.24 upstreamed Esperanto, however, it has been 'eo[.utf8]'. I'm not sure whether 'eo_eo', 'eo_us' and/or 'eo_xx' should be removed as keys, but 'eo' should have 'eo.UTF-8' as value. ---------- components: Library (Lib) messages: 329235 nosy: carmenbianca priority: normal severity: normal status: open title: locale: setlocale(..., 'eo') sets non-existing locale versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 4 11:50:41 2018 From: report at bugs.python.org (Sorin Sbarnea) Date: Sun, 04 Nov 2018 16:50:41 +0000 Subject: [New-bugs-announce] [issue35164] socket.getfqdn and socket.gethostbyname fail on MacOS Message-ID: <1541350241.71.0.788709270274.issue35164@psf.upfronthosting.co.za> New submission from Sorin Sbarnea : It seems that when the MacOS machine does not have a FQDN name manually configured using `scutil`, python will be fail to resolve domain names and timeout after ~30 seconds. I mention that the DNS resolution works correctly on the machine and that the DHCP servers provides one ore more domains to be useles for resolution. Tools like nslookup or ping are not affected by this, only python (tried py27,34-36 and got same behavior). Usually python user encounters errors like: Traceback (most recent call last): ... socket.gethostbyname(socket.gethostname()) gaierror: [Errno 8] nodename nor servname provided, or not known One these machines `hostname` cli command returns a valid FQDN name like `foo.lan` but scutil will not return one: ``` sudo scutil --get HostName HostName: not set ``` One temporary workaround is to manually run: ``` sudo scutil --set HostName `hostname` ``` This will set the hostname and python sockets functions will start to work (after few minutes as some caching is involved). Still, we cannot expect users to run this command themselves. Even worse, they would have to re-run this each time the roam to another network that may have a different set of domains. See: https://stackoverflow.com/questions/52602107 ---------- components: macOS messages: 329237 nosy: ned.deily, ronaldoussoren, ssbarnea priority: normal severity: normal status: open title: socket.getfqdn and socket.gethostbyname fail on MacOS type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 4 12:43:20 2018 From: report at bugs.python.org (Denis Osipov) Date: Sun, 04 Nov 2018 17:43:20 +0000 Subject: [New-bugs-announce] [issue35165] Possible wrong method name in attribute references doc Message-ID: <1541353400.8.0.788709270274.issue35165@psf.upfronthosting.co.za> New submission from Denis Osipov : 6.3.1. Attribute references says: "The primary must evaluate to an object of a type that supports attribute references, which most objects do. This object is then asked to produce the attribute whose name is the identifier. This production can be customized by overriding the __getattr__() method. If this attribute is not available, the exception AttributeError is raised." It seems that __getattribute__ method is meaning. ---------- assignee: docs at python components: Documentation messages: 329245 nosy: denis-osipov, docs at python priority: normal severity: normal status: open title: Possible wrong method name in attribute references doc type: behavior versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 5 01:23:01 2018 From: report at bugs.python.org (Dan Snider) Date: Mon, 05 Nov 2018 06:23:01 +0000 Subject: [New-bugs-announce] [issue35166] BUILD_MAP_UNPACK doesn't function as expected for dict subclasses Message-ID: <1541398981.44.0.788709270274.issue35166@psf.upfronthosting.co.za> New submission from Dan Snider : >>> class Dict(dict): def keys(self): assert 0 def update(*args, **kwds): assert 0 def __getitem__(self, key): assert 0 def __iter__(self): assert 0 >>> {**Dict(a=1)} {'a': 1} The opcode uses PyDict_Update, which calls the internal dict_merge function which contains the following line: if (PyDict_Check(b) && (Py_TYPE(b)->tp_iter == (getiterfunc)dict_iter)) Translated to Python, that should be equal to if type(b).__flags__ & (1<<29) and type.__getattribute__(type(b), '__iter__') is type.__getattribute__(dict, '__iter__')` Both that and the line in C evaluate to false for me (while a dict subclass that doesn't override __iter__ evaluates to true), so I apparently can't help narrow down the problem any further assuming people agree that this is even is a problem... The BUILD_MAP_UNPACK_WITH_CALL, CALL_FUNCTION_EX, and CALL_FUNCTION_KW opcodes are affected as well. ---------- components: Interpreter Core messages: 329280 nosy: bup priority: normal severity: normal status: open title: BUILD_MAP_UNPACK doesn't function as expected for dict subclasses type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 5 08:43:16 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Mon, 05 Nov 2018 13:43:16 +0000 Subject: [New-bugs-announce] [issue35167] Specify program for gzip and json.tool command line options Message-ID: <1541425396.23.0.788709270274.issue35167@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : Currently command line options for gzip and json.tool are listed as general command line options, together with other options for the Python interpreter. They should be listed as options of separate programs. See "command line option" on https://docs.python.org/3/genindex-C.html. ---------- assignee: serhiy.storchaka components: Documentation messages: 329297 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Specify program for gzip and json.tool command line options versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 5 12:32:14 2018 From: report at bugs.python.org (tphh) Date: Mon, 05 Nov 2018 17:32:14 +0000 Subject: [New-bugs-announce] [issue35168] shlex punctuation_chars inconsistency Message-ID: <1541439134.06.0.788709270274.issue35168@psf.upfronthosting.co.za> New submission from tphh : The newly added shlex.punctuation_chars is special compared to the other public instance variables: It can ONLY be used when constructing a shlex instance, unlike other public instance variables, such as commenters, which can ONLY be set later. >>> s = shlex.shlex('abc // def') >>> s.commenters = '/' >>> list(s) ['abc', '', ''] >>> s = shlex.shlex('abc // def', punctuation_chars = '/') >>> list(s) ['abc', '//', 'def'] However, setting punctuation_chars later shows this rather useless error message: >>> s = shlex.shlex('abc // def') >>> s.punctuation_chars = '/' >>> list(s) Traceback (most recent call last): File "", line 1, in File "/opt/python/3.7.1/lib/python3.7/shlex.py", line 295, in __next__ token = self.get_token() File "/opt/python/3.7.1/lib/python3.7/shlex.py", line 105, in get_token raw = self.read_token() File "/opt/python/3.7.1/lib/python3.7/shlex.py", line 133, in read_token if self.punctuation_chars and self._pushback_chars: AttributeError: 'shlex' object has no attribute '_pushback_chars' ---------- components: Library (Lib) messages: 329310 nosy: tphh priority: normal severity: normal status: open title: shlex punctuation_chars inconsistency type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 5 14:17:32 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Mon, 05 Nov 2018 19:17:32 +0000 Subject: [New-bugs-announce] [issue35169] Improve error messages for assignment Message-ID: <1541445452.32.0.788709270274.issue35169@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : This is a follow up of issue34641. >>> f(lambda x: x = 1) File "", line 1 SyntaxError: lambda cannot contain assignment >>> f(x.y = 1) File "", line 1 SyntaxError: keyword can't be an expression The error message "keyword can't be an expression" still looks confusing to me. This is because the term "keyword" is ambiguous. Usually it means reserved identifier like "if" or "def". Some keywords, like "None" and "True" can be expressions. Perhaps "keyword name can't be an expression" would be better. But I think that in these cases it is most likely that "=" was used instead of "==". And it would be better to generalize the error message for lambdas and point on a possible typo. >>> f(x.y = 1) File "", line 1 SyntaxError: expression cannot contain assignment, perhaps you meant "=="? The proposed PR changes this error message. It makes also an error message for forbidden assignment more concrete: "cannot assign to __debug__" instead of "assignment to keyword" (the latter is actually incorrect, because __debug__ is not true keyword in tokenizer). This restores Python 2 error messages. Improved also other error messages for forbidden assigning: dict and set displays, f-string expressions are not literals. ---------- components: Interpreter Core messages: 329313 nosy: benjamin.peterson, brett.cannon, gvanrossum, serhiy.storchaka, yselivanov priority: normal severity: normal status: open title: Improve error messages for assignment type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 5 15:03:36 2018 From: report at bugs.python.org (lana.deere) Date: Mon, 05 Nov 2018 20:03:36 +0000 Subject: [New-bugs-announce] [issue35170] 3.7.1 compile failure on CentOS 6.10; _ctypes did not build Message-ID: <1541448216.81.0.788709270274.issue35170@psf.upfronthosting.co.za> New submission from lana.deere : When I try to compile 3.7.1 on CentOS6.10 it fails to build _ctypes, but I can't find any indication of why. There are several mentions of _ctypes during compiles, building '_ctypes_test' extension creating build/temp.linux-x86_64-3.7/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Modules/_ctypes /usr/bin/gcc -pthread -fPIC -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I./Include -I. -I/usr/local/include -I/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Include -I/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1 -c /home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Modules/_ctypes/_ctypes_test.c -o build/temp.linux-x86_64-3.7/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Modules/_ctypes/_ctypes_test.o /usr/bin/gcc -pthread -shared build/temp.linux-x86_64-3.7/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Modules/_ctypes/_ctypes_test.o -L/usr/local/lib -lm -o build/lib.linux-x86_64-3.7/_ctypes_test.cpython-37m-x86_64-linux-gnu.so After that, it gets to listing modules later and says: INFO: Could not locate ffi libs and/or headers Python build finished successfully! The necessary bits to build these optional modules were not found: _ssl To find the necessary bits, look in setup.py in detect_modules() for the module's name. The following modules found by detect_modules() in setup.py, have been built by the Makefile instead, as configured by the Setup files: _abc atexit pwd time Failed to build these modules: _ctypes _uuid Could not build the ssl module! Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host(). LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381 I can see the problem with _uuid, it's a conflict between headers. In file included from /home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Modules/_uuidmodule.c:8: /usr/include/uuid.h:94: error: conflicting types for ?uuid_t? /usr/include/uuid/uuid.h:44: note: previous declaration of ?uuid_t? was here /usr/include/uuid.h:107: error: conflicting types for ?uuid_compare? /usr/include/uuid/uuid.h:73: note: previous declaration of ?uuid_compare? was here /home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Modules/_uuidmodule.c: In function ?py_uuid_generate_time_safe?: /home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Modules/_uuidmodule.c:15: error: storage size of ?uuid? isn?t known /home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Modules/_uuidmodule.c:15: warning: unused variable ?uuid? However, I see nothing indicating building the _ctypes extension other than the ctypes_test I mentioned already above. Eventually the build aborts because of the missing _ctypes. Generating grammar tables from /home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1-install/lib/python3.7/lib2to3/PatternGrammar.txt Writing grammar tables to /home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1-install/lib/python3.7/lib2to3/PatternGrammar3.7.1.final.0.pickle if test "xupgrade" != "xno" ; then \ case upgrade in \ upgrade) ensurepip="--upgrade" ;; \ install|*) ensurepip="" ;; \ esac; \ ./python -E -m ensurepip \ $ensurepip --root=/ ; \ fi Traceback (most recent call last): File "/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Lib/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Lib/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Lib/ensurepip/__main__.py", line 5, in sys.exit(ensurepip._main()) File "/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Lib/ensurepip/__init__.py", line 204, in _main default_pip=args.default_pip, File "/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Lib/ensurepip/__init__.py", line 117, in _bootstrap return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) File "/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Lib/ensurepip/__init__.py", line 27, in _run_pip import pip._internal File "/tmp/tmpz6ocn29e/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/__init__.py", line 42, in File "/tmp/tmpz6ocn29e/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/cmdoptions.py", line 16, in File "/tmp/tmpz6ocn29e/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 25, in File "/tmp/tmpz6ocn29e/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 39, in File "/tmp/tmpz6ocn29e/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/utils/glibc.py", line 3, in File "/home/twk/twkpers/opensrc/python-3.7.1/Python-3.7.1/Lib/ctypes/__init__.py", line 7, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes' make: *** [install] Error 1 I have attached the complete log captured from the build to this report. Any suggestions about the cause of this would be appreciated. Note that I had no problem building 3.6.1 on the same system. $ python3 Python 3.6.1 (default, Apr 21 2017, 11:56:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import _ctypes >>> help(_ctypes) Help on module _ctypes: [...] ---------- components: Build, Installation, ctypes files: Log.python.install.xz messages: 329317 nosy: lana.deere priority: normal severity: normal status: open title: 3.7.1 compile failure on CentOS 6.10; _ctypes did not build type: compile error versions: Python 3.7 Added file: https://bugs.python.org/file47907/Log.python.install.xz _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 5 17:53:29 2018 From: report at bugs.python.org (Alexey Izbyshev) Date: Mon, 05 Nov 2018 22:53:29 +0000 Subject: [New-bugs-announce] [issue35171] test_TimeRE_recreation_timezone failure on systems with non-default posixrules Message-ID: <1541458409.73.0.788709270274.issue35171@psf.upfronthosting.co.za> New submission from Alexey Izbyshev : I've got the following on OpenSUSE Tumbleweed (glibc 2.27): ====================================================================== FAIL: test_TimeRE_recreation_timezone (test.test_strptime.CacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/scratch2/izbyshev/cpython/Lib/test/support/__init__.py", line 1683, in inner return func(*args, **kwds) File "/scratch2/izbyshev/cpython/Lib/test/test_strptime.py", line 702, in test_TimeRE_recreation_timezone self.assertEqual(tm.tm_isdst, 1) AssertionError: 0 != 1 This test sets TZ environment variable to 'STD-1DST' and calls time.tzset() (inside support.run_with_tz decorator). This TZ value lacks rules that specify when DST transitions happen. POSIX seems to be silent what should be done if the rule is missing, thought it does specify that the rule is optional[1]. What actually happens at least on Linux/glibc[2] and FreeBSD[3] is that those rules are taken from 'posixrules' file. On OpenSUSE, it's linked to '/etc/localtime', which is linked to 'Europe/Moscow' in my case. DST transitions were cancelled in Russia in 2011, so when Python tries to get timezone names for two points of the year (https://github.com/python/cpython/blob/570e371fd6e8615ece9b9e21fbe77149ebeb172e/Modules/timemodule.c#L1603), it gets unexpected values instead. The actual values depend on the bugginess of the libc used: * Glibc seems to be confused by having 'posixrules' file with DST cancelled but a specification which includes the DST timezone part, so localtime() returns 'MSK' in tm_zone (both for January and July). * musl doesn't implement 'posixrules' fallback, so it uses "all-zero" rules instead which cause it return 'DST' in both cases. * FreeBSD 11.1 (with 'posixrules' linked to 'Europe/Moscow') returns 'STD' in both cases. With any of the above, the test fails because strptime is called with the same timezone name two times. Note that even if PyInit_timezone() didn't probe January/July and used 'tzname' global instead, it wouldn't work as expected at least on FreeBSD: it sets tzname[1] to the empty string in the test above. ISTM the best way to fix this is to remove dependence on 'posixrules' file by specifying the rules in TZ. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08 [2] http://man7.org/linux/man-pages/man3/tzset.3.html [3] https://www.freebsd.org/cgi/man.cgi?query=tzset&sektion=3 ---------- components: Tests messages: 329320 nosy: benjamin.peterson, izbyshev, serhiy.storchaka, vstinner priority: normal severity: normal status: open title: test_TimeRE_recreation_timezone failure on systems with non-default posixrules type: behavior versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 5 18:33:08 2018 From: report at bugs.python.org (Ali Rizvi-Santiago) Date: Mon, 05 Nov 2018 23:33:08 +0000 Subject: [New-bugs-announce] [issue35172] Add support for other MSVC compiler versions to distutils. distutils makes two incorrect assumption that MSVC compiler versions scale linearly and that the crt's are the same. Message-ID: <1541460788.89.0.788709270274.issue35172@psf.upfronthosting.co.za> New submission from Ali Rizvi-Santiago : Distutils makes a few incorrect assumptions that prevent it from supporting the newer Microsoft-y C compilers. This patch fixes it up till MSVC 14.0. There are 2 assumptions that are made by distutils and they are as follows. The first one is that MSVC's versions scale linearly (subtracting 6). This assumption breaks when encountering major version 13.0 as VS2013 (12.0) uses 1800 and VS2015 (14.0) uses 1900 and so the calculation for version 13.0 does not actually exist. This was fixed in the patch for both msvc9compiler.py and msvccompiler.py by skipping the major version 13. The second assumption is in the get_msvcr() function in cygwinccompiler.py and is responsible for identifying the CRT name. The newer versions of MSVC aren't listed, so these were added in the patch. However, for version 1900 (MSVC 14.0) the crt is now named "vcruntime140" which was included. It might be better to to make this table-based if there is long-term interest in supporting these other compilers. These are the only issues that I've ever encountered over the years with building CPython 2.7.x with the newer VS compilers. ---------- components: Distutils files: distutils.patch keywords: patch messages: 329321 nosy: Ali Rizvi-Santiago, dstufft, eric.araujo priority: normal severity: normal status: open title: Add support for other MSVC compiler versions to distutils. distutils makes two incorrect assumption that MSVC compiler versions scale linearly and that the crt's are the same. type: enhancement versions: Python 2.7 Added file: https://bugs.python.org/file47908/distutils.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 5 19:18:27 2018 From: report at bugs.python.org (Ali Rizvi-Santiago) Date: Tue, 06 Nov 2018 00:18:27 +0000 Subject: [New-bugs-announce] [issue35173] Re-use already existing functionality to allow Python 2.7.x (both embedded and standalone) to locate the module path Message-ID: <1541463507.29.0.788709270274.issue35173@psf.upfronthosting.co.za> New submission from Ali Rizvi-Santiago : This is specific to the Windows platform as it's the only platform that uses the registry and other path hacks to identify the default module path. This patch is mostly intended for embedded Python, but is also applicable to a stand-alone Python. A few years ago, I was looking at relocating my Python interpreter so that an embedded application (that I didn't have control over) would use the correct module path. While merging my code into CPython, I quickly noticed that Python already supported doing this with Py_ENABLE_SHARED but due to the implementation wasn't actually using it for some reason. The code that implements this is 10+ years old, so perhaps it was just an oversight or some other reason that I didn't know about. Inside PC/getpathp.c there's a static variable, "dllpath", that is initialized with the path to the DLL that is being dynamically loaded when Py_ENABLE_SHARED is specified. Normally arg0 is used to locate the module path, but when embedding Python the .exe and thus arg0 is not involved. So, this patch uses "dllpath" by adding a final case to the calculation of the path by assigning it to "pythonhome" if the home was not able to be determined by any other means. This is done in 2 places within "calculatepath()". This allows one to have multiple versions of Python (32-bit, 64-bit, older versions, etc) on the same Windows system and so a user should not need to copy the Python library into their System path or explicitly set any environment variables (unless truly desired of course). This should greatly simplify relocation of Python as the DLL and executable can be moved around without being dependant on any external invariants. ---------- components: Interpreter Core files: relocate-with-dllpath.patch keywords: patch messages: 329322 nosy: Ali Rizvi-Santiago priority: normal severity: normal status: open title: Re-use already existing functionality to allow Python 2.7.x (both embedded and standalone) to locate the module path type: enhancement versions: Python 2.7 Added file: https://bugs.python.org/file47909/relocate-with-dllpath.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 5 21:48:14 2018 From: report at bugs.python.org (Camion) Date: Tue, 06 Nov 2018 02:48:14 +0000 Subject: [New-bugs-announce] [issue35174] Calling for super().__str__ seems to call self.__repr__ in list subclass Message-ID: <1541472494.47.0.788709270274.issue35174@psf.upfronthosting.co.za> New submission from Camion : I don't know if this is by design (for what reason ?) or if it is a bug, but I have noticed this quite counter-intuitive behaviour : Doing that, it seems that the logical way to make the __repr__ and __str__ methods, would be to override respectively the parent __repr__ and _str__ methods, and calling them from the inherited versions, but for some reason, it seems that calling super().__str__ leads to call self.__repr__. I have written the following piece of python-3 code in which I subclass the list class in order to make a class which supports storing names and unnamed fields the same way you can have variable named and unnamed parameters in a function call : class struct(list): def __init__(self, *args, **kwargs): super().__init__(args) for key, value in kwargs.items(): setattr(self, key, value) def __repr__(self): s = super().__repr__()[1:-1] for key, val in self.__dict__.items(): s += ', '+key+'='+repr(val) return 'struct('+s+')' def __str__(self): s = super().__str__()[1:-1] print('Debug : super().__str__() = "'+super().__str__()+'"') print('Debug : list(self).__str__() = "'+list(self).__str__()+'"') print('Debug : s = "'+s+'"') for key, val in self.__dict__.items(): s += ', '+key+'='+str(val) return '{'+s+'}' a = struct(1, 2, 3, a="akeja", b=21, c=True, d="lkj") print('repr(a)="'+repr(a)+'"\n') print('str(a)="'+str(a)+'"\n') Executing this code in idle-3.5.2 will yield the following result : >>> RESTART: struct.py repr(a)="struct(1, 2, 3, b=21, d='lkj', a='akeja', c=True)" Debug : super().__str__() = "struct(1, 2, 3, b=21, d='lkj', a='akeja', c=True)" Debug : list(self).__str__() = "[1, 2, 3]" Debug : s = "truct(1, 2, 3, b=21, d='lkj', a='akeja', c=True" str(a)="{truct(1, 2, 3, b=21, d='lkj', a='akeja', c=True, b=21, d=lkj, a=akeja, c=True}" >>> As one can see in the second debug lines, the call to `super().__str__()` which I expect to return the result from a call to the `__str__` function from my super class (`list`), will in fact return something which looks very much like the expected return from `self.__repr__()` It seems that `super().__str__()` calls `self.__repr__()` instead of `list(self).__str__()` or even `super().__repr__()`. ---------- components: Interpreter Core messages: 329331 nosy: Camion priority: normal severity: normal status: open title: Calling for super().__str__ seems to call self.__repr__ in list subclass type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 6 07:58:12 2018 From: report at bugs.python.org (Daniel Stoinov) Date: Tue, 06 Nov 2018 12:58:12 +0000 Subject: [New-bugs-announce] [issue35175] Builtin function all() is handling dict() types in a weird way. Message-ID: <1541509092.34.0.788709270274.issue35175@psf.upfronthosting.co.za> New submission from Daniel Stoinov : When a dictionary is passed to all() function, it iterates the keys instead of the values. ---------- files: all-dict-example.py messages: 329354 nosy: stnv priority: normal severity: normal status: open title: Builtin function all() is handling dict() types in a weird way. type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47912/all-dict-example.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 6 08:56:41 2018 From: report at bugs.python.org (Dan Armentrout) Date: Tue, 06 Nov 2018 13:56:41 +0000 Subject: [New-bugs-announce] [issue35176] for loop range bug Message-ID: <1541512601.8.0.788709270274.issue35176@psf.upfronthosting.co.za> New submission from Dan Armentrout : If you run the following code: x=[3,4,5] a=x for i in range(0,len(a)): a[i]=0 All x values are changed to equal a. ---------- components: Windows messages: 329357 nosy: darmentr, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: for loop range bug versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 6 09:08:41 2018 From: report at bugs.python.org (STINNER Victor) Date: Tue, 06 Nov 2018 14:08:41 +0000 Subject: [New-bugs-announce] [issue35177] Add missing dependencies between AST/parser header files Message-ID: <1541513321.28.0.788709270274.issue35177@psf.upfronthosting.co.za> New submission from STINNER Victor : Currently, there are *implicit* dependencies between AST/parser header files. For example, ast.h uses node and mod_ty types but don't include node.h nor Python-ast.h. And parsetok.h uses node and grammer but don't include nor grammar.h. Because of that, C files have to include header files in the "correct order" and need to include header files even if they don't use directly. At the end, we get something like pythonrun.c: #include "Python-ast.h" #include "pycore_state.h" #include "grammar.h" #include "node.h" #include "token.h" #include "parsetok.h" #include "errcode.h" #include "code.h" #include "symtable.h" #include "ast.h" #include "marshal.h" #include "osdefs.h" #include whereas most header files are useless, pythonrun.c still compiles with: #include "pycore_state.h" #include "token.h" /* INDENT in err_input() */ #include "parsetok.h" /* PyParser_ParseFileObject() */ #include "errcode.h" /* E_EOF */ #include "symtable.h" /* PySymtable_BuildObject() */ #include "ast.h" /* PyAST_FromNodeObject() */ #include "marshal.h" /* PyMarshal_ReadLongFromFile */ #include I propose to add explicit dependencies in header files directly, rather than using black magic in C files. Attached PR fix this issue. ---------- components: Interpreter Core messages: 329359 nosy: vstinner priority: normal severity: normal status: open title: Add missing dependencies between AST/parser header files versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 6 10:07:10 2018 From: report at bugs.python.org (Tashrif Billah) Date: Tue, 06 Nov 2018 15:07:10 +0000 Subject: [New-bugs-announce] [issue35178] Typo/trivial mistake in warnings.py (may be related to 2.x to 3.x conversion) Message-ID: <1541516830.55.0.788709270274.issue35178@psf.upfronthosting.co.za> New submission from Tashrif Billah : ``` 2018-11-06 09:51:27,314 /home/tb571/Downloads/pnlpipe/pnlscripts/wmql.py DEBUG Running ['/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/scripts/tract_math', '/home/tb571/Downloads/pnlpipe/_data/003_GNX_007/Ukf-003_GNX_007-761f2a551e.vtk', 'tract_remove_short_tracts', '2', '/tmp/tmpq2z9fmfc/ukfpruned.vtk'] Traceback (most recent call last): File "/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/scripts/tract_math", line 115, in main tractography, *args.operation_parameters) File "/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tract_math/decorator.py", line 141, in wrapper process_output(out, file_output=file_output) File "/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tract_math/decorator.py", line 176, in process_output tractography_to_file(file_output, output) File "/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tractography/__init__.py", line 85, in tractography_to_file return tractography_to_vtk_file(filename, tractography, **kwargs) File "/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tractography/vtkInterface.py", line 29, in tractography_to_vtk_file tractography.tracts_data() File "/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tractography/vtkInterface.py", line 324, in write_vtkPolyData poly_data = tracts_to_vtkPolyData(tracts, tracts_data=tracts_data) File "/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tractography/vtkInterface.py", line 267, in tracts_to_vtkPolyData vtk_ids = ns.numpy_to_vtkIdTypeArray(ids, deep=True) File "/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/site-packages/vtk/util/numpy_support.py", line 198, in numpy_to_vtkIdTypeArray return numpy_to_vtk(num_array, deep, vtk.VTK_ID_TYPE) File "/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/site-packages/vtk/util/numpy_support.py", line 137, in numpy_to_vtk assert not numpy.issubdtype(z.dtype, complex), \ File "/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/site-packages/numpy/core/numerictypes.py", line 743, in issubdtype FutureWarning, stacklevel=2 File "/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/warnings.py", line 101, in _showwarnmsg _showwarnmsg_impl(msg) File "/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/warnings.py", line 28, in _showwarnmsg_impl text = _formatwarnmsg(msg) File "/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/warnings.py", line 116, in _formatwarnmsg msg.filename, msg.lineno, line= msg.line) TypeError: custom_formatwarning() got an unexpected keyword argument 'line' ``` ---------- components: Argument Clinic messages: 329363 nosy: larry, tashrifbillah priority: normal pull_requests: 9663 severity: normal status: open title: Typo/trivial mistake in warnings.py (may be related to 2.x to 3.x conversion) type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 6 11:41:31 2018 From: report at bugs.python.org (Andrew Svetlov) Date: Tue, 06 Nov 2018 16:41:31 +0000 Subject: [New-bugs-announce] [issue35179] Limit max sendfile chunk to 0x7ffff000 Message-ID: <1541522491.35.0.788709270274.issue35179@psf.upfronthosting.co.za> New submission from Andrew Svetlov : On Linux maximum data size for sendfile call is 0x7ffff000: sendfile() will transfer at most 0x7ffff000 (2,147,479,552) bytes, returning the number of bytes actually transferred. (This is true on both 32-bit and 64-bit systems.) Limiting max block size to this value on all OSes makes sense: splitting transferring the very huge file into several syscalls doesn't hurt performance anyway. Windows uses DWORD for size in TransmitFile, so the size is limited as well. ---------- components: macOS messages: 329366 nosy: asvetlov, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Limit max sendfile chunk to 0x7ffff000 versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 6 11:47:10 2018 From: report at bugs.python.org (Bob) Date: Tue, 06 Nov 2018 16:47:10 +0000 Subject: [New-bugs-announce] [issue35180] Ctypes segfault or TypeError tested for python2.7 and 3 Message-ID: <1541522830.02.0.788709270274.issue35180@psf.upfronthosting.co.za> New submission from Bob : ~Description of the problem: I was using ctypes to get a directory file descriptor, and to do so I found this mailing list (https://lists.gt.net/python/dev/696028) from 2008 where a user wrote a piece that could do what the asking user and me were looking for. What concerns me is how much this code has been used when I looked though Github and Google and came across the same exact pieces. The code provided looks like this: from ctypes import CDLL, c_char_p, c_int, Structure, POINTER from ctypes.util import find_library class c_dir(Structure): """Opaque type for directory entries, corresponds to struct DIR""" c_dir_p = POINTER(c_dir) c_lib = CDLL(find_library("c")) opendir = c_lib.opendir opendir.argtypes = [c_char_p] opendir.restype = c_dir_p dirfd = c_lib.dirfd < -- IT FAILS HERE // STACK TRACE PROVIDED dirfd.argtypes = [c_dir_p] dirfd.restype = c_int closedir = c_lib.closedir closedir.argtypes = [c_dir_p] closedir.restype = c_int dir_p = opendir(".") print "dir_p = %r" % dir_p dir_fd = dirfd(dir_p) print "dir_fd = %r" % dir_fd print "closed (rc %r)" % closedir(dir_p) When I implemented it in my machine, I changed it a bit so "opendir()" got its arguments from an imputed value, and the final program looks like this: from ctypes import * import sys import ctypes from ctypes.util import find_library class c_dir(Structure): """Opaque type for directory entries, corresponds to struct DIR""" def get_directory_file_descriptor(directory): c_dir_p = POINTER(c_dir) c_lib = CDLL(find_library("c")) opendir = c_lib.opendir opendir.argtypes = [c_char_p] opendir.restype = c_dir_p dirfd = c_lib.dirfd < -- SAME. FAILS HERE. dirfd.argtypes = [c_dir_p] dirfd.restype = c_int closedir = c_lib.closedir closedir.argtypes = [c_dir_p] closedir.restype = c_int dir_p = opendir("%s" % directory) print ("dir_p = %s:%r" % (directory, dir_p)) dir_fd = dirfd(dir_p) print("dir_fd = %r" % dir_fd) print ("closed (rc %r)" % closedir(dir_p)) get_directory_file_descriptor(sys.argv[1]) When I run it *with python 2.7*, the program runs normally if I enter the expected value, like "/home/". But if I don't, the program exits with a segmentation fault. In python 3, it fails no matter what with a TypeError. INPUT when NOT giving the error (in python 2.7): /home/ INPUT when giving the error: aaa ~Stack trace from python 2.7: Program received signal SIGSEGV, Segmentation fault. dirfd (dirp=0x0) at ../sysdeps/posix/dirfd.c:27 27 ../sysdeps/posix/dirfd.c: No such file or directory. (gdb) bt #0 dirfd (dirp=0x0) at ../sysdeps/posix/dirfd.c:27 #1 0x00007ffff6698e40 in ffi_call_unix64 () from /usr/lib/x86_64-linux-gnu/libffi.so.6 #2 0x00007ffff66988ab in ffi_call () from /usr/lib/x86_64-linux-gnu/libffi.so.6 #3 0x00007ffff68a83df in _call_function_pointer (argcount=1, resmem=0x7fffffffd630, restype=, atypes=, avalues=0x7fffffffd610, pProc=0x7ffff78b8960 , flags=4353) at /build/python2.7-dPs3Rr/python2.7-2.7.12/Modules/_ctypes/callproc.c:837 #4 _ctypes_callproc (pProc=0x7ffff78b8960 , argtuple=, flags=4353, argtypes=(,), restype=<_ctypes.PyCSimpleType at remote 0xa38ce0>, checker=0x0) at /build/python2.7-dPs3Rr/python2.7-2.7.12/Modules/_ctypes/callproc.c:1180 #5 0x00007ffff68acd82 in PyCFuncPtr_call.lto_priv.107 (self=self at entry=0x7ffff7e322c0, inargs=inargs at entry=(,), kwds=kwds at entry=0x0) at /build/python2.7-dPs3Rr/python2.7-2.7.12/Modules/_ctypes/_ctypes.c:3954 #6 0x00000000004c15bf in PyObject_Call (kw=0x0, arg=(,), func=<_FuncPtr(__name__='dirfd') at remote 0x7ffff7e322c0>) at ../Objects/abstract.c:2546 #7 do_call (nk=, na=, pp_stack=0x7fffffffd890, func=<_FuncPtr(__name__='dirfd') at remote 0x7ffff7e322c0>) at ../Python/ceval.c:4567 #8 call_function (oparg=, pp_stack=0x7fffffffd890) at ../Python/ceval.c:4372 #9 PyEval_EvalFrameEx () at ../Python/ceval.c:2987 #10 0x00000000004c136f in fast_function (nk=, na=, n=1, pp_stack=0x7fffffffd9b0, func=) at ../Python/ceval.c:4435 #11 call_function (oparg=, pp_stack=0x7fffffffd9b0) at ../Python/ceval.c:4370 #12 PyEval_EvalFrameEx () at ../Python/ceval.c:2987 #13 0x00000000004b9ab6 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582 #14 0x00000000004eb30f in PyEval_EvalCode ( locals={'c_void_p': <_ctypes.PyCSimpleType at remote 0xa3df50>, 'c_int64': <_ctypes.PyCSimpleType at remote 0xa1d7b0>, 'c_ssize_t': <_ctypes.PyCSimpleType at remote 0xa1d7b0>, 'c_longdouble': <_ctypes.PyCSimpleType at remote 0xa3c360>, 'Union': <_ctypes.UnionType at remote 0x7ffff6abc400>, 'cdll': ) at remote 0x7ffff7e2c450>, 'c_wchar': <_ctypes.PyCSimpleType at remote 0xa3f0b0>, 'memset': , 'c_bool': <_ctypes.PyCSimpleType at remote 0xa3e620>, 'CFUNCTYPE': , 'DEFAULT_MODE': 0, 'string_at': , 'c_voidp': <_ctypes.PyCSimpleType at re---Type to continue, or q to quit--- mote 0xa3df50>, '__name__': '__main__', 'c_uint64': <_ctypes.PyCSimpleType at remote 0xa367b0>, 'sizeof': , 'byref': , 'pointer': , 'alignment': , 'pydll': ) at remote 0x7ffff7e2c...(truncated), globals={'c_void_p': <_ctypes.PyCSimpleType at remote 0xa3df50>, 'c_int64': <_ctypes.PyCSimpleType at remote 0xa1d7b0>, 'c_ssize_t': <_ctypes.PyCSimpleType at remote 0xa1d7b0>, 'c_longdouble': <_ctypes.PyCSimpleType at remote 0xa3c360>, 'Union': <_ctypes.UnionType at remote 0x7ffff6abc400>, 'cdll': ) at remote 0x7ffff7e2c450>, 'c_wchar': <_ctypes.PyCSimpleType at remote 0xa3f0b0>, 'memset': , 'c_bool': <_ctypes.PyCSimpleType at remote 0xa3e620>, 'CFUNCTYPE': , 'DEFAULT_MODE': 0, 'string_at': , 'c_voidp': <_ctypes.PyCSimpleType at remote 0xa3df50>, '__name__': '__main__', 'c_uint64': <_ctypes.PyCSimpleType at remote 0xa367b0>, 'sizeof': , 'byref': , 'pointer': , 'alignment': , 'pydll': ) at remote 0x7ffff7e2c...(truncated), co=0x7ffff7ed2d30) at ../Python/ceval.c:669 #15 run_mod.lto_priv () at ../Python/pythonrun.c:1376 #16 0x00000000004e5422 in PyRun_FileExFlags () at ../Python/pythonrun.c:1362 #17 0x00000000004e3cd6 in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:948 #18 0x0000000000493ae2 in Py_Main () at ../Modules/main.c:640 #19 0x00007ffff7810830 in __libc_start_main (main=0x4934c0
, argc=3, argv=0x7fffffffddf8, init=, fini=, rtld_fini=, stack_end=0x7fffffffdde8) at ../csu/libc-start.c:291 #20 0x00000000004933e9 in _start () ~The reason I thought that this may be a bug is because while researching the problem, I came across this other bug (https://bugzilla.redhat.com/show_bug.cgi?id=674206) where the user specifies a similar issue for RedHat. The difference, though, is that in that case it could be fixed by specifying the argtypes, while in my case it's already specified. I tested this on an Ubuntu 16.04 and ArchLinux machine and got the same results. ---------- components: ctypes messages: 329367 nosy: execve priority: normal severity: normal status: open title: Ctypes segfault or TypeError tested for python2.7 and 3 versions: Python 2.7, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 6 17:29:09 2018 From: report at bugs.python.org (Julien Palard) Date: Tue, 06 Nov 2018 22:29:09 +0000 Subject: [New-bugs-announce] [issue35181] Doc: Namespace Packages: Inconsistent documentation of __loader__ being None Message-ID: <1541543349.68.0.788709270274.issue35181@psf.upfronthosting.co.za> New submission from Julien Palard : The documentation states that a __loader__ of a namespace package should be None: - [1] "For namespace packages this should be set to None." - [2] "To indicate to the import machinery that the spec represents a namespace portion. the path entry finder sets ?loader? on the spec to None". But this looks wrong [3], looks like it has been changed in [4]/[5]. I think one should rely on __file__ being None on namespace packages (which make sense as they span over multiple directories) instead of __loader__ being None (a side effect of the import machinery ?). [1]: https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec.loader [2]: https://docs.python.org/3/reference/import.html#path-entry-finder-protocol [3]: https://stackoverflow.com/questions/52869541/namespace-package-spec-loader-and-loader-attributes-not-set-to-none [4]: https://bugs.python.org/issue32303 [5]: https://github.com/python/cpython/pull/5481/files#diff-a6592cec2ebc8dba9bbf7d396370b138L319 ---------- assignee: docs at python components: Documentation messages: 329392 nosy: docs at python, mdk priority: normal severity: normal status: open title: Doc: Namespace Packages: Inconsistent documentation of __loader__ being None versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 7 05:23:30 2018 From: report at bugs.python.org (Andriy Maletsky) Date: Wed, 07 Nov 2018 10:23:30 +0000 Subject: [New-bugs-announce] [issue35182] Popen.communicate() breaks when child closes its side of pipe but not exits Message-ID: <1541586210.62.0.788709270274.issue35182@psf.upfronthosting.co.za> New submission from Andriy Maletsky : When communicate() is called in a loop, it crashes when the child process has already closed any piped standard stream, but still continues to be running. How this happens: 1) the parent waits for the child events inside communicate() call 2) the child closes its side of any attached pipes long before exiting (in my case there is some complex c++ application which had messed with its termination) 3) communicate() receives an epoll event, tries to read/write, receives SIGPIPE (for stdin) or EOF (for stdout), decides to close corresponding file descriptors from its side 4) communicate() waits for the death of the child, but a timeout is fired 5) parent handles timeout exception and calls communicate() again 6) an exception is raised when communicate() tries to register closed file in epoll I think there may be a simple solution: before registering file descriptors in epoll, we may check whether any of them is already closed, and don't register it in that case. Here is a simple reproducible example, ran on Linux 4.15.0-1021-aws x86_64: import subprocess child = subprocess.Popen( ['/usr/local/bin/python3.7', '-c', 'import os, time; os.close(1), time.sleep(30)'], stdout=subprocess.PIPE, ) while True: try: child.communicate(timeout=3) break except subprocess.TimeoutExpired: # do something useful here pass Here is a stacktrace: Traceback (most recent call last): File "test.py", line 10, in child.communicate(timeout=3) File "/usr/local/lib/python3.7/subprocess.py", line 933, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "/usr/local/lib/python3.7/subprocess.py", line 1666, in _communicate selector.register(self.stdout, selectors.EVENT_READ) File "/usr/local/lib/python3.7/selectors.py", line 352, in register key = super().register(fileobj, events, data) File "/usr/local/lib/python3.7/selectors.py", line 238, in register key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data) File "/usr/local/lib/python3.7/selectors.py", line 225, in _fileobj_lookup return _fileobj_to_fd(fileobj) File "/usr/local/lib/python3.7/selectors.py", line 40, in _fileobj_to_fd "{!r}".format(fileobj)) from None ValueError: Invalid file object: <_io.BufferedReader name=3> ---------- messages: 329412 nosy: and800 priority: normal severity: normal status: open title: Popen.communicate() breaks when child closes its side of pipe but not exits type: crash versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 7 06:49:13 2018 From: report at bugs.python.org (Shaun Griffith) Date: Wed, 07 Nov 2018 11:49:13 +0000 Subject: [New-bugs-announce] [issue35183] os.path.splitext documentation needs typical example Message-ID: <1541591353.01.0.788709270274.issue35183@psf.upfronthosting.co.za> New submission from Shaun Griffith : As with many entries on the os.path doc page, splitext needs a typical example. Not grokking the bare minimum text, I had to actually try it in the interpreter to see what it did. The one example that *is* there is an edge case, and does nothing to explain the normal behavior, or why this is the correct behavior for the edge case. Here is where I tripped up: Split the pathname path into a pair (root, ext) such that root + ext == path, and ext is empty or begins with a period and contains at most one period. One interpretation of this is that ext is either empty, or has a period, _and nothing else_. Here are 2 examples for typical use: >>> splitext('readme.txt') ('readme', '.txt') >>> splitext('/some/long/pathname/warble.csv') ('/some/long/pathname/warble', '.csv') ---------- assignee: docs at python components: Documentation messages: 329414 nosy: docs at python, shaungriffith priority: normal severity: normal status: open title: os.path.splitext documentation needs typical example type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 7 11:47:20 2018 From: report at bugs.python.org (=?utf-8?q?Marta_G=C3=B3mez?=) Date: Wed, 07 Nov 2018 16:47:20 +0000 Subject: [New-bugs-announce] [issue35184] Makefile is not correctly generated when compiling pyextat with DXML_POOR_ENTROPY=1 Message-ID: <1541609240.08.0.788709270274.issue35184@psf.upfronthosting.co.za> New submission from Marta G?mez : Hello, I was getting this same error (https://bugs.python.org/issue35139) when compiling pyextat so I added these changes (https://github.com/python/cpython/pull/10291/files) to my Setup.dist. After running ./configure, the generated Makefile throws the following error: $ make Makefile:264: *** missing separator. Stop. I have tried this in both Python 3.7 and 3.6 and I get the error in both (the line numbers are different but the error is the same). I have tested this in both Ubuntu 16/18 and CentOS 7. Any hints in how could I fix this? Best regards, Marta ---------- components: Build messages: 329424 nosy: mgmacias95 priority: normal severity: normal status: open title: Makefile is not correctly generated when compiling pyextat with DXML_POOR_ENTROPY=1 type: compile error versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 7 12:43:57 2018 From: report at bugs.python.org (Ben Spiller) Date: Wed, 07 Nov 2018 17:43:57 +0000 Subject: [New-bugs-announce] [issue35185] Logger race condition - loses lines if removeHandler called from another thread while logging Message-ID: <1541612637.38.0.788709270274.issue35185@psf.upfronthosting.co.za> New submission from Ben Spiller : I just came across a fairly serious thread-safety / race condition bug in the logging.Loggers class, which causes random log lines to be lost i.e. not get passed to some of the registered handlers, if (other, unrelated) handlers are being added/removed using add/removeHandler from another thread during logging. This potentially affects all log handler classes, though for timing reasons I've found it easiest to reproduce with the logging.FileHandler. See attached test program that reproduces this. I did some debugging and looks like although add/removeHandler are protected by _acquireLock(), they modify the self.handlers list in-place, and the callHandlers method iterates over self.handlers with no locking - so if you're unlucky you can end up with some of your handlers not being called. A trivial way to fix the bug is by editing callHandlers and copying the list before iterating over it: - for hdlr in c.handlers: + for hdlr in list(c.handlers): However since that could affect the performance of routine log statements a better fix is probably to change the implementation of add/removeHandler to avoid in-place modification of self.handlers so that (as a result of the GIL) it'll be safe to iterate over the list in callHandlers, e.g. change removeHandler like this: - self.handlers.remove(hdlr) + newhandlers = list(self.handlers) + newhandlers.remove(hdlr) + self.handlers = hdlr (and the equivalent in addHandler) ---------- components: Library (Lib) files: logger-race.py messages: 329429 nosy: benspiller priority: normal severity: normal status: open title: Logger race condition - loses lines if removeHandler called from another thread while logging type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 Added file: https://bugs.python.org/file47914/logger-race.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 7 20:56:11 2018 From: report at bugs.python.org (Paul Ganssle) Date: Thu, 08 Nov 2018 01:56:11 +0000 Subject: [New-bugs-announce] [issue35186] distutils.command.upload uses deprecated platform.dist with bdist_rpm Message-ID: <1541642171.78.0.788709270274.issue35186@psf.upfronthosting.co.za> New submission from Paul Ganssle : It seems that in issue #1322, `platform.dist` was deprecated, and is slated for removal in Python 3.8, but it is currently used in distutils.command.upload.upload_file: https://github.com/python/cpython/blob/6843ffe4533e9f2cde036296fd932fef6f059687/Lib/distutils/command/upload.py#L126 As far as I can tell, this line is hit only when you run `python setup.py bdist_rpm upload`, as far as I can tell. Using the `upload` command is *itself* very deprecated, and is dangerously broken in many ways. See, for example, this setuptools issue: https://github.com/pypa/setuptools/issues/1381 So I see three possible options (two realistic): 1. Remove the whole "comment" field from the upload, both for bdist_rpm and bdist_dumb. I'm not sure if PyPI uses this for anything, but I highly doubt it. 2. Have both bdist_rpm and bdist_dumb send a comment based on `platform.platform(terse=1)` 3. Remove the upload command functionality entirely for Python 3.8 with no deprecation warning. Obviously #3 is the unrealistic one, but it's very tempting. That said, I think we should go with #1 and maybe open a separate issue to actually deprecate the `upload` command in distutils (though to be honest we'll probably monkey-patch it out of existence in setuptools within a year and everyone uses `setuptools` anyway, so maybe #3 is less unrealistic than it seems). ---------- components: Distutils messages: 329453 nosy: dstufft, eric.araujo, p-ganssle priority: normal severity: normal status: open title: distutils.command.upload uses deprecated platform.dist with bdist_rpm versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 8 02:57:46 2018 From: report at bugs.python.org (xiyunlong) Date: Thu, 08 Nov 2018 07:57:46 +0000 Subject: [New-bugs-announce] [issue35187] a bug about np.arrange Message-ID: <1541663866.8.0.788709270274.issue35187@psf.upfronthosting.co.za> New submission from xiyunlong : when I use np.arange as follows: np.arange(1,2.2,0.2) I got the array as [1. , 1.2, 1.4, 1.6, 1.8, 2. , 2.2],we know, the maxvalue 2.2 of the array should not be included in the array. Is this a bug? ---------- components: Library (Lib) messages: 329460 nosy: xyl123 priority: normal severity: normal status: open title: a bug about np.arrange versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 8 07:05:53 2018 From: report at bugs.python.org (xiyunlong) Date: Thu, 08 Nov 2018 12:05:53 +0000 Subject: [New-bugs-announce] [issue35188] something confused about numpy.arange Message-ID: <1541678753.34.0.788709270274.issue35188@psf.upfronthosting.co.za> New submission from xiyunlong : when I use:print(np.arange(1,2.2,0.2)) I got: 1.0 1.2 1.4 1.5999999999999999 1.7999999999999998 1.9999999999999998 2.1999999999999997 could any one tell me why it's not 1.0,1.2,1.4,1.6,1.8,2.0? Many thanks! ---------- components: Library (Lib) messages: 329466 nosy: xyl123 priority: normal severity: normal status: open title: something confused about numpy.arange versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 8 07:45:30 2018 From: report at bugs.python.org (Aapo Samuli Keskimolo) Date: Thu, 08 Nov 2018 12:45:30 +0000 Subject: [New-bugs-announce] [issue35189] EINTR is not being retried Message-ID: <1541681130.38.0.788709270274.issue35189@psf.upfronthosting.co.za> New submission from Aapo Samuli Keskimolo : According to https://www.python.org/dev/peps/pep-0475/ the EINTR interruption should be retried automatically, but somehow it does not work and the exception is raised: 2018-11-05 05:21:35,257 ERROR:storage(23491): Remote storage operation failed (request: '{ 'excludeSubModules': None, 'storageLocation': 'qt/qtdatavis3d/68faa5b00f73096eb096c6acdfce76b052ca20b9/LinuxUbuntu_18_04x86_64LinuxQEMUarm64GCCqtci-linux-Ubuntu-18.04-x86_64-a6 c9f7Release/ac4280d182ec320eaf0e68efaeeeb6be14b9689f/test_1542834179', 'type': 3}') Traceback (most recent call last): File "src/storage.py", line 507, in handle self.handle_upload_artifact(message) File "src/storage.py", line 437, in handle_upload_artifact log.info("upload of %s to %s", uploadType, message.storageLocation) File "/usr/lib/python3.6/logging/__init__.py", line 1306, in info self._log(INFO, msg, args, **kwargs) File "/usr/lib/python3.6/logging/__init__.py", line 1442, in _log self.handle(record) File "/usr/lib/python3.6/logging/__init__.py", line 1452, in handle self.callHandlers(record) File "/usr/lib/python3.6/logging/__init__.py", line 1514, in callHandlers hdlr.handle(record) File "/usr/lib/python3.6/logging/__init__.py", line 861, in handle self.acquire() File "/home/vmbuilder/qt-ci/src/application.py", line 151, in acquire fcntl.lockf(self._lock_fd, fcntl.LOCK_EX) InterruptedError: [Errno 4] Interrupted system call ---------- components: Library (Lib) messages: 329469 nosy: akeskimo priority: normal severity: normal status: open title: EINTR is not being retried type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 8 09:41:26 2018 From: report at bugs.python.org (=?utf-8?q?Miro_Hron=C4=8Dok?=) Date: Thu, 08 Nov 2018 14:41:26 +0000 Subject: [New-bugs-announce] [issue35190] collections.abc.Sequence cannot be used to test whether a class provides a particular interface Message-ID: <1541688086.42.0.788709270274.issue35190@psf.upfronthosting.co.za> New submission from Miro Hron?ok : The collections.abc ? Abstract Base Classes for Containers documentation says: > This module provides abstract base classes that can be used to test whether a class provides a particular interface; for example, whether it is hashable or whether it is a mapping. https://docs.python.org/3/library/collections.abc.html However this is not true for Sequence. When I implement a class that provides a particular interface (defined in the Collections Abstract Base Classes table in that very page), I cannot check whether it implements a Sequence. See an example: from collections import abc class Box: def __init__(self, wrapped): self._w = wrapped def __len__(self): return len(self._w) def __iter__(self): yield from self._w def __getitem__(self, i): return self._w[i] def __reversed__(self): yield from reversed(self._w) def __contains__(self, i): return i in self._w def index(self, value, start=0, stop=None): return self._w.index(value, start, stop) def count(self, value): return self._w.count(value) b = Box([1, 2, 3]) for t in 'Sized', 'Iterable', 'Reversible', 'Container', 'Collection', 'Sequence': print(f'{t}: {isinstance(b, getattr(abc, t))}') My class is Reversible. My class is a Collection (as it is a Sized Iterable Container). It implements __getitem__, __len__, __contains__, __iter__, __reversed__, index, and count. Yet my class instance is not an instance of Sequence. I suppose this behavior might be intentional, as discussed in issue16728 - or it might as well not be. The main concern was that dict also provides these methods, but is not considered a Sequence, however dict does not provide index() or count(). Regardless whether this is right or wrong behavior, as documented this should be a Sequence. See also https://stackoverflow.com/questions/34927949/issubclass-of-abstract-base-class-sequence As I see it, either: collections.abc.Sequence needs a __subclasshook__ so it can be used as the documentation implies. Or: the documentation should not say that "abstract base classes (from abc module) can be used to test whether a class provides a particular interface" if it doesn't generally apply Or: the Sequence documentation should say: "this particular abstract base class cannot be used to test whether a class provides a particular interface because reasons" (yet I don't really get those reasons) ---------- assignee: docs at python components: Documentation, Library (Lib) messages: 329475 nosy: docs at python, hroncok, vstinner priority: normal severity: normal status: open title: collections.abc.Sequence cannot be used to test whether a class provides a particular interface versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 8 10:43:43 2018 From: report at bugs.python.org (Alexey Izbyshev) Date: Thu, 08 Nov 2018 15:43:43 +0000 Subject: [New-bugs-announce] [issue35191] socket.setblocking(x) treats multiples of 2**32 as False Message-ID: <1541691823.13.0.788709270274.issue35191@psf.upfronthosting.co.za> New submission from Alexey Izbyshev : UBSAN with -fsanitize=implicit-integer-truncation reported a suspicious case: testSetBlocking_overflow (test.test_socket.NonBlockingTCPTests) ... /scratch2/izbyshev/cpython/Modules/socketmodule.c:2688:33: runtime error: implicit conversion from type 'long' of value 4294967296 (64-bit, signed) to type 'int' changed the value to 0 (32-bit, signed) It turned out that sock_setblocking() converts its (logically boolean) argument to long, but then passes it to internal_setblocking() which accepts int (https://github.com/python/cpython/blob/fd512d76456b65c529a5bc58d8cfe73e4a10de7a/Modules/socketmodule.c#L2688). This results in unexpected truncation on platforms with 64-bit long. testSetBlocking_overflow() which is supposed to check this doesn't work because it only checks socket timeout which is updated correctly. However, the actual state of socket descriptor is changed to the opposite value (non-blocking) in this case. ---------- components: Extension Modules messages: 329478 nosy: izbyshev, serhiy.storchaka, vstinner priority: normal severity: normal status: open title: socket.setblocking(x) treats multiples of 2**32 as False type: behavior versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 8 15:08:28 2018 From: report at bugs.python.org (Adam Dunlap) Date: Thu, 08 Nov 2018 20:08:28 +0000 Subject: [New-bugs-announce] [issue35192] pathlib mkdir throws FileExistsError when not supposed to Message-ID: <1541707708.76.0.788709270274.issue35192@psf.upfronthosting.co.za> New submission from Adam Dunlap : I have 2 processes (one C, one python) that are started at the same time and both need a certain directory tree to exist to continue, so both processes create the directory tree while ignoring errors about it already existing. In the python process, I'm using pathlib's mkdir function (https://docs.python.org/3/library/pathlib.html#pathlib.Path.mkdir) with parents=True, exist_ok=True, but this is sometimes throwing a FileExistsError. I don't expect this because the documentation says "If exist_ok is true, FileExistsError exceptions will be ignored (same behavior as the POSIX mkdir -p command), but only if the last path component is not an existing non-directory file." The last component is never a non-directory file. I believe what is happening is that mkdir realizes that the parent doesn't exist, so it recursively tries to make the parent directory. However, when it recurses, it uses the default exists_ok value of False. Before the recursive call can make the parent directory, the other process makes the directory. This causes the inner call to throw a FileExistsError. I believe the correct thing to do is to always pass True for exists_ok in the recursive call. ---------- components: Library (Lib) messages: 329484 nosy: Adam Dunlap priority: normal severity: normal status: open title: pathlib mkdir throws FileExistsError when not supposed to type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 8 16:08:35 2018 From: report at bugs.python.org (Gregory P. Smith) Date: Thu, 08 Nov 2018 21:08:35 +0000 Subject: [New-bugs-announce] [issue35193] Off by one error in peephole call to find_op on case RETURN_VALUE Message-ID: <1541711315.03.0.788709270274.issue35193@psf.upfronthosting.co.za> New submission from Gregory P. Smith : An off by one error was introduced to peephole.c by the "off by one error fix" in https://bugs.python.org/issue28517. Clang's memory sanitizer detects it (msan). find_op is ultimately called with h == codelen so it accesses one byte out of bounds. I have a fix, PR coming. ---------- assignee: gregory.p.smith components: Interpreter Core messages: 329485 nosy: gregory.p.smith, serhiy.storchaka priority: normal severity: normal status: open title: Off by one error in peephole call to find_op on case RETURN_VALUE type: crash versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 8 17:55:24 2018 From: report at bugs.python.org (Alexey Izbyshev) Date: Thu, 08 Nov 2018 22:55:24 +0000 Subject: [New-bugs-announce] [issue35194] A typo in a constant in cp932 codec Message-ID: <1541717724.61.0.788709270274.issue35194@psf.upfronthosting.co.za> New submission from Alexey Izbyshev : UBSan with -fsanitize=implicit-integer-truncation found a suspicious one: /scratch2/izbyshev/cpython/Modules/cjkcodecs/_codecs_jp.c:43:17: runtime error: implicit conversion from type 'unsigned int' of value 4294966013 (32-bit, unsigned) to type 'unsigned char' changed the value to 253 (8-bit, unsigned) Indeed, the wrong constant was used (the correct one is used in corresponding decoder code at https://github.com/python/cpython/blob/fd512d76456b65c529a5bc58d8cfe73e4a10de7a/Modules/cjkcodecs/_codecs_jp.c#L105). In this case the truncation was harmless because only the lowest byte of the wrong result was used, and it was correct. But it probably makes sense to fix it if only to reduce noise from UBSan. All Python versions are affected, but I've marked 3.8 only since I'm not sure what the policy for backporting such changes is. ---------- components: Extension Modules messages: 329489 nosy: izbyshev, serhiy.storchaka, vstinner priority: normal severity: normal status: open title: A typo in a constant in cp932 codec type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 8 17:56:21 2018 From: report at bugs.python.org (Dragoljub) Date: Thu, 08 Nov 2018 22:56:21 +0000 Subject: [New-bugs-announce] [issue35195] Pandas read_csv() is 3.5X Slower on Python 3.7.1 vs Python 3.6.7 & 3.5.2 On Windows 10 Message-ID: <1541717781.13.0.788709270274.issue35195@psf.upfronthosting.co.za> New submission from Dragoljub : xref: https://github.com/pandas-dev/pandas/issues/23516 Example: import io import pandas as pd import numpy as np df = pd.DataFrame(np.random.randn(1000000, 10), columns=('COL{}'.format(i) for i in range(10))) csv = io.StringIO(df.to_csv(index=False)) df2 = pd.read_csv(csv) #3.5X slower on Python 3.7.1 pd.read_csv() reads data at 30MB/sec on Python 3.7.1 while at 100MB/sec on Python 3.6.7. This issue seems to be only present on Windows 10 Builds both x86 & x64. Possibly some IO changes in Python 3.7 could have contributed to this slowdown on Windows but not on Linux? ---------- components: IO messages: 329490 nosy: Dragoljub priority: normal severity: normal status: open title: Pandas read_csv() is 3.5X Slower on Python 3.7.1 vs Python 3.6.7 & 3.5.2 On Windows 10 type: performance versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 05:00:52 2018 From: report at bugs.python.org (Raymond Hettinger) Date: Fri, 09 Nov 2018 10:00:52 +0000 Subject: [New-bugs-announce] [issue35196] IDLE text squeezer is too aggressive and is slow Message-ID: <1541757652.98.0.788709270274.issue35196@psf.upfronthosting.co.za> New submission from Raymond Hettinger : The squeezed text is impairing IDLE's usability for teaching purposes. Typing help() on any built-in type such as str immediately results in a squeeze-button rather than displaying help. The same is true for showing lines from a file read or from a URL. I recommend showing the first 50 to 100 lines and then squeezing the remainder. Also, I think this may be the logic that is slowing down successive print calls in a loop. Try running: for i in range(500): print(i, sep=' ') or even: for i in range(500): print(i, i**2) The output has noticeably slow delays between successive print() calls. ---------- assignee: terry.reedy components: IDLE messages: 329507 nosy: rhettinger, terry.reedy priority: normal severity: normal status: open title: IDLE text squeezer is too aggressive and is slow type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 09:06:44 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 09 Nov 2018 14:06:44 +0000 Subject: [New-bugs-announce] [issue35197] graminit.h defines very generic names like 'stmt' or 'test' Message-ID: <1541772404.82.0.788709270274.issue35197@psf.upfronthosting.co.za> New submission from STINNER Victor : graminit.h is an header file associating Grammar entities to their values, example: #define stmt 269 Problem: defines symbols have no prefix and cause compilation issues on regular C code depending where graminit.h is included. Example with ast.c: static int validate_stmt(stmt_ty stmt) { ... } "#define stmt 269" causes a compilation issue, the preprocessor replaces the code with: static int validate_stmt(stmt_ty 269) { ... } ... which is invalid. Another example: return validate_expr(exp->v.IfExp.test, Load) && validate_expr(exp->v.IfExp.body, Load) && validate_expr(exp->v.IfExp.orelse, Load); The preprocessor replaces "exp->v.IfExp.test" with "exp->v.IfExp.305" which is invalid... The compile.h header file works around the issue by redefining 3 constants but using "Py_" prefix: /* These definitions must match corresponding definitions in graminit.h. There's code in compile.c that checks that they are the same. */ #define Py_single_input 256 #define Py_file_input 257 #define Py_eval_input 258 For comparison, graminit.h uses: #define single_input 256 #define file_input 257 #define eval_input 258 There are different solutions: * Do nothing: require to include graminit.h at the right place * Add a prefix to all symbols, ex: test => Py_test, grammar_test, etc. * Rename problematic names like 'test' and 'stmt' * Fix C code to avoid problematic name: 'test' is an an attribute name of a node struct... Note: "static const int single_input = 305;" cause a complation error on "case single_input": "case label does not reduce to an integer constant". IMHO adding a prefix would be a nice enhancement and a good compromise. It only impacts the four C files which include graminit.h: future.c, ast.c, parsetok.c and parsermodule.c. ---------- components: Interpreter Core messages: 329517 nosy: vstinner priority: normal severity: normal status: open title: graminit.h defines very generic names like 'stmt' or 'test' versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 10:20:45 2018 From: report at bugs.python.org (Ayappan) Date: Fri, 09 Nov 2018 15:20:45 +0000 Subject: [New-bugs-announce] [issue35198] Build issue while compiling cpp files in AIX Message-ID: <1541776845.13.0.788709270274.issue35198@psf.upfronthosting.co.za> New submission from Ayappan : I am trying to build pandas-0.23.4 using python3 in AIX. Everything goes fine till it encounters a cpp file. Below is the compile error output. building 'pandas._libs.window' extension gcc -fPIC -maix64 -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -I/usr/include -I/opt/freeware/include -I/opt/freeware/include/ncurses -DAIX_GENUINE_CPLUSCPLUS -D_LINUX_SOURCE_COMPAT -Wl,-brtl -O2 -Ipandas/_libs/src/klib -Ipandas/_libs/src -I/opt/freeware/lib64/python3.6/site-packages/numpy/core/include -I/opt/freeware/include/python3.6m -c pandas/_libs/window.cpp -o build/temp.aix-7.2-3.6/pandas/_libs/window.o -Wno-unused-function In file included from /opt/freeware/lib64/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1821, from /opt/freeware/lib64/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18, from /opt/freeware/lib64/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4, from pandas/_libs/window.cpp:587: /opt/freeware/lib64/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp] #warning "Using deprecated NumPy API, disable it by " \ ^~~~~~~ g++ gcc -maix64 -pthread -bI:/opt/freeware/lib/python3.6/config-3.6m/python.exp -L. -L/usr/include -L/opt/freeware/include -L/usr/lib/threads -L/opt/freeware/lib64 -L/opt/freeware/lib -L/usr/lib64 -L/usr/lib -L. -L/usr/include -L/opt/freeware/include -L/usr/lib/threads -L/opt/freeware/lib64 -L/opt/freeware/lib -L/usr/lib64 -L/usr/lib build/temp.aix-7.2-3.6/pandas/_libs/window.o -L/opt/freeware/lib64 -o build/lib.aix-7.2-3.6/pandas/_libs/window.so g++: error: gcc: No such file or directory g++: error: unrecognized command line option '-bI:/opt/freeware/lib/python3.6/config-3.6m/python.exp' error: command 'g++' failed with exit status 1 Seems like somewhere setting up the proper compile options for compiling cpp files is not proper. Any hint will be really useful. ---------- components: Build messages: 329522 nosy: Ayappan priority: normal severity: normal status: open title: Build issue while compiling cpp files in AIX type: compile error versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 10:32:02 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 09 Nov 2018 15:32:02 +0000 Subject: [New-bugs-announce] [issue35199] Convert PyTuple_GET_ITEM() macro to a function call with additional checks in debug mode Message-ID: <1541777522.86.0.788709270274.issue35199@psf.upfronthosting.co.za> New submission from STINNER Victor : Currently, even when Python is compiled in debug mode, PyTuple_GET_ITEM() doesn't check that the first argument is a tuple objet and that the second argument is valid index. It can lead to a crash and Python doesn't help debugging. I propose to convert the macro to a function call and use regular assertions to abort Python if the C API is misused. I propose to use a function call rather than abusing the preprocessor syntax like (assert(...),expr) syntax used in unicodeobject.h, because I the preprocessor causes complex bugs (difficult to understand and to fix/work around) and because later I would like to experiment to be able to compile C extensions to always use function calls, but get a different implementation depending on the "Python runtime". I elaborated this idea on this website: * https://pythoncapi.readthedocs.io/runtimes.html#debug-build * https://pythoncapi.readthedocs.io/ I am working on an implementation. ---------- components: Interpreter Core messages: 329523 nosy: vstinner priority: normal severity: normal status: open title: Convert PyTuple_GET_ITEM() macro to a function call with additional checks in debug mode versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 11:25:51 2018 From: report at bugs.python.org (Julien Palard) Date: Fri, 09 Nov 2018 16:25:51 +0000 Subject: [New-bugs-announce] [issue35200] Range repr could be better Message-ID: <1541780751.51.0.788709270274.issue35200@psf.upfronthosting.co.za> New submission from Julien Palard : This morning I was teaching Python (again and again), and again I was thinking we could do better about the representation of ranges. Typically in the current repr of ranges we do not see that the end is excluded: >>> range(10) range(0, 10) However it has the (little?) benefit of respecting the "repr gives valid Python". I propose to change it to: >>> range(10) ---------- messages: 329531 nosy: mdk priority: normal severity: normal status: open title: Range repr could be better type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 11:54:51 2018 From: report at bugs.python.org (Daniel Israel) Date: Fri, 09 Nov 2018 16:54:51 +0000 Subject: [New-bugs-announce] [issue35201] Recursive '**' matches non-existent directories. Message-ID: <1541782491.74.0.788709270274.issue35201@psf.upfronthosting.co.za> New submission from Daniel Israel : In the following case, when there is no file or directory 'a', glob will still return it: >>> glob.glob("a/**", recursive=True) [ 'a/' ] Note that this is inconsistent with the '*' pattern: >>> glob.glob("a/*", recursive=True) [] ---------- components: Library (Lib) messages: 329537 nosy: daniel priority: normal severity: normal status: open title: Recursive '**' matches non-existent directories. type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 14:09:12 2018 From: report at bugs.python.org (=?utf-8?b?U3Jpbml2YXMgIFJlZGR5IFRoYXRpcGFydGh5KOCwtuCxjeCwsOCxgOCwqA==?= =?utf-8?b?4LC/4LC14LC+4LC44LGNIOCwsOCxhuCwoeCxjeCwoeCwvyDgsKTgsL7gsJ8=?= =?utf-8?b?4LC/4LCq4LCw4LGN4LCk4LC/KQ==?=) Date: Fri, 09 Nov 2018 19:09:12 +0000 Subject: [New-bugs-announce] [issue35202] Remove unused imports in standard library Message-ID: <1541790552.02.0.788709270274.issue35202@psf.upfronthosting.co.za> New submission from Srinivas Reddy Thatiparthy(?????????? ?????? ?????????) : Please find the modules where we need to remove. codecs.py:1105:5: F401 'encodings' imported but unused code.py:298:13: F401 'readline' imported but unused platform.py:118:1: F401 'warnings' imported but unused platform.py:509:9: F401 'java.lang' imported but unused pstats.py:562:9: F401 'readline' imported but unused shutil.py:13:1: F401 'io' imported but unused site.py:409:13: F401 'rlcompleter' imported but unused site.py:511:13: F401 'sitecustomize' imported but unused site.py:531:13: F401 'usercustomize' imported but unused trace.py:54:1: F401 're' imported but unused typing.py:21:1: F401 'abc' imported but unused I was just wondering that as a community, do we recommend this practice of cleaning up Or just we keep as is inorder to NOT to break accidental imports? ---------- messages: 329548 nosy: thatiparthy priority: normal severity: normal status: open title: Remove unused imports in standard library _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 14:27:37 2018 From: report at bugs.python.org (Dexter) Date: Fri, 09 Nov 2018 19:27:37 +0000 Subject: [New-bugs-announce] [issue35203] Windows Installer Ignores Launcher Installer Options Where The Python Launcher Is Already Present Message-ID: <1541791657.21.0.788709270274.issue35203@psf.upfronthosting.co.za> New submission from Dexter : When installing Python 3.7 from the Windows Installer in a restricted environment the installer appears to ignore the InstallLauncherAllUsers=0 and Include_launcher=0 flags if the launcher is already present from a previous install. I am on a machine where the system python is centrally controlled and cannot be modified by me. In previous versions I have installed personal copies using the InstallLauncherAllUsers=0 InstallAllUsers=0 as exemplified in the docs or just unticking in the UI. However in 3.7 the tick-box for the launcher is ticked but greyed out in the UI. I am unable to de-select it and, as I do not have permission to modify the system wide launcher, I cannot install Python 3.7. My suspicion is that the box is greyed out if someone has installed the site wide version to ensure the site wide version is in-line with the installer but: a) What if this is an older version and I do not want it replaced. b) What if a user like me can't upgrade that script and is happy to have a version that will not be understood by the launcher for other purposes. Assuming there is no current workaround. I propose that either we remove this restriction or at least allow an override. e.g. ForceExistingLauncherUpgrade=1 by default to preserve current behaviour and if 0 then allow the other launcher exclusions to apply. ---------- components: Windows messages: 329550 nosy: gr-dexterl, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Windows Installer Ignores Launcher Installer Options Where The Python Launcher Is Already Present type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 17:33:27 2018 From: report at bugs.python.org (Alexey Izbyshev) Date: Fri, 09 Nov 2018 22:33:27 +0000 Subject: [New-bugs-announce] [issue35204] Disable thread and memory sanitizers for address_in_range() Message-ID: <1541802807.41.0.788709270274.issue35204@psf.upfronthosting.co.za> New submission from Alexey Izbyshev : address_in_range() in Objects/obmalloc.c may access memory that is mapped but is considered free by the underlying libc allocator. In #18596, address sanitizing was disabled for this function. But thread and memory sanitizers similarly trip on this function: WARNING: ThreadSanitizer: heap-use-after-free (pid=24361) Read of size 4 at 0x7b7c00000020 by main thread: #0 address_in_range /scratch2/izbyshev/cpython/Objects/obmalloc.c:1312:23 (python+0x59e912) ==3515==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x9713f8 in address_in_range /scratch2/izbyshev/cpython/Objects/obmalloc.c:1313:35 I suggest to disable them for this function as well. ---------- components: Interpreter Core messages: 329561 nosy: benjamin.peterson, izbyshev, serhiy.storchaka, vstinner priority: normal severity: normal status: open title: Disable thread and memory sanitizers for address_in_range() type: enhancement versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 19:15:57 2018 From: report at bugs.python.org (wenjun.o) Date: Sat, 10 Nov 2018 00:15:57 +0000 Subject: [New-bugs-announce] [issue35205] os.path.realpath preserves the trailing backslash on Windows in python 3.6.7 and python 3.7.1 Message-ID: <1541808957.5.0.788709270274.issue35205@psf.upfronthosting.co.za> New submission from wenjun.o : The statement "os.path.realpath('C:\\Users\\')" returns different results between 3.6.6 and 3.6.7 (and between 3.7.0 and 3.7.1) on Windows. With python 3.6.6 and 3.7.0 I got 'C:\\Users'. With python 3.6.7 and 3.7.1 I got 'C:\\Users\\'. Note the extra trailing backslash with python 3.6.7 and 3.7.1. On Linux the behavior is consistent where the trailing slash in the input will be remove from the output: os.path.realpath('/home/') --> '/home'. I think we should keep the behavior of removing trailing backslash on Windows. Thanks. ---------- components: Library (Lib) messages: 329574 nosy: wouyang priority: normal severity: normal status: open title: os.path.realpath preserves the trailing backslash on Windows in python 3.6.7 and python 3.7.1 type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 20:37:33 2018 From: report at bugs.python.org (STINNER Victor) Date: Sat, 10 Nov 2018 01:37:33 +0000 Subject: [New-bugs-announce] [issue35206] Add new experimental _Py_CAPI2 API Message-ID: <1541813853.84.0.788709270274.issue35206@psf.upfronthosting.co.za> New submission from STINNER Victor : Add a new experimental "_Py_CAPI2" API: opt-in which doesn't leak implementation details and replace macros with function calls. Attached PR modified PyTuple_GET_ITEM() if _Py_CAPI2 is defined. With this API, PyTuple_GET_ITEM() macro becomes a function call and the implementation uses assertions to check if the first argument is a tuple and that the index is valid. It should help to investigate bugs when Python is compiled in debug mode. This issue implements the idea that I proposed on python-dev: https://mail.python.org/pipermail/python-dev/2018-November/155702.html ---------- components: Interpreter Core messages: 329583 nosy: vstinner priority: normal severity: normal status: open title: Add new experimental _Py_CAPI2 API versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 9 23:13:18 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Sat, 10 Nov 2018 04:13:18 +0000 Subject: [New-bugs-announce] [issue35207] Disallow expressions like (a) = 42 Message-ID: <1541823198.59.0.788709270274.issue35207@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : As commented on Issue33878, the fact that expressions like (x) = 42 are accepted is, in reality, an implementation detail and they should be disallowed. ---------- assignee: pablogsal components: Interpreter Core messages: 329590 nosy: pablogsal priority: normal severity: normal status: open title: Disallow expressions like (a) = 42 versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 10 02:18:21 2018 From: report at bugs.python.org (Tal Einat) Date: Sat, 10 Nov 2018 07:18:21 +0000 Subject: [New-bugs-announce] [issue35208] IDLE: Squeezed lines count ignores window width Message-ID: <1541834301.3.0.788709270274.issue35208@psf.upfronthosting.co.za> New submission from Tal Einat : Squeezing a single long line with a newline, e.g. 'a'*200, results in "Squeezed text (1 lines)". Also, changing the width of the window (even to very small widths) doesn't affect the number of lines reported when squeezing (when squeezing *after* the width change). ---------- assignee: terry.reedy components: IDLE messages: 329600 nosy: taleinat, terry.reedy priority: normal severity: normal status: open title: IDLE: Squeezed lines count ignores window width type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 10 05:56:38 2018 From: report at bugs.python.org (remi bertholet) Date: Sat, 10 Nov 2018 10:56:38 +0000 Subject: [New-bugs-announce] [issue35209] Crash with tkinter text on osx Message-ID: <1541847398.17.0.788709270274.issue35209@psf.upfronthosting.co.za> New submission from remi bertholet : Hello, If I press the key "Alt-Shift-F" with script it crash all times. I reproduces the same crash with Python 2.7. To reproduce it, on terminal osx 10.13.6 (17G3025) : - run "python3 ScrollFrame.py" - Click one time on tk window (it show on foreground) - Press "Ctrl-Alt-F" (all other alt produce the same crash) - And you obtain the crash next : The crash on python 3.7 : 2018-11-10 11:50:30.702 Python[3095:292595] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFConstantString characterAtIndex:]: Range or index out of bounds' *** First throw call stack: ( 0 CoreFoundation 0x00007fff2b04123b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00007fff522d2c76 objc_exception_throw + 48 2 CoreFoundation 0x00007fff2b0d2d5d +[NSException raise:format:] + 205 3 CoreFoundation 0x00007fff2afbd236 -[__NSCFString characterAtIndex:] + 102 4 Tk 0x00007fff37721343 TkpInitKeymapInfo + 731 5 Tk 0x00007fff377271a1 Tk_MacOSXSetupTkNotifier + 798 6 Tcl 0x00007fff37621a50 Tcl_DoOneEvent + 300 7 _tkinter.cpython-37m-darwin.so 0x000000010dd957ac _tkinter_tkapp_mainloop + 256 8 Python 0x000000010d3d4f42 _PyMethodDef_RawFastCallKeywords + 525 9 Python 0x000000010d3d981e _PyMethodDescr_FastCallKeywords + 82 10 Python 0x000000010d46b1a2 call_function + 615 11 Python 0x000000010d4622ec _PyEval_EvalFrameDefault + 2579 12 Python 0x000000010d46bad1 _PyEval_EvalCodeWithName + 1837 13 Python 0x000000010d3d4474 _PyFunction_FastCallKeywords + 225 14 Python 0x000000010d46b17a call_function + 575 15 Python 0x000000010d462305 _PyEval_EvalFrameDefault + 2604 16 Python 0x000000010d46bad1 _PyEval_EvalCodeWithName + 1837 17 Python 0x000000010d461851 PyEval_EvalCode + 42 18 Python 0x000000010d490a5f run_mod + 54 19 Python 0x000000010d48fa7a PyRun_FileExFlags + 164 20 Python 0x000000010d48f159 PyRun_SimpleFileExFlags + 283 21 Python 0x000000010d4a6842 pymain_main + 5114 22 Python 0x000000010d4a6fd4 _Py_UnixMain + 104 23 libdyld.dylib 0x00007fff52eec015 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException Abort trap: 6 The crash on python 2.7 : 2018-11-10 11:51:34.728 Python[3104:294757] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFConstantString characterAtIndex:]: Range or index out of bounds' *** First throw call stack: ( 0 CoreFoundation 0x00007fff2b04123b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00007fff522d2c76 objc_exception_throw + 48 2 CoreFoundation 0x00007fff2b0d2d5d +[NSException raise:format:] + 205 3 CoreFoundation 0x00007fff2afbd236 -[__NSCFString characterAtIndex:] + 102 4 Tk 0x00007fff37721343 TkpInitKeymapInfo + 731 5 Tk 0x00007fff377271a1 Tk_MacOSXSetupTkNotifier + 798 6 Tcl 0x00007fff37621a50 Tcl_DoOneEvent + 300 7 _tkinter.so 0x00000001026cca77 Tkapp_MainLoop + 354 8 Python 0x000000010236a357 PyEval_EvalFrameEx + 19822 9 Python 0x00000001023653d2 PyEval_EvalCodeEx + 1562 10 Python 0x000000010236e4d7 fast_function + 290 11 Python 0x000000010236a25a PyEval_EvalFrameEx + 19569 12 Python 0x00000001023653d2 PyEval_EvalCodeEx + 1562 13 Python 0x0000000102364db2 PyEval_EvalCode + 32 14 Python 0x000000010238679b run_mod + 49 15 Python 0x0000000102386842 PyRun_FileExFlags + 130 16 Python 0x00000001023863c4 PyRun_SimpleFileExFlags + 706 17 Python 0x0000000102397f44 Py_Main + 3136 18 libdyld.dylib 0x00007fff52eec015 start + 1 19 ??? 0x0000000000000002 0x0 + 2 ) libc++abi.dylib: terminating with uncaught exception of type NSException Abort trap: 6 ---------- components: Tkinter files: ScrollFrame.py messages: 329606 nosy: remi_bertholet priority: normal severity: normal status: open title: Crash with tkinter text on osx versions: Python 3.7 Added file: https://bugs.python.org/file47918/ScrollFrame.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 10 12:23:52 2018 From: report at bugs.python.org (tzickel) Date: Sat, 10 Nov 2018 17:23:52 +0000 Subject: [New-bugs-announce] [issue35210] Use bytes + memoryview + resize instead of bytesarray + array in io.RawIOBase.read Message-ID: <1541870632.41.0.788709270274.issue35210@psf.upfronthosting.co.za> New submission from tzickel : There was a TODO in the code about this: https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Modules/_io/iobase.c#L909 ---------- components: IO messages: 329629 nosy: tzickel priority: normal severity: normal status: open title: Use bytes + memoryview + resize instead of bytesarray + array in io.RawIOBase.read type: performance versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 10 14:39:52 2018 From: report at bugs.python.org (bob moth) Date: Sat, 10 Nov 2018 19:39:52 +0000 Subject: [New-bugs-announce] [issue35211] Turtle Shutdown Problem(s) Message-ID: <1541878792.83.0.788709270274.issue35211@psf.upfronthosting.co.za> New submission from bob moth : Running life.py from the Free Python Games requires alt-Q twice, and the GUI keeps running after System.exit. Running life2.py, (which is my clone, and I will happily share it if you want a great stress tester that gobbles 100% of a CPU core for as long as you want,) doesn't respond to alt-Q and requires a force quit. ---------- components: Tkinter, macOS files: turtle shutdown problem.txt messages: 329640 nosy: bmoth, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Turtle Shutdown Problem(s) type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file47920/turtle shutdown problem.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 11 07:34:00 2018 From: report at bugs.python.org (Arminius) Date: Sun, 11 Nov 2018 12:34:00 +0000 Subject: [New-bugs-announce] [issue35212] Expressions with format specifiers in f-strings give wrong code position in AST Message-ID: <1541939640.9.0.788709270274.issue35212@psf.upfronthosting.co.za> New submission from Arminius : ast.parse() will give a wrong code position for an expression inside an f-string when the expression is using a format specifier. Compare the trees of f'{a}' and f'{a:b}' : >>> ast.parse("f'{a}'") Module( body=[ Expr( lineno=1, col_offset=0, value=JoinedStr( lineno=1, col_offset=0, values=[ FormattedValue( lineno=1, col_offset=0, value=Name(lineno=1, col_offset=3, id='a', ctx=Load()), conversion=-1, format_spec=None, ), ], ), ), ], ) >>> ast.parse("f'{a:b}'") Module( body=[ Expr( lineno=1, col_offset=0, value=JoinedStr( col_offset=0, lineno=1, col_offset=0, values=[ FormattedValue( lineno=1, col_offset=0, value=Name(lineno=1, col_offset=1, id='a', ctx=Load()), conversion=-1, format_spec=JoinedStr( lineno=1, col_offset=0, values=[Str(lineno=1, col_offset=0, s='b')], ), ), ], ), ), ], ) In both examples, the name "a" is at the same position in the source code, however the parsed ASTs yield two different offsets, Name(lineno=1, col_offset=3, id='a', ctx=Load()) and Name(lineno=1, col_offset=1, id='a', ctx=Load()) . Expected behavior: col_offset=3 for name "a" in both f-strings. (In my specific use case, this breaks a semantic highlighting plugin for vim.) ---------- components: Interpreter Core messages: 329672 nosy: arminius priority: normal severity: normal status: open title: Expressions with format specifiers in f-strings give wrong code position in AST type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 00:06:14 2018 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 12 Nov 2018 05:06:14 +0000 Subject: [New-bugs-announce] [issue35213] IDLE: use 'macOS' where appropriate. Message-ID: <1541999174.82.0.788709270274.issue35213@psf.upfronthosting.co.za> New submission from Terry J. Reedy : 'maxOS' is Apple's current name for the Mac operating system. See https://en.wikipedia.org/wiki/MacOS, Contents, Release History. The module name macosx.py is currently left as is. Within that, 'Mac OS X' is correct for 10.6 for 10.8. ---------- assignee: terry.reedy components: IDLE messages: 329713 nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE: use 'macOS' where appropriate. type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 02:26:35 2018 From: report at bugs.python.org (Gregory P. Smith) Date: Mon, 12 Nov 2018 07:26:35 +0000 Subject: [New-bugs-announce] [issue35214] Get the test suite passing with clang Memory Sanitizer enabled Message-ID: <1542007595.0.0.788709270274.issue35214@psf.upfronthosting.co.za> New submission from Gregory P. Smith : clang's memory sanitizer (-fsanitize=memory) turns up useful problems in code. I'm working on getting a CPython buildbot running it setup but would like our build to be cleaner to start with before I run that. These are the initial fixes required for most of CPython to pass in an msan build. We've been using these with our interpreters at Google. (PR coming) ---------- assignee: gregory.p.smith components: Build, Extension Modules, Interpreter Core, Tests messages: 329723 nosy: gregory.p.smith, twouters priority: normal severity: normal stage: patch review status: open title: Get the test suite passing with clang Memory Sanitizer enabled type: security versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 03:50:08 2018 From: report at bugs.python.org (paul) Date: Mon, 12 Nov 2018 08:50:08 +0000 Subject: [New-bugs-announce] [issue35215] Replacing CPython memory allocation Message-ID: <1542012608.34.0.788709270274.issue35215@psf.upfronthosting.co.za> New submission from paul : Hi all, I am trying to replace the version of malloc/free...etc with my own function suit. I am have issues with loading the initial library setup. I am looking for wisdom from the community as to why this may be the case. Facts: - i just grabbed the latest cpython repo - my memory suit seem to be working from independent testing on other code - i am working on linux - i went into obmalloc.c and replaced the malloc, free, realloc, calloc with my own functions. - i changed the mmap/unmap to use my malloc and free in obmalloc.c - my allocated produces aligned allocations. - i dump the exceptions text being generated to see what is happening: EXCEPTION:: module 'sys' has no attribute '__file__' EXCEPTION:: type object 'BuiltinImporter' has no attribute '_ORIGIN' EXCEPTION:: module 'sys' has no attribute '__cached__' EXCEPTION:: module 'sys' has no attribute '__path__' EXCEPTION:: module 'builtins' has no attribute '__file__' EXCEPTION:: type object 'BuiltinImporter' has no attribute '_ORIGIN' EXCEPTION:: module 'builtins' has no attribute '__cached__' EXCEPTION:: module 'builtins' has no attribute '__path__' EXCEPTION:: module '_frozen_importlib' has no attribute '__file__' EXCEPTION:: type object 'FrozenImporter' has no attribute '_ORIGIN' EXCEPTION:: module '_frozen_importlib' has no attribute '__cached__' EXCEPTION:: module '_frozen_importlib' has no attribute '__path__' EXCEPTION:: module '_imp' has no attribute '__file__' EXCEPTION:: type object 'BuiltinImporter' has no attribute '_ORIGIN' EXCEPTION:: module '_imp' has no attribute '__cached__' EXCEPTION:: module '_imp' has no attribute '__path__' EXCEPTION:: name '_bootstrap' is not defined EXCEPTION:: name '_bootstrap' is not defined EXCEPTION:: name '_bootstrap' is not defined EXCEPTION:: name '_bootstrap' is not defined Fatal Python error: initfsencoding: failed to get the Python codec of the filesystem encoding Traceback (most recent call last): File "/home/paul/fresh_cpython/debug/../Lib/encodings/__init__.py", line 31, in File "", line 989, in _find_and_load File "", line 973, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 773, in exec_module File "", line 909, in get_code File "", line 966, in get_data OSError: [Errno 14] Bad address Aborted ---------- components: Library (Lib) messages: 329725 nosy: paul.harvey at rakuten.com priority: normal severity: normal status: open title: Replacing CPython memory allocation type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 07:19:11 2018 From: report at bugs.python.org (=?utf-8?q?C=C3=A9dric_Van_Rompay?=) Date: Mon, 12 Nov 2018 12:19:11 +0000 Subject: [New-bugs-announce] [issue35216] misleading error message from shutil.copy() Message-ID: <1542025151.44.0.788709270274.issue35216@psf.upfronthosting.co.za> New submission from C?dric Van Rompay : When calling `shutil.copy('file.txt', 'not_here/')`, if directory `not_here/` does not exist, the raised error is: IsADirectoryError: [Errno 21] Is a directory: 'not_here/' If the intent of the user was to copy a file in a directory but the user forgot to create the destination directory, this can be very misleading, as the error tends to indicate that the directory exists. It happened to me and I was thinking "yes it's a directory, then what? that's exactly what I want,copy to this directory!" when the problem was that I forgot to create the destination directory. I would suggest to catch the `IsADirectoryError` in shutil.copyfile() (at `open(dst, 'wb')`) and raise instead an error saying something like "destination is a directory AND this directory does not exists". ---------- components: Library (Lib) messages: 329728 nosy: cedricvanrompay priority: normal severity: normal status: open title: misleading error message from shutil.copy() type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 08:23:21 2018 From: report at bugs.python.org (=?utf-8?b?6Zu25qy454m5?=) Date: Mon, 12 Nov 2018 13:23:21 +0000 Subject: [New-bugs-announce] [issue35217] REPL history is broken when python is invoked with cmd /c Message-ID: <1542029001.03.0.788709270274.issue35217@psf.upfronthosting.co.za> New submission from ??? : Windows 7 x64 Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] Steps to reproduce: 1. Create a script: ``` from subprocess import run run(["cmd.exe", "/c", "python"]) run(["python"]) run("python", shell=True) ``` 2. Run the script. Actual result: The script will invoke Python REPL 3 times. The first and the third REPL don't save the command history. Pressing up/down arrows would clear the entire line. Pressing F7 has no effect. The second REPL works fine. Expected result: Command history should work in all instances. ---------- components: Windows messages: 329729 nosy: paul.moore, steve.dower, tim.golden, zach.ware, ??? priority: normal severity: normal status: open title: REPL history is broken when python is invoked with cmd /c type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 09:38:21 2018 From: report at bugs.python.org (keeely) Date: Mon, 12 Nov 2018 14:38:21 +0000 Subject: [New-bugs-announce] [issue35218] Impossible to round-trip decompress -> compress zipfiles with Python 3 due to losing flag_bits Message-ID: <1542033501.3.0.788709270274.issue35218@psf.upfronthosting.co.za> New submission from keeely : Python 2.7 allows one to capture from one file a list of ZipInfo objects, and then recreate a new file using those ZipInfo objects. The same thing appears to be impossible with Python 3 without resorting to monkey-patches because of a line of code in the writestr() code path ignoring the passed in value of ZipInfo and overwritting it with zeros. See: https://github.com/python/cpython/blob/master/Lib/zipfile.py#L1567 See also a possible solution at: https://stackoverflow.com/questions/53254622/zipfile-header-language-encoding-bit-set-differently-between-python2-and-python3 ---------- components: Library (Lib) messages: 329733 nosy: keeely priority: normal severity: normal status: open title: Impossible to round-trip decompress -> compress zipfiles with Python 3 due to losing flag_bits type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 12:57:32 2018 From: report at bugs.python.org (Barry A. Warsaw) Date: Mon, 12 Nov 2018 17:57:32 +0000 Subject: [New-bugs-announce] [issue35219] macOS 10.14 High Sierra crashes in multiprocessing Message-ID: <1542045452.64.0.788709270274.issue35219@psf.upfronthosting.co.za> New submission from Barry A. Warsaw : As we're beginning to roll out macOS 10.14 High Sierra, we're seeing an increase in core files inside /cores. This can consume a ton of disk space if you have coredumps enabled. I don't have a short reproducer yet, but we believe this is related to changes in macOS behavior around fork(). Here are some clues: https://github.com/ansible/ansible/issues/32499#issuecomment-341578864 https://stackoverflow.com/questions/50168647/multiprocessing-causes-python-to-crash-and-gives-an-error-may-have-been-in-progr/52230415#52230415 http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html ---------- messages: 329747 nosy: barry priority: normal severity: normal status: open title: macOS 10.14 High Sierra crashes in multiprocessing versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 15:45:18 2018 From: report at bugs.python.org (Mathieu Dupuy) Date: Mon, 12 Nov 2018 20:45:18 +0000 Subject: [New-bugs-announce] [issue35220] delete "how do I emulate os.kill" section in Windows FAQ Message-ID: <1542055518.86.0.788709270274.issue35220@psf.upfronthosting.co.za> New submission from Mathieu Dupuy : That section is a tip on how to kill process on Windows for Python prior to 2.7 and 3.2. 3.1 end of support was April 2012 and 2.6 was October 2013, so that hasn't been needed for supported versions of Python for more than 5 years. Beside not being needed anymore for a long time, when I read it with the eyes of a Python profane, it makes Python looks bad, like a language from the pasts with warts you need to circumvent. Let's delete that. ---------- assignee: docs at python components: Documentation messages: 329751 nosy: deronnax, docs at python priority: normal pull_requests: 9750 severity: normal status: open title: delete "how do I emulate os.kill" section in Windows FAQ type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 16:57:54 2018 From: report at bugs.python.org (Julien Palard) Date: Mon, 12 Nov 2018 21:57:54 +0000 Subject: [New-bugs-announce] [issue35221] Enhance venv activate commands readability Message-ID: <1542059874.69.0.788709270274.issue35221@psf.upfronthosting.co.za> New submission from Julien Palard : I'd like to enhance the readability of the "venv activation commands" in library/venv.html, my students are often confused by it, sometimes they copy the angle brackets, sometime even the prompt. I don't think we can fix everything, but maybe enhance a bit, I ran a few tests. Before modification: https://screenshotscdn.firefoxusercontent.com/images/77cf6612-1934-4a3b-9376-87a012a76bc3.png First try with a :file:, not better: https://screenshotscdn.firefoxusercontent.com/images/db4e1191-a740-4828-b53a-ccc4a8d33dae.png Second try, simply double backquotes: https://screenshotscdn.firefoxusercontent.com/images/d6be92a1-e4af-40f5-9281-d9c09d8a0908.png Third try using bold but it hurt the eyes: https://screenshotscdn.firefoxusercontent.com/images/6fb1026f-064b-41dd-822b-3b258e37a85e.png 4th try using simply capslock, maybe better: https://screenshotscdn.firefoxusercontent.com/images/9e9c3f7b-639c-4f26-abcc-20948e15a65d.png 5th try using capslock and italics, I like it: https://screenshotscdn.firefoxusercontent.com/images/b5ae5582-1706-4ea9-a702-910daf2c69bc.png Someone on #python-fr proposed https://framapic.org/XnBQZcJVRlZw/F05D7I8nSKd0.png (rendered from markdown in github). I like it but it would require a specific role to render bold-italic in code block. ---------- assignee: mdk components: Documentation messages: 329762 nosy: mdk priority: normal severity: normal status: open title: Enhance venv activate commands readability _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 17:09:52 2018 From: report at bugs.python.org (skreft) Date: Mon, 12 Nov 2018 22:09:52 +0000 Subject: [New-bugs-announce] [issue35222] email.utils.formataddr is not exactly the reverse of email.utils.parseaddr Message-ID: <1542060592.48.0.788709270274.issue35222@psf.upfronthosting.co.za> New submission from skreft : The docs (https://docs.python.org/3/library/email.util.html#email.utils.formataddr) say that formataddr is the inverse of parseaddr, however non-ascii email addresses are treated differently in both methods. parseaddr will return non-ascci addresses, whereas formataddr will raise a UnicodeError. Below is an example: In [1]: import email.utils as u In [2]: u.parseaddr('skreft+?and?@sudoai.com') Out[2]: ('', 'skreft+?and?@sudoai.com') In [3]: u.formataddr(u.parseaddr('skreft+?and?@sudoai.com')) --------------------------------------------------------------------------- UnicodeEncodeError Traceback (most recent call last) in () ----> 1 u.formataddr(u.parseaddr('skreft+?and?@sudoai.com')) /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/utils.py in formataddr(pair, charset) 89 name, address = pair 90 # The address MUST (per RFC) be ascii, so raise a UnicodeError if it isn't. ---> 91 address.encode('ascii') 92 if name: 93 try: UnicodeEncodeError: 'ascii' codec can't encode character '\xf1' in position 7: ordinal not in range(128) ---------- components: email messages: 329765 nosy: barry, r.david.murray, skreft priority: normal severity: normal status: open title: email.utils.formataddr is not exactly the reverse of email.utils.parseaddr versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 19:06:16 2018 From: report at bugs.python.org (Roffild) Date: Tue, 13 Nov 2018 00:06:16 +0000 Subject: [New-bugs-announce] [issue35223] Pathlib incorrectly merges strings. Message-ID: <1542067576.58.0.788709270274.issue35223@psf.upfronthosting.co.za> New submission from Roffild : Code: import os print(os.path.join("C:/123\\345", "\\", "folder///filename.bin")) import pathlib print(pathlib.PureWindowsPath("C:/123\\345", "\\", "folder///filename.bin")) Result: C:\folder///filename.bin C:\folder\filename.bin Expected result for Windows: C:\123\345\folder\filename.bin The number of slashes should be controlled by the library. Replacing / on \ should also depend on the OS. ---------- components: IO, Library (Lib), Windows messages: 329776 nosy: Roffild, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Pathlib incorrectly merges strings. type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 19:52:17 2018 From: report at bugs.python.org (Emily Morehouse) Date: Tue, 13 Nov 2018 00:52:17 +0000 Subject: [New-bugs-announce] [issue35224] PEP 572: Assignment Expressions Message-ID: <1542070337.94.0.788709270274.issue35224@psf.upfronthosting.co.za> New submission from Emily Morehouse : This issue will serve to track development and PRs for the implementation of PEP 572: Assignment Expressions. ---------- assignee: emilyemorehouse components: Interpreter Core messages: 329781 nosy: emilyemorehouse, gvanrossum, tim.peters priority: normal severity: normal status: open title: PEP 572: Assignment Expressions type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 12 22:04:30 2018 From: report at bugs.python.org (Benjamin Peterson) Date: Tue, 13 Nov 2018 03:04:30 +0000 Subject: [New-bugs-announce] [issue35225] test_faulthandler fails under ubsan Message-ID: <1542078270.77.0.788709270274.issue35225@psf.upfronthosting.co.za> New submission from Benjamin Peterson : The UBsan buildbot is failing test_faulthandler. We should either spread some __attribute__((no_sanitize_undefined)) around or make the tests skip. ====================================================================== FAIL: test_enable_fd (test.test_faulthandler.FaultHandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 274, in test_enable_fd self.check_fatal_error(""" File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 115, in check_fatal_error self.check_error(code, line_number, fatal_error, **kw) File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 108, in check_error output, exitcode = self.get_output(code, filename=filename, fd=fd) File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 73, in get_output self.assertEqual(output, '') AssertionError: 'UndefinedBehaviorSanitizer:DEADLYSIGNAL\n[2619 chars]TING' != '' Diff is 2693 characters long. Set self.maxDiff to None to see it. ====================================================================== FAIL: test_enable_file (test.test_faulthandler.FaultHandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 258, in test_enable_file self.check_fatal_error(""" File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 115, in check_fatal_error self.check_error(code, line_number, fatal_error, **kw) File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 108, in check_error output, exitcode = self.get_output(code, filename=filename, fd=fd) File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 68, in get_output self.assertEqual(output, '') AssertionError: 'UndefinedBehaviorSanitizer:DEADLYSIGNAL\n[2619 chars]TING' != '' Diff is 2693 characters long. Set self.maxDiff to None to see it. ====================================================================== FAIL: test_sigfpe (test.test_faulthandler.FaultHandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 176, in test_sigfpe self.check_fatal_error(""" File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 115, in check_fatal_error self.check_error(code, line_number, fatal_error, **kw) File "/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Lib/test/test_faulthandler.py", line 110, in check_error self.assertRegex(output, regex) AssertionError: Regex didn't match: '^Fatal Python error: Floating point exception\n\nCurrent thread 0x[0-9a-f]+ \\(most recent call first\\):\n File "", line 3 in ' not found in 'Modules/faulthandler.c:1059:11: runtime error: division by zero\nFatal Python error: Floating point exception\n\nCurrent thread 0x00007f14c5e81740 (most recent call first):\n File "", line 3 in \nUndefinedBehaviorSanitizer:DEADLYSIGNAL\n==5027==ERROR: UndefinedBehaviorSanitizer: FPE on unknown address 0x006d000013a3 (pc 0x7f14c5355f9f bp 0x000002f485a0 sp 0x000002f698e8 T5027)\n #0 0x7f14c5355f9e in gsignal (/lib/x86_64-linux-gnu/libpthread.so.0+0x10f9e)\n #1 0x7f14c53560bf (/lib/x86_64-linux-gnu/libpthread.so.0+0x110bf)\n #2 0x829906 in faulthandler_sigfpe /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/./Modules/faulthandler.c:1059:11\n #3 0x4707c3 in _PyMethodDef_RawFastCallKeywords /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Objects/call.c\n #4 0x46e5d1 in _PyCFunction_FastCallKeywords /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Objects/call.c:730:14\n #5 0x656805 in call_function /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Python/ceval.c:4570:9\n #6 0x64b0d6 in _PyEval_EvalFrameDefault /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Python/ceval.c:3164:23\n #7 0x6596be in _PyEval_EvalCodeWithName /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Python/ceval.c:3946:14\n #8 0x6384ee in PyEval_EvalCodeEx /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Python/ceval.c:3975:12\n #9 0x6384ee in PyEval_EvalCode /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Python/ceval.c:508\n #10 0x6e816e in run_mod /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Python/pythonrun.c:1030:9\n #11 0x6e816e in PyRun_StringFlags /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Python/pythonrun.c:954\n #12 0x6e80bc in PyRun_SimpleStringFlags /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Python/pythonrun.c:450:9\n #13 0x44db44 in pymain_run_command /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Modules/main.c:293:11\n #14 0x44db44 in pymain_run_python /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Modules/main.c:1600\n #15 0x44db44 in pymain_main /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Modules/main.c:1758\n #16 0x44f29b in _Py_UnixMain /var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/Modules/main.c:1795:12\n #17 0x7f14c4ba72e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)\n #18 0x425499 in _start (/var/lib/buildbot/clang-ubsan/3.x.gps-clang-ubsan/build/python+0x425499)\n\nUndefinedBehaviorSanitizer can not provide additional info.\n==5027==ABORTING' ---------------------------------------------------------------------- ---------- components: Build messages: 329797 nosy: benjamin.peterson priority: normal severity: normal status: open title: test_faulthandler fails under ubsan versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 03:05:32 2018 From: report at bugs.python.org (Chris Withers) Date: Tue, 13 Nov 2018 08:05:32 +0000 Subject: [New-bugs-announce] [issue35226] mock.call equality surprisingly broken Message-ID: <1542096332.14.0.788709270274.issue35226@psf.upfronthosting.co.za> New submission from Chris Withers : $ python3 Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from unittest.mock import call >>> call(x=1) == call(x=2) False Good so far? >>> call(x=1).foo == call(x=2).foo True Eep, I think a lot of people might find that quite surprising! ---------- assignee: michael.foord components: Tests messages: 329813 nosy: cjw296, michael.foord priority: normal severity: normal status: open title: mock.call equality surprisingly broken type: behavior versions: Python 2.7, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 03:27:56 2018 From: report at bugs.python.org (=?utf-8?b?TWljaGHFgiBHw7Nybnk=?=) Date: Tue, 13 Nov 2018 08:27:56 +0000 Subject: [New-bugs-announce] [issue35227] [RFE] tarfile: support adding file objects without prior known size Message-ID: <1542097676.97.0.788709270274.issue35227@psf.upfronthosting.co.za> New submission from Micha? G?rny : Currently, the tarfile module only supports adding files if their size is known prior to adding. However, I think it'd be helpful to be able to store large dynamically generated streams straight into the (uncompressed) .tar file without being able to precalculate the final size and without having to use a temporary file. I'm not really sure how the API should look like (i.e. whether it should be a new method or extension of addfile()) but the mechanism would be rather simple -- write TarInfo with size of 0, write data until end of stream, write padding appropriately to written data, seek back and update TarInfo. Of course, the use of this API would have to be restricted to cases when underlying file supports seeking back and random writes, i.e. not stream, not compressed. ---------- components: Library (Lib) messages: 329818 nosy: mgorny priority: normal severity: normal status: open title: [RFE] tarfile: support adding file objects without prior known size type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 06:06:57 2018 From: report at bugs.python.org (Christian Ullrich) Date: Tue, 13 Nov 2018 11:06:57 +0000 Subject: [New-bugs-announce] [issue35228] Index search in CHM help crashes viewer Message-ID: <1542107217.87.0.788709270274.issue35228@psf.upfronthosting.co.za> New submission from Christian Ullrich : Typing into the index keyword field frequently crashes the CHM viewer with the first or second character. The Python CHMs are the only ones that I see this crash with; it started around 3.6 or so. >From event log: Faulting application name: hh.exe, version: 10.0.17134.1, time stamp: 0xa0eff942 Faulting module name: hhctrl.ocx, version: 10.0.17134.48, time stamp: 0x412ce02a Exception code: 0xc0000005 Fault offset: 0x00000000000387b2 Faulting process ID: 0x3558 Faulting application start time: 0x01d47b3f8db53eef Faulting application path: C:\Windows\hh.exe Faulting module path: C:\Windows\System32\hhctrl.ocx Report ID: 53f84d38-adb4-4c0b-bd45-9bce02406e6f Faulting package full name: Faulting package-relative application ID: This particular crash involved the file from 3.7.1: sha1(doc\python371.chm) = 1c0e2d861cadc759436bfac0a767c5bb633423f9 ---------- assignee: docs at python components: Documentation, Windows messages: 329824 nosy: chrullrich, docs at python, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Index search in CHM help crashes viewer type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 06:49:14 2018 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Nov 2018 11:49:14 +0000 Subject: [New-bugs-announce] [issue35229] Deprecate _PyObject_GC_TRACK() in Python 3.6 Message-ID: <1542109754.28.0.788709270274.issue35229@psf.upfronthosting.co.za> New submission from STINNER Victor : The _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() macros are documented: * https://docs.python.org/dev/c-api/gcsupport.html#c._PyObject_GC_TRACK * https://docs.python.org/dev/c-api/gcsupport.html#c._PyObject_GC_UNTRACK The documentation says "It should not be used for extension modules." These macros have been broken in Python 3.7 by Eric Snow's work on moving internal APIs to Include/internal/: _PyObject_GC_TRACK() access _PyRuntime.gc.generation0, whereas accessing _PyRuntime requires to include Include/internal/pycore_pystate.h (header previously called Include/internal/pystate.h in Python 3.7) which is not installed by "make install". My PR 10507 moved these macros to Include/internal/ to clarify that they must not be used outside CPython internals. I suggest to deprecate them in Python 3.6: just add a note in Python 3.6 and 3.7 documentation. ---------- messages: 329829 nosy: vstinner priority: normal severity: normal status: open title: Deprecate _PyObject_GC_TRACK() in Python 3.6 versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 07:08:45 2018 From: report at bugs.python.org (INADA Naoki) Date: Tue, 13 Nov 2018 12:08:45 +0000 Subject: [New-bugs-announce] [issue35230] Remove _Py_REF_DEBUG_COMMA Message-ID: <1542110925.09.0.788709270274.issue35230@psf.upfronthosting.co.za> New submission from INADA Naoki : After 2aaf0c, _Py_REF_DEBUG_COMMA in Include/object.h is used only in dictobject.c. Let's remove it. ---------- messages: 329833 nosy: inada.naoki priority: normal severity: normal status: open title: Remove _Py_REF_DEBUG_COMMA _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 08:56:20 2018 From: report at bugs.python.org (pmpp) Date: Tue, 13 Nov 2018 13:56:20 +0000 Subject: [New-bugs-announce] [issue35231] make install may not call ldconfig on posix Message-ID: <1542117380.5.0.788709270274.issue35231@psf.upfronthosting.co.za> New submission from pmpp : observed on ubuntu trusty x64 with release 3.7.1 at least when switching from "m" abi to "dm" abi sometimes libpython is not resolved in /usr/local/lib so maybe add "ldconfig" as a preventive mesure. ---------- components: Installation messages: 329840 nosy: pmpp priority: normal severity: normal status: open title: make install may not call ldconfig on posix type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 09:30:46 2018 From: report at bugs.python.org (Antony Lee) Date: Tue, 13 Nov 2018 14:30:46 +0000 Subject: [New-bugs-announce] [issue35232] Add `module`/`qualname` arguments to make_dataclass for picklability Message-ID: <1542119446.33.0.788709270274.issue35232@psf.upfronthosting.co.za> New submission from Antony Lee : Currently, dataclasses created by make_dataclass are not picklable, because their __module__ is set to "types". It seems that this would be easily fixed by letting make_dataclass gain a `module` and a `qualname` kwarg, similarly to the Enum functional form (https://docs.python.org/3/library/enum.html#functional-api). ---------- components: Library (Lib) messages: 329847 nosy: Antony.Lee priority: normal severity: normal status: open title: Add `module`/`qualname` arguments to make_dataclass for picklability versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 10:11:01 2018 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Nov 2018 15:11:01 +0000 Subject: [New-bugs-announce] [issue35233] _PyMainInterpreterConfig_Copy() doesn't copy install_signal_handlers Message-ID: <1542121861.06.0.788709270274.issue35233@psf.upfronthosting.co.za> New submission from STINNER Victor : _PyMainInterpreterConfig_Copy() doesn't copy the install_signal_handlers attribute and so config->install_signal_handlers is always -1. Bug spotted by Francis Hart: https://github.com/python/cpython/pull/10516 Attached PR fix the issue. ---------- components: Interpreter Core messages: 329849 nosy: vstinner priority: normal severity: normal status: open title: _PyMainInterpreterConfig_Copy() doesn't copy install_signal_handlers versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 11:06:02 2018 From: report at bugs.python.org (Michael Casadevall) Date: Tue, 13 Nov 2018 16:06:02 +0000 Subject: [New-bugs-announce] [issue35234] ssl module falls over with internationalized domain names Message-ID: <1542125162.5.0.788709270274.issue35234@psf.upfronthosting.co.za> New submission from Michael Casadevall : Test case attached. In Python 3.6, ssl tries to validate the hostname on its own, but fails to convert the SSL certificates hostname from IDNA back to UTF-8 and mismatches. Python 3.7 and master are unaffected since this got fixed by accident when validation was changed to depend on OpenSSL alone and not do it in python though the underlying match_hostname function is still bugged. ---------- assignee: christian.heimes components: SSL files: ssl_test.py messages: 329852 nosy: christian.heimes, mcasadevall priority: normal severity: normal status: open title: ssl module falls over with internationalized domain names type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47932/ssl_test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 12:46:18 2018 From: report at bugs.python.org (Mark Inderhees) Date: Tue, 13 Nov 2018 17:46:18 +0000 Subject: [New-bugs-announce] [issue35235] Access violation on alloc in Windows x86-64 embeddable python, pymalloc_alloc Message-ID: <1542131178.89.0.788709270274.issue35235@psf.upfronthosting.co.za> New submission from Mark Inderhees : I'm seeing an AV in python allocation logic when running my scripts. This only happens when using embedded python. It does not reproduce when using installed python. This is on Windows x86-64, I'm running Windows 10. I've seen this on 3.6.5 and 3.7.1. Here's the 3.7.1 stack on failure: 0:004> kpn # Child-SP RetAddr Call Site 00 000000d1`7439d650 00007ff8`e8303db6 python37!pymalloc_alloc(void ** ptr_p = 0x000000d1`7439d6c0, unsigned int64 nbytes = )+0x4b [c:\_work\5\s\objects\obmalloc.c @ 1398] 01 000000d1`7439d680 00007ff8`e82fb064 python37!_PyObject_Malloc(void * ctx = 0x00000000`00000000, unsigned int64 nbytes = 0x1c)+0x16 [c:\_work\5\s\objects\obmalloc.c @ 1555] 02 (Inline Function) --------`-------- python37!PyObject_Malloc+0x1c [c:\_work\5\s\objects\obmalloc.c @ 616] 03 000000d1`7439d6b0 00007ff8`e82fb18c python37!_PyLong_New(int64 size = 0n1)+0x40 [c:\_work\5\s\objects\longobject.c @ 210] 04 000000d1`7439d6e0 00007ff8`e83cbf28 python37!PyLong_FromLongLong(int64 ival = )+0x4c [c:\_work\5\s\objects\longobject.c @ 1102] 05 (Inline Function) --------`-------- python37!_PyLong_FromTime_t+0xc [c:\_work\5\s\python\pytime.c @ 88] 06 000000d1`7439d710 00007ff8`e83cb86e python37!tmtotuple(struct tm * p = 0x000000d1`7439d768, char * zone = 0x000000d1`7439d7c0 "Pacific Standard Time", int64 gmtoff = 0n-28800)+0xe0 [c:\_work\5\s\modules\timemodule.c @ 426] 07 000000d1`7439d740 00007ff8`e8307e18 python37!time_localtime(struct _object * self = 0x0000029f`3753bbe0, struct _object * args = )+0x96 [c:\_work\5\s\modules\timemodule.c @ 521] 08 000000d1`7439d850 00007ff8`e8308737 python37!_PyMethodDef_RawFastCallKeywords(struct PyMethodDef * method = 0x00000000`00000000, struct _object * self = 0x0000029f`371b7778, struct _object ** args = 0x0000029f`3754b3c8, int64 nargs = 0n1, struct _object * kwnames = 0x00000000`00000000)+0x3a8 [c:\_work\5\s\objects\call.c @ 694] 09 (Inline Function) --------`-------- python37!_PyCFunction_FastCallKeywords+0x22 [c:\_work\5\s\objects\call.c @ 730] 0a 000000d1`7439d8d0 00007ff8`e83091d3 python37!call_function(struct _object *** pp_stack = 0x000000d1`7439da28, int64 oparg = , struct _object * kwnames = 0x00000000`00000000)+0x3a7 [c:\_work\5\s\python\ceval.c @ 4554] 0b 000000d1`7439d990 00007ff8`e82f1390 python37!_PyEval_EvalFrameDefault(struct _frame * f = 0x0000029f`3754b220, int throwflag = 0n928230480)+0x913 [c:\_work\5\s\python\ceval.c @ 3095] 0c (Inline Function) --------`-------- python37!PyEval_EvalFrameEx+0x17 [c:\_work\5\s\python\ceval.c @ 547] 0d 000000d1`7439dad0 00007ff8`e83086a2 python37!_PyEval_EvalCodeWithName(struct _object * _co = 0x0000029f`37415a50, struct _object * globals = , struct _object * locals = , struct _object ** args = 0xffffffff`ffff2a88, int64 argcount = 0n3, struct _object ** kwnames = 0x00000000`00000000, struct _object ** kwargs = 0x0000029f`3753de28, int64 kwcount = 0n0, int kwstep = 0n1, struct _object ** defs = 0x0000029f`3743fe60, int64 defcount = 0n1, struct _object * kwdefs = 0x00000000`00000000, struct _object * closure = 0x00000000`00000000, struct _object * name = 0x0000029f`3744f470, struct _object * qualname = 0x0000029f`37441930)+0x1a0 [c:\_work\5\s\python\ceval.c @ 3930] 0e (Inline Function) --------`-------- python37!_PyFunction_FastCallKeywords+0x274 [c:\_work\5\s\objects\call.c @ 433] 0f 000000d1`7439db80 00007ff8`e8308d29 python37!call_function(struct _object *** pp_stack = 0x000000d1`7439dcd8, int64 oparg = , struct _object * kwnames = 0x00000000`00000000)+0x312 [c:\_work\5\s\python\ceval.c @ 4607] .... ---------- messages: 329857 nosy: markind priority: normal severity: normal status: open title: Access violation on alloc in Windows x86-64 embeddable python, pymalloc_alloc _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 14:20:41 2018 From: report at bugs.python.org (Ian Liu Rodrigues) Date: Tue, 13 Nov 2018 19:20:41 +0000 Subject: [New-bugs-announce] [issue35236] urllib.request.urlopen throws on some valid FTP files Message-ID: <1542136841.11.0.788709270274.issue35236@psf.upfronthosting.co.za> New submission from Ian Liu Rodrigues : Some FTP clients will not allow changing to a directory if the path does not ends with a slash. For example, try out this in a public FTP: from ftplib import FTP ftp = FTP('ftp.unicamp.br') ftp.login() ftp.cwd('pub/libreoffice') # throws error ftp.cwd('pub/libreoffice/') # OK The problem is urllib.request doesn't include the trailing slash, thus throwing an error. This behavior also happens with the command line ftp client. I think this happens because the libreoffice directory is a symlink, and this can be a FTP server specific behavior. ---------- components: Library (Lib) messages: 329862 nosy: Ian Liu Rodrigues priority: normal severity: normal status: open title: urllib.request.urlopen throws on some valid FTP files type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 15:55:02 2018 From: report at bugs.python.org (Thierry Parmentelat) Date: Tue, 13 Nov 2018 20:55:02 +0000 Subject: [New-bugs-announce] [issue35237] Allow Path instances in sys.path ? Message-ID: <1542142502.59.0.788709270274.issue35237@psf.upfronthosting.co.za> New submission from Thierry Parmentelat : Hi; this is my first entry in this repo I ran today into a rather frustrating experience, that I'd to avoid it for others as far as possible In a nutshell I had a sphinx stub that read: import sys sys.path.append("..") import mymodule and because I was switching from os.path to pathlib.Path, I rather stupidly changed it into this import sys sys.path.append(Path("..").resolve()) import mymodule --- When trying to run this new code, the message I got was ModuleNotFoundError So I tried to troubleshoot the situation, and inserted something like for x in sys.path: print(x) and so the proper path showed up, and that's the point where I started banging my head against the screen Granted, I was doing too many changes at the same time, and it's entirely my fault if it took me ages really to figure it out eventually. --- Still, my proposal would be to *) either accept Path instances in sys.path, or *) somehow send a warning message stating that the Path instance is totally ignored; at least, I haven't found the corresponding piece of code yet, but as far as I am concerned it's truly as if this Path instance had been completely ignored when executing the import statement *) or at the very least add a mention about this possible issue in the import documentation I understand it was a stupid mistake, but with Path becoming THE right way to deal with paths, I think it is safe to predict that I won't be the only one making it. As I said I am a complete newbie with cpython's codebase and devel practices, so I'll warmly welcome all inputs on this one. thanks ---------- components: Library (Lib) messages: 329864 nosy: thierry.parmentelat priority: normal severity: normal status: open title: Allow Path instances in sys.path ? type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 16:29:55 2018 From: report at bugs.python.org (Oscar Esteban) Date: Tue, 13 Nov 2018 21:29:55 +0000 Subject: [New-bugs-announce] [issue35238] Alleviate memory reservation of fork_exec in subprocess.Popen via forkserver Message-ID: <1542144595.84.0.788709270274.issue35238@psf.upfronthosting.co.za> New submission from Oscar Esteban : ## Context We are developers of nipype (https://github.com/nipype) which is a workflow engine for neuroimaging software. We are experiencing problems that gave rise to the addition of ``os.posix_spawn`` to Python 3.8, and particularly, this - https://bugs.python.org/issue20104#msg222570 Our software runs command line subprocesses that can be quite memory-hungry and in some cases, in the order of tens of thousands processes. Therefore, we frequently see the OOM killing some of the processes. ## Status We have successfully leveraged the ``forkserver`` context (in addition to a low number of `maxtasksperchild`) of multiprocessing to ease the load. However, the fork_exec memory allocation is still problematic on systems that do not allow overcommitting virtual memory. Waiting for os.posix_spawn to be rolled out might not be an option for us, as the problem is hitting badly right now. ## Proposed solution I'd like to page experts on Lib/multiprocessing and Lib/subprocess to give their opinions about the following: is it possible to write an extension to `multiprocessing.util.Popen` such that it has the API of `subprocess.Popen` but the fork happens via the forkserver? My naive intuition is that we would need to create a new type of Process, make sure that it then calls os.exec*e() --possibly around here https://github.com/python/cpython/blob/f966e5397ed8f5c42c185223fc9b4d750a678d02/Lib/multiprocessing/popen_forkserver.py#L51--, and finally handle communication with the subprocess. Please let me know if that is even possible. ---------- components: Library (Lib) messages: 329868 nosy: oesteban priority: normal severity: normal status: open title: Alleviate memory reservation of fork_exec in subprocess.Popen via forkserver type: enhancement versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 18:08:32 2018 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Nov 2018 23:08:32 +0000 Subject: [New-bugs-announce] [issue35239] _PySys_EndInit() doesn't copy main interpreter configuration Message-ID: <1542150512.39.0.788709270274.issue35239@psf.upfronthosting.co.za> New submission from STINNER Victor : Extract of _PySys_EndInit(): SET_SYS_FROM_STRING_BORROW("path", config->module_search_path); sys.path is initialized from _PyMainInterpreterConfig.module_search_path object: the list of strings is not copied. As a consequence, when sys.path is modified, _PyMainInterpreterConfig is modified as well. For example, "import site" modifies sys.path. I dislike this behavior. I prefer to see _PyMainInterpreterConfig as "constant": a snapshot of the configuration used to startup Python. A side effect is that Py_NewInterpreter() copies the modified configuration, whereas starting from the "original" configuration. For the specific case of Py_NewInterpreter(), I'm not sure of what is the expected behavior... Py_NewInterpreter() imports the "site" module again, so it should reapply the same sys.path change. Note: I found this bug while working on better tests for global, core and main configurations: https://github.com/python/cpython/pull/10524 ---------- components: Interpreter Core messages: 329872 nosy: eric.snow, ncoghlan, vstinner priority: normal severity: normal status: open title: _PySys_EndInit() doesn't copy main interpreter configuration versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 20:19:39 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 14 Nov 2018 01:19:39 +0000 Subject: [New-bugs-announce] [issue35240] Travis CI: xvfb-run: error: Xvfb failed to start Message-ID: <1542158379.67.0.788709270274.issue35240@psf.upfronthosting.co.za> New submission from STINNER Victor : Travis CI fails randomly with "xvfb-run: error: Xvfb failed to start". Example: https://travis-ci.org/python/cpython/jobs/454776965 whereas the full test suite succeeded. ---------- messages: 329881 nosy: vstinner priority: normal severity: normal status: open title: Travis CI: xvfb-run: error: Xvfb failed to start _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 13 21:38:37 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Wed, 14 Nov 2018 02:38:37 +0000 Subject: [New-bugs-announce] [issue35241] test_embed fails on MacOS buildbots Message-ID: <1542163117.23.0.788709270274.issue35241@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : https://buildbot.python.org/all/#/builders/147/builds/430/steps/4/logs/stdio https://buildbot.python.org/all/#/builders/109/builds/789/steps/4/logs/stdio ====================================================================== FAIL: test_init_default_config (test.test_embed.InitConfigTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.7.billenstein-sierra/build/Lib/test/test_embed.py", line 398, in test_init_default_config self.check_config("init_default_config", {}, {}) File "/Users/buildbot/buildarea/3.7.billenstein-sierra/build/Lib/test/test_embed.py", line 391, in check_config self.assertEqual(config['global_config'], expected_global) AssertionError: {'Py_FileSystemDefaultEncoding': 'utf-8', 'Py_[467 chars]': 0} != {'Py_BytesWarningFlag': 0, 'Py_DebugFlag': 0, [467 chars]': 0} {'Py_BytesWarningFlag': 0, 'Py_DebugFlag': 0, 'Py_DontWriteBytecodeFlag': 0, 'Py_FileSystemDefaultEncodeErrors': 'surrogateescape', 'Py_FileSystemDefaultEncoding': 'utf-8', 'Py_FrozenFlag': 0, - 'Py_HasFileSystemDefaultEncoding': 1, ? ^ + 'Py_HasFileSystemDefaultEncoding': 0, ? ^ 'Py_HashRandomizationFlag': 1, 'Py_IgnoreEnvironmentFlag': 0, 'Py_InspectFlag': 0, 'Py_InteractiveFlag': 0, 'Py_IsolatedFlag': 0, 'Py_NoSiteFlag': 0, 'Py_NoUserSiteDirectory': 0, 'Py_OptimizeFlag': 0, 'Py_QuietFlag': 0, 'Py_UTF8Mode': 0, 'Py_UnbufferedStdioFlag': 0, 'Py_VerboseFlag': 0} ====================================================================== FAIL: test_init_dev_mode (test.test_embed.InitConfigTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.7.billenstein-sierra/build/Lib/test/test_embed.py", line 479, in test_init_dev_mode self.check_config("init_dev_mode", core_config, {}) File "/Users/buildbot/buildarea/3.7.billenstein-sierra/build/Lib/test/test_embed.py", line 391, in check_config self.assertEqual(config['global_config'], expected_global) AssertionError: {'Py_FileSystemDefaultEncoding': 'utf-8', 'Py_[467 chars]': 0} != {'Py_BytesWarningFlag': 0, 'Py_DebugFlag': 0, [467 chars]': 0} {'Py_BytesWarningFlag': 0, 'Py_DebugFlag': 0, 'Py_DontWriteBytecodeFlag': 0, 'Py_FileSystemDefaultEncodeErrors': 'surrogateescape', 'Py_FileSystemDefaultEncoding': 'utf-8', 'Py_FrozenFlag': 0, - 'Py_HasFileSystemDefaultEncoding': 1, ? ^ + 'Py_HasFileSystemDefaultEncoding': 0, ? ^ 'Py_HashRandomizationFlag': 1, 'Py_IgnoreEnvironmentFlag': 0, 'Py_InspectFlag': 0, 'Py_InteractiveFlag': 0, 'Py_IsolatedFlag': 0, 'Py_NoSiteFlag': 0, 'Py_NoUserSiteDirectory': 0, 'Py_OptimizeFlag': 0, 'Py_QuietFlag': 0, 'Py_UTF8Mode': 0, 'Py_UnbufferedStdioFlag': 0, 'Py_VerboseFlag': 0} ====================================================================== FAIL: test_init_isolated (test.test_embed.InitConfigTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.7.billenstein-sierra/build/Lib/test/test_embed.py", line 489, in test_init_isolated self.check_config("init_isolated", core_config, global_config) File "/Users/buildbot/buildarea/3.7.billenstein-sierra/build/Lib/test/test_embed.py", line 391, in check_config self.assertEqual(config['global_config'], expected_global) AssertionError: {'Py_FileSystemDefaultEncoding': 'utf-8', 'Py_[467 chars]': 1} != {'Py_BytesWarningFlag': 0, 'Py_DebugFlag': 0, [467 chars]': 1} {'Py_BytesWarningFlag': 0, 'Py_DebugFlag': 0, 'Py_DontWriteBytecodeFlag': 0, 'Py_FileSystemDefaultEncodeErrors': 'surrogateescape', 'Py_FileSystemDefaultEncoding': 'utf-8', 'Py_FrozenFlag': 0, - 'Py_HasFileSystemDefaultEncoding': 1, ? ^ + 'Py_HasFileSystemDefaultEncoding': 0, ? ^ 'Py_HashRandomizationFlag': 1, 'Py_IgnoreEnvironmentFlag': 1, 'Py_InspectFlag': 0, 'Py_InteractiveFlag': 0, 'Py_IsolatedFlag': 1, 'Py_NoSiteFlag': 0, 'Py_NoUserSiteDirectory': 1, 'Py_OptimizeFlag': 0, 'Py_QuietFlag': 0, 'Py_UTF8Mode': 0, 'Py_UnbufferedStdioFlag': 0, 'Py_VerboseFlag': 0} ---------------------------------------------------------------------- Ran 15 tests in 6.518s FAILED (failures=3) 1 test failed again: test_embed ---------- components: Tests messages: 329887 nosy: pablogsal, vstinner priority: normal severity: normal status: open title: test_embed fails on MacOS buildbots versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 00:26:21 2018 From: report at bugs.python.org (Sergei Zobov) Date: Wed, 14 Nov 2018 05:26:21 +0000 Subject: [New-bugs-announce] [issue35242] multiprocessing.Queue in an inconsistent state and a traceback silently suppressed if put an unpickable object and process's target function is finished Message-ID: <1542173181.91.0.788709270274.issue35242@psf.upfronthosting.co.za> New submission from Sergei Zobov : In case if the process target function put something unpickable in the `multiprocessing.Queue` and finish before `ForkingPickler`'s exception is handled we get two weird situations: * Internal queue semaphore stay acquired and never will be released, so we get `qsize()` always returns 1(or more if more then one process) even if there is nothing in queue's buffer and `empty()` returns `True`. * An exception's traceback will be silently suppressed. To reproduce this behavior I wrote a test in cpython repo (be aware sometime it pass sometime no): https://github.com/szobov/cpython/commit/95524f10a7b6510e9ab4647223cc67af85ebff86 I suppose it happens because of this: * The function `util._exit_function()` calls every time process target function finished. Inside this function the global (for current process) flag `utils._exiting` marks as `True`: https://github.com/python/cpython/blob/master/Lib/multiprocessing/process.py#L300 https://github.com/python/cpython/blob/master/Lib/multiprocessing/util.py#L294-L295 * When exception while pickling object happens in `Queue._feed` function we are ignore it because of the clause `is_exiting()` that checks the flag `utils._exiting` described above. https://github.com/python/cpython/blob/master/Lib/multiprocessing/queues.py#L257-L259 So we have unreleased semaphore and ignored exceptions. I think it's quite disappointing for user because they have broken queue and nothing about why it happened. I'm not quite sure that it's a bag but I found nothing in documentation about it. ---------- messages: 329889 nosy: szobov priority: normal severity: normal status: open title: multiprocessing.Queue in an inconsistent state and a traceback silently suppressed if put an unpickable object and process's target function is finished type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 03:08:28 2018 From: report at bugs.python.org (pmpp) Date: Wed, 14 Nov 2018 08:08:28 +0000 Subject: [New-bugs-announce] [issue35243] readline timeout too long for async gfx use Message-ID: <1542182908.62.0.788709270274.issue35243@psf.upfronthosting.co.za> New submission from pmpp : unlike https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame which is fires about each 1/60 second : the callback for gui via PyOS_InputHook is as long as 0.1 second. https://github.com/python/cpython/blob/8e0b05e2f4b9fd703cbe1ae8d058852ef3781f44/Modules/readline.c#L1192 using repl asyncronously with such a timer is a bad experience when using async opengl based gui : asyncio loop steps should be able to be served at vsync speed which is not actually possible because of hardcoded value. 0.008 seconds would not be so bad, best would be plan next call to hit T+ frametime ( with a default to 0.016 ) each pass inside the loop. a use case for python would be panda3d and its various gui. real life example in other mainstream language : the javascript repl in the browser console. ---------- components: Extension Modules messages: 329891 nosy: pmpp priority: normal severity: normal status: open title: readline timeout too long for async gfx use type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 07:08:32 2018 From: report at bugs.python.org (Jaime Torres) Date: Wed, 14 Nov 2018 12:08:32 +0000 Subject: [New-bugs-announce] [issue35244] Allow to setup Clang as default compiler for modules build Message-ID: <1542197312.07.0.788709270274.issue35244@psf.upfronthosting.co.za> New submission from Jaime Torres : Clang is not in the list of allowed compilers when executed: python setup.py build --help-compiler --compiler=bcpp Borland C++ Compiler --compiler=cygwin Cygwin port of GNU C Compiler for Win32 --compiler=mingw32 Mingw32 port of GNU C Compiler for Win32 --compiler=msvc Microsoft Visual C++ --compiler=unix standard UNIX-style compiler I've tried to use the value unix in windows, to see if it will search for environment variables CC and CXX, but without success. ---------- components: Distutils messages: 329902 nosy: Jaime Torres, dstufft, eric.araujo priority: normal severity: normal status: open title: Allow to setup Clang as default compiler for modules build versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 08:24:33 2018 From: report at bugs.python.org (Yechoh) Date: Wed, 14 Nov 2018 13:24:33 +0000 Subject: [New-bugs-announce] [issue35245] list comprehension for flattened or nested list differ too much Message-ID: <1542201873.24.0.788709270274.issue35245@psf.upfronthosting.co.za> New submission from Yechoh : Suppose we have: forest = [[1,2],[3,4]] and we want: l1 = [['1','2'],['3','4']] we could write: l1 = [[str(leaf) for leaf in tree] for tree in forest] Now if we want: l2 = ['1','2','3','4'] What I expect to need to write is: l2 = [str(leaf) for leaf in tree for tree in forest] However, this gives an error: Traceback (most recent call last): File "", line 1, in NameError: name 'tree' is not defined Instead, I should write: l2 = [str(leaf) for tree in forest for leaf in tree] Notice the different order. I would prefer if the first version of constructing l2 over the second, since it follows closer to the reading order. Also, it is closer to the comprehension for a nested list, so changing a nested list comprehension to a flattened list comprehension is easy. ---------- messages: 329906 nosy: Yechoh priority: normal severity: normal status: open title: list comprehension for flattened or nested list differ too much type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 08:50:49 2018 From: report at bugs.python.org (lilydjwg) Date: Wed, 14 Nov 2018 13:50:49 +0000 Subject: [New-bugs-announce] [issue35246] asyncio.create_subprocess_exec doesn't accept pathlib.Path like subprocess does Message-ID: <1542203449.76.0.788709270274.issue35246@psf.upfronthosting.co.za> New submission from lilydjwg : When I pass pathlib.Path to asyncio.create_subprocess_exec I get: TypeError: program arguments must be a bytes or text string, not PosixPath It's not so good when subprocess accepts this kind of arguments without issues. So can you add support for this? ---------- components: asyncio messages: 329907 nosy: asvetlov, lilydjwg, yselivanov priority: normal severity: normal status: open title: asyncio.create_subprocess_exec doesn't accept pathlib.Path like subprocess does type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 11:14:47 2018 From: report at bugs.python.org (markmcclain) Date: Wed, 14 Nov 2018 16:14:47 +0000 Subject: [New-bugs-announce] [issue35247] test.test_socket.RDSTest.testPeek hangs indefinitely Message-ID: <1542212087.25.0.788709270274.issue35247@psf.upfronthosting.co.za> New submission from markmcclain : test.test_socket.RDSTest.testPeek() can hang indefinitely. ThreadableTest attempts to ensure ordering of operations, but allows both the client and server to proceed without guaranteeing that the data is sent prior to the blocking attempt to peek at the socket's contents. Either the test needs to make recvfrom non-blocking with a timeout/retry loop or ensure data is sent prior to allowing the server to proceed. ---------- components: Tests messages: 329914 nosy: markmcclain priority: normal severity: normal status: open title: test.test_socket.RDSTest.testPeek hangs indefinitely type: behavior versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 12:50:30 2018 From: report at bugs.python.org (Mathieu Lamarre) Date: Wed, 14 Nov 2018 17:50:30 +0000 Subject: [New-bugs-announce] [issue35248] RawArray causes FileNotFoundError at cleanup Message-ID: <1542217830.03.0.788709270274.issue35248@psf.upfronthosting.co.za> Change by Mathieu Lamarre : ---------- components: Library (Lib) nosy: Mathieu Lamarre priority: normal severity: normal status: open title: RawArray causes FileNotFoundError at cleanup type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 15:08:26 2018 From: report at bugs.python.org (Jules Lasne) Date: Wed, 14 Nov 2018 20:08:26 +0000 Subject: [New-bugs-announce] [issue35249] Docs Makefile always rebuilds entire doc Message-ID: <1542226106.26.0.788709270274.issue35249@psf.upfronthosting.co.za> New submission from Jules Lasne : When working on the Documentation or when translating it, I often have to rebuild the doc locally to see the changes I made and see how it looks. However, with the current configuration, It takes (on my computer at least) more than 4 minutes to build. After investigating, I've found out that the build options on the Makefile of python-docs-fr and of cpython/Docs both have the `E` and `a` options set, which forces a complete rebuild, even when running locally. https://github.com/python/cpython/blob/9ee1d42f019ac827f73479ce241e95733d050e67/Doc/Makefile#L178-L208 https://github.com/python/python-docs-fr/commit/af8c7a95ab5bc50523ba919c74bb6e6b89d16962 My proposal is to add a `make dev` in the `python-docs-fr` Makefile and add in `cpython/Docs` a mode which will only recompile the needed files. ---------- components: Build messages: 329930 nosy: seluj78 priority: normal severity: normal status: open title: Docs Makefile always rebuilds entire doc type: performance versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 15:40:45 2018 From: report at bugs.python.org (Shane) Date: Wed, 14 Nov 2018 20:40:45 +0000 Subject: [New-bugs-announce] [issue35250] Minor parameter documentation mismatch for turtle Message-ID: <1542228045.84.0.788709270274.issue35250@psf.upfronthosting.co.za> New submission from Shane : I noticed a slight mismatch in the parameter documentation for one of turtle's functions. onclick() accepts the parameters (fun, btn, add), but the documentation describes the parameters (fun, num, add). A minor issue, to be sure, but I wanted to point it out since I just noticed it. I'm using Python 3.7.1 but I suspect it's not isolated to that. >>> help(turtle.Turtle().onclick) Help on method onclick in module turtle: onclick(fun, btn=1, add=None) method of turtle.Turtle instance Bind fun to mouse-click event on this turtle on canvas. Arguments: fun -- a function with two arguments, to which will be assigned the coordinates of the clicked point on the canvas. num -- number of the mouse-button defaults to 1 (left mouse button). add -- True or False. If True, new binding will be added, otherwise it will replace a former binding. ---------- assignee: docs at python components: Documentation messages: 329932 nosy: Shane Smith, docs at python priority: normal severity: normal status: open title: Minor parameter documentation mismatch for turtle _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 17:06:27 2018 From: report at bugs.python.org (Lysandros Nikolaou) Date: Wed, 14 Nov 2018 22:06:27 +0000 Subject: [New-bugs-announce] [issue35251] FTPHandler.ftp_open documentation error Message-ID: <1542233187.5.0.788709270274.issue35251@psf.upfronthosting.co.za> New submission from Lysandros Nikolaou : On https://docs.python.org/3/library/urllib.request.html?highlight=request#ftphandler-objects there is the sentence "The login is always done with empty username and password.", but in the (not so rare) case I am not missing something here, the code does parse the username and password and passes it on to connect_ftp, which then uses them. Should we update the docs? ---------- components: email messages: 329936 nosy: barry, lys.nikolaou, r.david.murray priority: normal severity: normal status: open title: FTPHandler.ftp_open documentation error versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 20:14:23 2018 From: report at bugs.python.org (Lysandros Nikolaou) Date: Thu, 15 Nov 2018 01:14:23 +0000 Subject: [New-bugs-announce] [issue35252] test_functools dead code after FIXME Message-ID: <1542244463.09.0.788709270274.issue35252@psf.upfronthosting.co.za> New submission from Lysandros Nikolaou : In test_functools.TestSingleDispatch.test_invalid_registrations (https://github.com/python/cpython/blob/4c596d54aa6a55e9d2a3db78891e656ebbfb63c8/Lib/test/test_functools.py#L2299) there is a FIXME with an immediate return afterwards that says that the code after the return should only be allowed to run after PEP 560 is implemented. Now that it is implemented the dead code should work fine, so the return has to be deleted. ---------- components: Tests messages: 329937 nosy: lys.nikolaou priority: normal severity: normal status: open title: test_functools dead code after FIXME versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 20:50:46 2018 From: report at bugs.python.org (Jorge Ramos) Date: Thu, 15 Nov 2018 01:50:46 +0000 Subject: [New-bugs-announce] [issue35253] Linker warning LNK4281 Message-ID: <1542246646.48.0.788709270274.issue35253@psf.upfronthosting.co.za> New submission from Jorge Ramos : When building python 3.6.7 x64 from source I get multiple warnings: -------------------------------------------------------------------- LINK : LNK4281 - "undesirable base address 0x1D110000 for x64 image; set base address above 4GB for best ASLR optimization". -------------------------------------------------------------------- after that, the build gives the offending module: -------------------------------------- [..\PCbuild\pythoncore.vcxproj] --------------------------------------- (e.g., there are many others) the .. means whatever parent directory the build files are on. I use the following batch file: ------------------------------------------------------------ Tools\msi\buildrelease.bat -x64 --pgo '-m test -q --pgo' ------------------------------------------------------------- Is this a problem? ---------- components: Build messages: 329938 nosy: neyuru priority: normal severity: normal status: open title: Linker warning LNK4281 type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 14 23:59:51 2018 From: report at bugs.python.org (mengdexiaolian) Date: Thu, 15 Nov 2018 04:59:51 +0000 Subject: [New-bugs-announce] [issue35254] Process finished with exit code -1073741795 (0xC000001D) Message-ID: <1542257991.0.0.788709270274.issue35254@psf.upfronthosting.co.za> New submission from mengdexiaolian : when i run the following script with face_recognition module, there is a unnormal exception occurs: Process finished with exit code -1073741795 (0xC000001D) import face_recognition encodings = [] filename1 = "catherine.jpg" image1 = face_recognition.load_image_file(filename1) print(image1) encoding1 = face_recognition.face_encodings(image1)[0] print("bobo",encoding1) encodings.append(encoding1) print(encodings) filename2 = "william.jpg" image2 = face_recognition.load_image_file(filename2) encoding2 = face_recognition.face_encodings(image2)[0] encodings.append(encoding2) print(encodings) ---------- components: Extension Modules messages: 329942 nosy: mengdexiaolian priority: normal severity: normal status: open title: Process finished with exit code -1073741795 (0xC000001D) type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 15 06:31:18 2018 From: report at bugs.python.org (Mathieu Dupuy) Date: Thu, 15 Nov 2018 11:31:18 +0000 Subject: [New-bugs-announce] [issue35255] delete "How do I extract the downloaded documentation" section in Windows FAQ Message-ID: <1542281478.85.0.788709270274.issue35255@psf.upfronthosting.co.za> New submission from Mathieu Dupuy : I think it's been a long time since Windows/IE no longer mess up with file extensions, so long I can't recall anymore. I just tried on a Windows 7 + IE 11 (released in 2013) to download the .tar.bz2 archive from docs.python.org and it worked alright. To me, that entry makes Python looks bad ("the archive format we use does not work correctly on the most common, main desktop platform"), the problem seems to not exist anymore, and IMHO, is not really Python related. I think that entry should be removed. ---------- messages: 329947 nosy: deronnax priority: normal severity: normal status: open title: delete "How do I extract the downloaded documentation" section in Windows FAQ _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 15 08:30:01 2018 From: report at bugs.python.org (Iuliana Netoi) Date: Thu, 15 Nov 2018 13:30:01 +0000 Subject: [New-bugs-announce] [issue35256] The Console of Python 3.7.0. Message-ID: <1542288601.52.0.788709270274.issue35256@psf.upfronthosting.co.za> New submission from Iuliana Netoi : While running a function that uses a list to which I append the element "z", the Console modifies my code by adding "z" to the list each time I consequently run the function. Is that a bug? My function written in the Editor of Python 3.7.0. is the following: #%% my_list = ["this","is","my","very","first","list"] def problem2_2(my_list): my_list.append("z") print(my_list) #%% I click the "Run" icon in the Menu. Then I type problem2_2(my_list) in the CONSOLE. At the first execution it is ok. But when executing right again, the console adds another element "z" to my list. And so on, for each next execution - as if the Console modifies my code. (Anyway when reverting to the Editor, click inside the cell, and then "Run" icon in the Menu, only after the first execution it is printed the right number of elements)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< There is the Console executions: mmy_list = ["this","is","my","very","first","list"] def problem2_2(my_list): my_list.append("z") print(my_list) problem2_2(my_list) ['this', 'is', 'my', 'very', 'first', 'list', 'z'] problem2_2(my_list) ['this', 'is', 'my', 'very', 'first', 'list', 'z', 'z'] problem2_2(my_list) ['this', 'is', 'my', 'very', 'first', 'list', 'z', 'z', 'z'] problem2_2(my_list) ['this', 'is', 'my', 'very', 'first', 'list', 'z', 'z', 'z', 'z'] ---------- components: Tests messages: 329949 nosy: iuliananet priority: normal severity: normal status: open title: The Console of Python 3.7.0. versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 15 11:14:01 2018 From: report at bugs.python.org (Charalampos Stratakis) Date: Thu, 15 Nov 2018 16:14:01 +0000 Subject: [New-bugs-announce] [issue35257] Add LDFLAGS_NODIST for the LDFLAGS not intended for propagation to C extensions. Message-ID: <1542298441.4.0.788709270274.issue35257@psf.upfronthosting.co.za> New submission from Charalampos Stratakis : Through acb8c5234302f8057b331abaafb2cc8697daf58f the CFLAGS_NODIST variable was created, in order to place there compiler flags used by the interpreter, but not intended to be propagated to C extensions. I saw a similar issue when working on backporting 67e997bcfdac55191033d57a16d1408aL1313 on python 3.6, where the -flto flag should be passed to CFLAGS_NODIST instead of BASECFLAGS, however even if that is fixed, the LDFLAGS will still be propagated to C extensions. Thus in order to provide more flexibility in that regard, I propose to add the LDFLAGS_NODIST variable, which in a similar vein as CFLAGS_NODIST, will hold the LDFLAGS intended to be used only by the interpreter. Thoughts or comments on this approach? ---------- components: Build, Distutils, Extension Modules messages: 329951 nosy: cstratak, dstufft, eric.araujo priority: normal severity: normal status: open title: Add LDFLAGS_NODIST for the LDFLAGS not intended for propagation to C extensions. versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 15 12:33:43 2018 From: report at bugs.python.org (Alexey Izbyshev) Date: Thu, 15 Nov 2018 17:33:43 +0000 Subject: [New-bugs-announce] [issue35258] Consider enabling -Wmissing-prototypes Message-ID: <1542303223.2.0.788709270274.issue35258@psf.upfronthosting.co.za> New submission from Alexey Izbyshev : This issue is a follow-up of msg329608 of #35081. GCC and Clang have -Wmissing-prototypes[1] diagnostic that is reported if a global function is defined without a previous declaration containing a prototype. The reasons may be the following: 1) The header where it is declared is not included before the definition. 2) There is a declaration before the definition, but it doesn't contain a prototype (e.g., "int foo()"). 3) There is no separate declaration of the function in the project at all. (1) is undesirable because the compiler can't check that signatures of the declaration and the definition match. If they don't, subtle issues may occur when such function is called using a wrong declaration. (2) is undesirable too because there is usually no reason to use declarations without prototypes. Often "int foo()" was meant to be "int foo(void)" -- these two have different meaning in C. (3) may mean that either the function is unused (which is probably undesirable) or it was intentionally defined without a declaration. One case when the latter makes sense is plugin-like files which define initialization functions or similar external entry points. Those may be called via pointers obtained with dlsym() or have calls generated at compile time, like Modules/config.c in CPython. It would be good to enable -Wmissing-prototypes to catch (1) and (2) -- such issues exist as of time of this report. However, (3) is a problem because of module initialization functions which would cause unwanted diagnostics. There is no function attribute that could be put in PyMODINIT_FUNC macro to suppress the diagnostic for a single function. The general diagnostic suppression machinery (#pragma GCC diagnostic[2]) affects everything on the following lines, and while the state can be saved and restored via "#pragma GCC diagnostic push/pop", we'd either need another macro to restore the state after the end of module initializer definitions or require that initializers always come last in the file. A workaround is to declare the initializer inside PyMODINIT_FUNC (or a new macro). For example (omitting platform-specific parts of PyMODINIT_FUNC): #define PyMODINIT_FUNC(name) \ extern PyObject *name(void); \ PyObject *name(void) PyMODINIT_FUNC(PyInit_time) { ... } I've also noticed that PyMODINIT_FUNC is used for functions with a different signature in Modules/_testmultiphase.c, so either another macro would be needed for that, or a general macro accepting a prototype as its variadic parameter could be added. Even if it's deemed infeasible to enable -Wmissing-prototypes by default, developers may find it useful to ensure that the diagnostic is reported only for files in Modules directory. [1] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html [2] https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html ---------- components: Build messages: 329954 nosy: izbyshev, vstinner priority: normal severity: normal status: open title: Consider enabling -Wmissing-prototypes type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 15 13:24:51 2018 From: report at bugs.python.org (Arthur Neufeld) Date: Thu, 15 Nov 2018 18:24:51 +0000 Subject: [New-bugs-announce] [issue35259] Py_FinalizeEx unconditionally exists in Py_LIMITED_API Message-ID: <1542306291.56.0.788709270274.issue35259@psf.upfronthosting.co.za> New submission from Arthur Neufeld : In application compiled with #define Py_LIMITED_API 0x03040000 this method was used Py_FinalizeEx() Tested application with: SET PATH=...;C:\Program Files\Python35 APPLICATION.EXE Result: Entry Point Not Found (X) The procedure entry point Py_FinalizeEx could not be located in the dynamic link library C:\PATH\TO\APPLICATION.EXE Expected Result: Application runs Rebuilding, after replacing Py_FinalizeEx(void) with Py_Finalize(void): Application runs when pointing to 3.5 DLLs. Suggested resolution: Declaration should be restricted to ABI 3.6+: #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(int) Py_FinalizeEx(void); #endif ---------- components: Interpreter Core messages: 329959 nosy: AJNeufeld priority: normal severity: normal status: open title: Py_FinalizeEx unconditionally exists in Py_LIMITED_API type: crash versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 15 16:09:43 2018 From: report at bugs.python.org (batterystaple456) Date: Thu, 15 Nov 2018 21:09:43 +0000 Subject: [New-bugs-announce] [issue35260] 2to3 Parse Error on Python 3 print() with arguments Message-ID: <1542316183.46.0.788709270274.issue35260@psf.upfronthosting.co.za> New submission from batterystaple456 : File a.py: ------------------------------------ print("foo", end='bar') # ParseError ------------------------------------ I think the error is caused by arguments in the Python 3 print() function (e.g. end, sep) that are not ignored by 2to3, and (possibly) treated like Python 2 code. Console stuff: --------------------------------------------------- $ pip install 2to3 Requirement already satisfied: 2to3 in .\python37\lib\site-packages (1.0) $ 2to3 .\a.py ... RefactoringTool: Can't parse .\a.py: ParseError: bad input: type=22, value='=', context=('', (1, 16)) ... --------------------------------------------------- ---------- components: 2to3 (2.x to 3.x conversion tool) messages: 329966 nosy: batterystaple456 priority: normal severity: normal status: open title: 2to3 Parse Error on Python 3 print() with arguments type: compile error versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 15 16:56:03 2018 From: report at bugs.python.org (pmpp) Date: Thu, 15 Nov 2018 21:56:03 +0000 Subject: [New-bugs-announce] [issue35261] readline.c: PyOS_InputHook not protected against SIGWINCH Message-ID: <1542318963.39.0.788709270274.issue35261@psf.upfronthosting.co.za> New submission from pmpp : when using PyOS_InputHook from within readline module two signals are to be handled SIGINT and SIGWINCH SIGINT is really usefull in case hook has a problem though in some case it should be nice to prevent it too (async loop in repl background) but SIGWINCH is an annoyance and often lead to interpreter crash. sample file: linux crash test under ubuntu bionic python 3.7.1 gcc7 more elaborated test case https://github.com/pmp-p/aioprompt ---------- components: Extension Modules files: pih.py messages: 329969 nosy: pmpp priority: normal severity: normal status: open title: readline.c: PyOS_InputHook not protected against SIGWINCH type: crash versions: Python 3.7 Added file: https://bugs.python.org/file47935/pih.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 15 20:44:22 2018 From: report at bugs.python.org (Abram Clark) Date: Fri, 16 Nov 2018 01:44:22 +0000 Subject: [New-bugs-announce] [issue35262] There should be a list.get just like dict.get Message-ID: <1542332662.89.0.788709270274.issue35262@psf.upfronthosting.co.za> New submission from Abram Clark : Just like with dictionaries, it is convenient to index lists without catching exceptions. Adding an import for this most basic functionality is slightly tedious, and I can't imagine it would break anything to add a list.get method. ---------- messages: 329978 nosy: Abram Clark priority: normal severity: normal status: open title: There should be a list.get just like dict.get type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 16 01:26:06 2018 From: report at bugs.python.org (Raymond Hettinger) Date: Fri, 16 Nov 2018 06:26:06 +0000 Subject: [New-bugs-announce] [issue35263] Add None handling for get_saved() in IDLE Message-ID: <1542349566.92.0.788709270274.issue35263@psf.upfronthosting.co.za> New submission from Raymond Hettinger : Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1705, in __call__ return self.func(*args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/multicall.py", line 176, in handler r = l[i](event) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/filelist.py", line 54, in close_all_callback reply = edit.close() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/pyshell.py", line 1014, in close return EditorWindow.close(self) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/editor.py", line 1015, in close reply = self.maybesave() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/outwin.py", line 93, in maybesave return 'yes' if self.get_saved() else 'no' File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/editor.py", line 948, in get_saved return self.undo.get_saved() AttributeError: 'NoneType' object has no attribute 'get_saved' ---------- assignee: terry.reedy components: IDLE messages: 329982 nosy: rhettinger, terry.reedy priority: normal severity: normal status: open title: Add None handling for get_saved() in IDLE versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 16 08:10:44 2018 From: report at bugs.python.org (Alexandru Ardelean) Date: Fri, 16 Nov 2018 13:10:44 +0000 Subject: [New-bugs-announce] [issue35264] SSL Module build fails with OpenSSL 1.1.0 for Python 2.7 Message-ID: <1542373844.15.0.788709270274.issue35264@psf.upfronthosting.co.za> New submission from Alexandru Ardelean : The Modules/_ssl.c build fails. Error is: ``` building '_ssl' extension arm-openwrt-linux-muslgnueabi-gcc -fPIC -fno-strict-aliasing -Os -pipe -mcpu=xscale -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=soft -iremap/build_dir/target-arm_xscale_musl_eabi/Python-2.7.15:Python-2.7.15 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -DNDEBUG -Os -pipe -mcpu=xscale -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=soft -iremap/build_dir/target-arm_xscale_musl_eabi/Python-2.7.15:Python-2.7.15 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I. -IInclude -I./Include -I/staging_dir/target-arm_xscale_musl_eabi/include -I/staging_dir/toolchain-arm_xscale_gcc-7.3.0_musl_eabi/usr/include -I/staging_dir/toolchain-arm_xscale_gcc-7.3.0_musl_eabi/include/fortify -I/staging_dir/toolchain-arm_xscale_gcc-7.3.0_musl_eabi/include -I/staging_dir/target-arm_xscale_musl_eabi/usr/include -I/staging_dir/hostpkg/bin/Include -I/staging_dir/hostpkg/bin -c /build_dir/target-arm_xscale_musl_eabi/Python-2.7.15/Modules/_ssl.c -o build/temp.linux2-2.7//build_dir/target-arm_xscale_musl_eabi/Python-2.7.15/Modules/_ssl.o cc1: note: someone does not honour COPTS correctly, passed 2 times /build_dir/target-arm_xscale_musl_eabi/Python-2.7.15/Modules/_ssl.c:2117:44: error: 'PySSL_selected_npn_protocol' undeclared here (not in a function); did you mean 'PySSL_selected_alpn_protocol'? {"selected_npn_protocol", (PyCFunction)PySSL_selected_npn_protocol, METH_NOARGS}, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ PySSL_selected_alpn_protocol ``` This is on OpenWrt. ---------- assignee: christian.heimes components: Build, SSL messages: 329995 nosy: Alexandru Ardelean, christian.heimes priority: normal severity: normal status: open title: SSL Module build fails with OpenSSL 1.1.0 for Python 2.7 versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 16 09:25:45 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 16 Nov 2018 14:25:45 +0000 Subject: [New-bugs-announce] [issue35265] Internal C API: pass the memory allocator in a context Message-ID: <1542378345.74.0.788709270274.issue35265@psf.upfronthosting.co.za> New submission from STINNER Victor : Currently, the Python initialization code base is full of: static void pymain_clear_cmdline(_PyMain *pymain, _PyCmdline *cmdline) { PyMemAllocatorEx old_alloc; _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); ... PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); } It's a hack that I wrote when I worked on the Python initialization code, to make sure that we use the same memory allocator to allocate and release memory. The problem is that Python allocates memory at startup, then the memory allocator can be changed in Py_Initialize() (ex: by PYTHONMALLOC environment variable), but at exit, we need to reuse the same memory allocator that we used to allocate memory early. Instead of "forcing" the memory allocator to "default allocator", I propose to add a new "context" structure which contains the memory allocator (PyMemAllocatorEx structure). Example: typedef struct { /* Enable UTF-8 mode? Set by -X utf8 command line option and PYTHONUTF8 environment variable. If set to -1 (default), inherit Py_UTF8Mode value. */ int utf8_mode; PyMemAllocatorEx raw_alloc; } _PyConfigCtx; The context should be passed to any function allocating directly or indirectly memory. Py_Main(), "core config" and "path config" are good target for these changes. These functions are used during Python initialization. I know that Eric Snow would like to pass a "context" to functions of the C API. I don't want to make a giant change of the C API. I only want to modify the internal C API, and only modifiy Python internal. The context that I propose is designed for early Python initialization, and fix the practical problem of memory allocator. Later we can discussed how _PyRuntime and the pointer to the current interpreter can be added into this context, or if a new context should be created. Attached PR is a proof-of-concept of my idea, but the giant PR might be splitted into smaller changes to more incremental changes. ---------- components: Interpreter Core messages: 330001 nosy: eric.snow, ncoghlan, vstinner priority: normal severity: normal status: open title: Internal C API: pass the memory allocator in a context type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 16 09:44:06 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 16 Nov 2018 14:44:06 +0000 Subject: [New-bugs-announce] [issue35266] Add _PyPreConfig and rework _PyCoreConfig and _PyMainInterpreterConfig Message-ID: <1542379446.44.0.788709270274.issue35266@psf.upfronthosting.co.za> New submission from STINNER Victor : The C code of Python initialization uses _PyCoreConfig and _PyMainInterpreterConfig which co-exist and more or less redundant. For example, both structures have "argv": wchar_** for _PyCoreConfig, PyObject* (list of str) for _PyMainInterpreterConfig. I propose to put _PyCoreConfig inside _PyMainInterpreterConfig and move wchar_t* strings into a new _PyPreConfig structure. The main idea is that _PyPreConfig and wchar_* type are only used for early Python initialization, but once Python is initialization, the configuration should be provided as Python objects. I didn't check all configuration variables to see if it's doable or not, but I wrote a proof-of-concept pull request to show my idea with concrete (and working!) code. See attached PR. ---------- components: Interpreter Core messages: 330005 nosy: eric.snow, ncoghlan, vstinner priority: normal severity: normal status: open title: Add _PyPreConfig and rework _PyCoreConfig and _PyMainInterpreterConfig versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 16 20:06:39 2018 From: report at bugs.python.org (dzhu) Date: Sat, 17 Nov 2018 01:06:39 +0000 Subject: [New-bugs-announce] [issue35267] reproducible deadlock with multiprocessing.Pool Message-ID: <1542416799.14.0.788709270274.issue35267@psf.upfronthosting.co.za> New submission from dzhu : The attached snippet causes a deadlock just about every time it's run (tested with 3.6.7/Ubuntu, 3.7.1/Arch, 3.6.7/OSX, and 3.7.1/OSX -- deadlock seems to be less frequent on the last, but still common). The issue appears to be something like the following sequence of events: 1. The main thread calls pool.__exit__, eventually entering Pool._terminate_pool. 2. result_handler's state is set to TERMINATE, causing it to stop reading from outqueue. 3. The main thread, in _terminate_pool, joins on worker_handler, which is (usually) in the middle of sleeping for 0.1 seconds, opening a window for the next two steps to occur. 4. The worker process finishes its task and acquires the shared outqueue._wlock. 5. The worker attempts to put the result into outqueue, but its pickled form is too big to fit into the buffer of os.pipe, and it blocks here with the lock held. 6. worker_handler wakes up and exits, freeing _terminate_pool to continue. 7. _terminate_pool terminates the worker. 8. task_handler tries to put None into outqueue, but blocks, since the lock was acquired by the terminated worker. 9. _terminate_pool joins on task_handler, and everything is deadlocked. ---------- components: Library (Lib) files: lock.py messages: 330017 nosy: dzhu priority: normal severity: normal status: open title: reproducible deadlock with multiprocessing.Pool type: behavior versions: Python 3.6, Python 3.7 Added file: https://bugs.python.org/file47937/lock.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 17 06:52:54 2018 From: report at bugs.python.org (Cezary Wagner) Date: Sat, 17 Nov 2018 11:52:54 +0000 Subject: [New-bugs-announce] [issue35268] Windows asyncio reading continously stdin and stdout Stockfish Message-ID: <1542455574.0.0.788709270274.issue35268@psf.upfronthosting.co.za> New submission from Cezary Wagner : I have some problems with asyncio on Windows - it block where it should go. Documentation shows that it should work: https://docs.python.org/3/library/asyncio-stream.html -> StreamReader should return something. See 1st example: import asyncio import sys async def run_stockfish(): STOCKFISH_PATH = r'C:\root\chess\stockfish\stockfish 9\stockfish_9_x64_bmi2.exe' stockfish = await asyncio.subprocess.create_subprocess_exec( STOCKFISH_PATH, stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) stockfish.stdin.write('uci'.encode()) while True: # BUG? - blocks at this line - no output line = await stockfish.stdout.read() print(line) await stockfish.wait() if sys.platform == "win32": asyncio.set_event_loop_policy( asyncio.WindowsProactorEventLoopPolicy()) asyncio.run(run_stockfish(), debug=True) 1st output (nothing): Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32 runfile('C:/Users/Cezary Wagner/PycharmProjects/stockfish-proxy/sandbox/async_proxy/s01_async_stockfish.py', wdir='C:/Users/Cezary Wagner/PycharmProjects/stockfish-proxy/sandbox/async_proxy') 2nd example: import asyncio import sys async def run_stockfish(): STOCKFISH_PATH = r'C:\root\chess\stockfish\stockfish 9\stockfish_9_x64_bmi2.exe' stockfish = await asyncio.subprocess.create_subprocess_exec( STOCKFISH_PATH, stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) stockfish.stdin.write('uci'.encode()) while True: # BUG? - blocks at this line line = await stockfish.stdout.readline() print(line) await stockfish.wait() if sys.platform == "win32": asyncio.set_event_loop_policy( asyncio.WindowsProactorEventLoopPolicy()) asyncio.run(run_stockfish(), debug=True) 2nd output is little better (first line is read): Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32 runfile('C:/Users/Cezary Wagner/PycharmProjects/stockfish-proxy/sandbox/async_proxy/s01_async_stockfish.py', wdir='C:/Users/Cezary Wagner/PycharmProjects/stockfish-proxy/sandbox/async_proxy') b'Stockfish 9 64 BMI2 by T. Romstad, M. Costalba, J. Kiiski, G. Linscott\r\n' What should be done in both case (or maybe done): Stockfish 9 64 BMI2 by T. Romstad, M. Costalba, J. Kiiski, G. Linscott uci id name Stockfish 9 64 BMI2 id author T. Romstad, M. Costalba, J. Kiiski, G. Linscott option name Debug Log File type string default option name Contempt type spin default 20 min -100 max 100 option name Threads type spin default 1 min 1 max 512 option name Hash type spin default 16 min 1 max 131072 option name Clear Hash type button option name Ponder type check default false option name MultiPV type spin default 1 min 1 max 500 option name Skill Level type spin default 20 min 0 max 20 option name Move Overhead type spin default 30 min 0 max 5000 option name Minimum Thinking Time type spin default 20 min 0 max 5000 option name Slow Mover type spin default 89 min 10 max 1000 option name nodestime type spin default 0 min 0 max 10000 option name UCI_Chess960 type check default false option name SyzygyPath type string default option name SyzygyProbeDepth type spin default 1 min 1 max 100 option name Syzygy50MoveRule type check default true option name SyzygyProbeLimit type spin default 6 min 0 max 6 uciok ---------- components: Windows, asyncio messages: 330028 nosy: Cezary.Wagner, asvetlov, paul.moore, steve.dower, tim.golden, yselivanov, zach.ware priority: normal severity: normal status: open title: Windows asyncio reading continously stdin and stdout Stockfish versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 17 12:15:56 2018 From: report at bugs.python.org (Zackery Spytz) Date: Sat, 17 Nov 2018 17:15:56 +0000 Subject: [New-bugs-announce] [issue35269] A possible segfault involving a newly-created coroutine Message-ID: <1542474956.13.0.788709270274.issue35269@psf.upfronthosting.co.za> New submission from Zackery Spytz : If compute_cr_origin() fails in PyCoro_New(), coro->cr_origin won't be initialized. This will cause a crash during the coroutine's deallocation. I'll create a PR for this issue. ---------- components: Interpreter Core, asyncio messages: 330031 nosy: ZackerySpytz, asvetlov, yselivanov priority: normal severity: normal status: open title: A possible segfault involving a newly-created coroutine type: crash versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 17 18:06:01 2018 From: report at bugs.python.org (daniel hahler) Date: Sat, 17 Nov 2018 23:06:01 +0000 Subject: [New-bugs-announce] [issue35270] Cmd.complete does not handle cmd=None Message-ID: <1542495961.77.0.788709270274.issue35270@psf.upfronthosting.co.za> New submission from daniel hahler : When `parseline` returns `None` for `cmd` (like pdb++ might cause it when changing a cmd "disable" to "!disable"), the following will cause a TypeError: > compfunc = getattr(self, 'complete_' + cmd) "None" should be also forwarded to "completedefault", just like cmd="". ---------- components: Library (Lib) messages: 330035 nosy: blueyed priority: normal severity: normal status: open title: Cmd.complete does not handle cmd=None type: crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 18 07:08:07 2018 From: report at bugs.python.org (wvxvw) Date: Sun, 18 Nov 2018 12:08:07 +0000 Subject: [New-bugs-announce] [issue35271] venv creates pyvenv.cfg with wrong home Message-ID: <1542542887.08.0.788709270274.issue35271@psf.upfronthosting.co.za> New submission from wvxvw : I must have some environment variable set, which affects this behavior, but I don't know which one that would be. What happens is as follows: No matter in what directory I execute this command: python3 -m venv .venv or python3 -m venv $(pwd)/.venv no matter if the path is relative or absolute, the value of "home" in generated pyvenv.cfg will point to some other virtual environment I created earlier. I would expect that at the minimum, if you aren't going to use the argument given on command line, then, at the minimum, alert the user about it. Why even bother given the argument in this case? PS. I discovered this, perhaps, due to using Emacs + pyvenv-* commands which probably set some environment variables. ---------- components: Library (Lib) messages: 330044 nosy: wvxvw priority: normal severity: normal status: open title: venv creates pyvenv.cfg with wrong home type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 18 08:36:06 2018 From: report at bugs.python.org (Muhammed Alkan) Date: Sun, 18 Nov 2018 13:36:06 +0000 Subject: [New-bugs-announce] [issue35272] sqlite3 get the connected database url Message-ID: <1542548166.85.0.788709270274.issue35272@psf.upfronthosting.co.za> New submission from Muhammed Alkan : A feature for to get the connected database path or URL from connection object (sqlite3.Connection). ---------- messages: 330047 nosy: berker.peksag, ghaering, midnio priority: normal severity: normal status: open title: sqlite3 get the connected database url type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 19 01:24:19 2018 From: report at bugs.python.org (yesheng) Date: Mon, 19 Nov 2018 06:24:19 +0000 Subject: [New-bugs-announce] [issue35273] 'eval' in generator expression behave different in dict from list Message-ID: <1542608659.0.0.788709270274.issue35273@psf.upfronthosting.co.za> New submission from yesheng <13611358285 at 139.com>: def yyy(): a, b = 'abc', 'abd' print([eval(i) for i in ('a', 'b')]) def zzz(): a, b = 'abc', 'abd' print({i: eval(i) for i in ('a', 'b')}) yyy() # ok zzz() # NameError: name 'a' is not defined, however in yyy() it is ok ---------- messages: 330073 nosy: yesheng priority: normal severity: normal status: open title: 'eval' in generator expression behave different in dict from list type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 19 02:45:59 2018 From: report at bugs.python.org (otst) Date: Mon, 19 Nov 2018 07:45:59 +0000 Subject: [New-bugs-announce] [issue35274] Running print("\x98") then freeze in Interpreter Message-ID: <1542613559.05.0.788709270274.issue35274@psf.upfronthosting.co.za> New submission from otst : My environment OS:Ubuntu18.04(x64) Python:3.6.6 Run print("\x98") in Python3 interpreter then freeze or slow responsed. Not problem run print '\x98' in Python 2.7.15rc1. Also no problem for python3 -c "print('\x98');" and run .py file. ---------- components: Interpreter Core messages: 330076 nosy: otst priority: normal severity: normal status: open title: Running print("\x98") then freeze in Interpreter type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 19 05:38:14 2018 From: report at bugs.python.org (Thomas Guettler) Date: Mon, 19 Nov 2018 10:38:14 +0000 Subject: [New-bugs-announce] [issue35275] Reading umask (thread-safe) Message-ID: <1542623894.75.0.788709270274.issue35275@psf.upfronthosting.co.za> New submission from Thomas Guettler : Up to now there is no thread way to read the umask in Python https://stackoverflow.com/questions/53227072/reading-umask-thread-safe You can use this pattern: current_umask = os.umask(0) # line1 os.umask(current_umask) # line2 return current_umask A thread which executes between line1 and line2 will have a different umask. I would be great, if the python standard library would provide correspondig thread safe method. Related question at stackoverflow: https://stackoverflow.com/questions/53227072/reading-umask-thread-safe ---------- messages: 330083 nosy: guettli priority: normal severity: normal status: open title: Reading umask (thread-safe) _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 19 06:50:08 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 19 Nov 2018 11:50:08 +0000 Subject: [New-bugs-announce] [issue35276] Document thread safety Message-ID: <1542628208.58.0.788709270274.issue35276@psf.upfronthosting.co.za> New submission from STINNER Victor : Many developers only discover that a Python function/module is not thread safe because they have a bug in production... Some examples: * bpo-7672: ssl * bpo-8865: select.poll is not thread safe * bpo-539175, bpo-21216: socket.gethostbyname() * bpo-7980: time.strptime() * bpo-6647: warnings.catch_warnings() * bpo-11077, bpo-33479: Tkinter * bpo-1336, bpo-19809: subprocess on Python 2 * bpo-15329: deque * bpo-35275: os.umask() Hopefully, sometimes it was possible to fix it: * bpo-3139: bytearray, buffer protocol * bpo-28969: @functools.lru_cache * bpo-21291: subprocess.Popen.wait() In the asyncio documentation, I explicitly documented that, by design, most classes are not thread-safe. For example, asyncio.Lock() is *NOT* thread-safe: https://docs.python.org/dev/library/asyncio-sync.html#asyncio.Lock Maybe we should start to use a standard way to describe "thread safety". See "POSIX Safety Concepts" of the GNU libc: https://www.gnu.org/software/libc/manual/html_node/POSIX-Safety-Concepts.html#POSIX-Safety-Concepts Example with setlocale, "MT-Unsafe": https://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html -- My own (incomplete) list of "process-wide states": https://vstinner.readthedocs.io/threads.html#process-wide ---------- assignee: docs at python components: Documentation messages: 330093 nosy: docs at python, vstinner priority: normal severity: normal status: open title: Document thread safety versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 19 07:21:44 2018 From: report at bugs.python.org (Donald Stufft) Date: Mon, 19 Nov 2018 12:21:44 +0000 Subject: [New-bugs-announce] [issue35277] Upgrade bundled pip/setuptools Message-ID: <1542630104.24.0.788709270274.issue35277@psf.upfronthosting.co.za> New submission from Donald Stufft : Upgrade the bundled pip/setuptools to the latest version. Making this issue because blurb gets mad at me if I try to add a news entry without a bpo issue. ---------- assignee: dstufft components: Library (Lib) messages: 330096 nosy: dstufft priority: normal severity: normal status: open title: Upgrade bundled pip/setuptools versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 19 07:46:03 2018 From: report at bugs.python.org (Yusuke Endoh) Date: Mon, 19 Nov 2018 12:46:03 +0000 Subject: [New-bugs-announce] [issue35278] directory traversal in tempfile prefix Message-ID: <1542631563.19.0.788709270274.issue35278@psf.upfronthosting.co.za> New submission from Yusuke Endoh : Hello, The tempfile library does not check the prefix argument, which can be exploited to create files outside tmpdir by using directory traversal. ``` >>> import tempfile >>> tempfile.gettempprefix() 'tmp' >>> f = tempfile.NamedTemporaryFile(prefix="/home/mame/cracked") >>> f.name '/home/mame/crackedlt3y_ddm' ``` The same issue was found and treated as a vulnerability in PHP (CVE-2006-1494) and Ruby (CVE-2018-6914). I first reported this issue to security at python.org at July 2018. Some people kindly discussed it, and finally I was told to create a ticket here. ---------- components: Library (Lib) messages: 330097 nosy: Yusuke Endoh priority: normal severity: normal status: open title: directory traversal in tempfile prefix type: security versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 19 09:26:55 2018 From: report at bugs.python.org (=?utf-8?b?Vm9qdMSbY2ggQm/EjWVr?=) Date: Mon, 19 Nov 2018 14:26:55 +0000 Subject: [New-bugs-announce] [issue35279] asyncio uses too many threads by default Message-ID: <1542637615.61.0.788709270274.issue35279@psf.upfronthosting.co.za> New submission from Vojt?ch Bo?ek : By default, asyncio spawns as many as os.cpu_count() * 5 threads to run I/O on. When combined with beefy machines (e.g. kubernetes servers) with, says, 56 cores, it results in very high memory usage. This is amplified by the fact that the `concurrent.futures.ThreadPoolExecutor` threads are never killed, and are not re-used until `max_workers` threads are spawned. Workaround: loop.set_default_executor(concurrent.futures.ThreadPoolExecutor(max_workers=8)) This is still not ideal as the program might not need max_workers threads, but they are still spawned anyway. I've hit this issue when running asyncio program in kubernetes. It created 260 idle threads and then ran out of memory. I think the default max_workers should be limited to some max value and ThreadPoolExecutor should not spawn new threads unless necessary. ---------- components: asyncio messages: 330101 nosy: Vojt?ch Bo?ek, asvetlov, yselivanov priority: normal severity: normal status: open title: asyncio uses too many threads by default type: resource usage versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 19 10:20:30 2018 From: report at bugs.python.org (dingens) Date: Mon, 19 Nov 2018 15:20:30 +0000 Subject: [New-bugs-announce] [issue35280] Interactive shell overwrites history Message-ID: <1542640830.02.0.788709270274.issue35280@psf.upfronthosting.co.za> New submission from dingens : When opening two shells at the same time, history from the one that is closed first gets lost. Steps to reproduce: - let's call the contents of the history before this experiment `z` - open two interactive shells called A and B - execute commands in them, say `a` and `b`, respectively - close shell A - close shell B Actual behavior: - history contains `z` then `b` Expected behavior: - history contains `z` then `a` then `b` possibly related: issue22940 ---------- messages: 330103 nosy: dingens priority: normal severity: normal status: open title: Interactive shell overwrites history type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 19 14:25:49 2018 From: report at bugs.python.org (Lihu) Date: Mon, 19 Nov 2018 19:25:49 +0000 Subject: [New-bugs-announce] [issue35281] Allow access to unittest.TestSuite tests Message-ID: <1542655549.43.0.788709270274.issue35281@psf.upfronthosting.co.za> New submission from Lihu : I would like to have access to the list of tests in a TestSuite object. Currently there are two ways of doing this: I can access the protected attribute `_tests`, or I can iterate over the TestSuite and re-create data that I already have. The former option isn't part of the public API and makes mypy mad, and the latter seems redundant. Could we get a public property or getter for the internal test list (or a more appropriate implementation if necessary)? ---------- components: Library (Lib) messages: 330111 nosy: lbenezriravin priority: normal severity: normal status: open title: Allow access to unittest.TestSuite tests type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 20 14:34:11 2018 From: report at bugs.python.org (Martin DeMello) Date: Tue, 20 Nov 2018 19:34:11 +0000 Subject: [New-bugs-announce] [issue35282] Add a return value to lib2to3.refactor.refactor_file and refactor_dir Message-ID: <1542742451.18.0.788709270274.issue35282@psf.upfronthosting.co.za> New submission from Martin DeMello : It would be useful for lib2to3.refactor to return which files were actually changed. Right now that information is logged but not returned. ---------- components: 2to3 (2.x to 3.x conversion tool) messages: 330149 nosy: martindemello priority: normal severity: normal status: open title: Add a return value to lib2to3.refactor.refactor_file and refactor_dir type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 20 17:16:29 2018 From: report at bugs.python.org (Dieter Maurer) Date: Tue, 20 Nov 2018 22:16:29 +0000 Subject: [New-bugs-announce] [issue35283] "threading._DummyThread" redefines "is_alive" but forgets "isAlive" Message-ID: <1542752189.25.0.788709270274.issue35283@psf.upfronthosting.co.za> New submission from Dieter Maurer : In module "threading", class "Thread" defines "is_alive" and defines "isAlive = is_alive". The derived class "_DummyThread" redefines "is_alive" but forgets to update the "isAlive" alias. As a consequence, calling "_DummyThread.isAlive" leads to an "AssertionErrror". The "isAlive" method is mentioned in the docstring of "Thread.join". ---------- components: Library (Lib) messages: 330158 nosy: dmaurer priority: normal severity: normal status: open title: "threading._DummyThread" redefines "is_alive" but forgets "isAlive" type: crash _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 20 17:38:01 2018 From: report at bugs.python.org (Zackery Spytz) Date: Tue, 20 Nov 2018 22:38:01 +0000 Subject: [New-bugs-announce] [issue35284] Incomplete error handling in the compiler's compiler_call() Message-ID: <1542753481.5.0.788709270274.issue35284@psf.upfronthosting.co.za> New submission from Zackery Spytz : compiler_call() needs to check if an error occurred during the maybe_optimize_method_call() call. ---------- components: Interpreter Core messages: 330159 nosy: ZackerySpytz priority: normal severity: normal status: open title: Incomplete error handling in the compiler's compiler_call() type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 20 17:46:27 2018 From: report at bugs.python.org (=?utf-8?b?SWduYXMgQnJhxaFpxaFraXM=?=) Date: Tue, 20 Nov 2018 22:46:27 +0000 Subject: [New-bugs-announce] [issue35285] Make Proactor api extensible for reasonably any file handle Message-ID: <1542753987.17.0.788709270274.issue35285@psf.upfronthosting.co.za> New submission from Ignas Bra?i?kis : There was old issue (https://bugs.python.org/issue30539) requesting extension ability at proactor loop for third party libraries. It was rejected as it was asking to broad functionality and not particular api. This issue purpose is to discuss more concrete api needed to bring proactor functionally at least on par with selector. While loop covers most valid cases it still has no ability to run any third party libraries with file descriptors. As a consequence there is workarounds with unofficial api and handle wrappers to expose and call private proactor methods (https://github.com/m-labs/asyncserial/blob/master/asyncserial/asyncserial.py#L172). Selector basically has the following api: loop.add_reader(fd, callback, *args) loop.remove_reader(fd) loop.add_writer(fd, callback, *args) loop.remove_writer(fd) Nature of selector makes it easy for user to provide those operations on descriptor: make read from when it is available or make write from somewhere when you can also cancel operation. Proactor on the other hand need to be told what and where to copy, and run callback when it's done (probably with error, also buffer passed to callback ???). It also needs to have ability to cancel operations. One possibility of such api could look like this: loop.start_read_operation(fd, buffer, done_callback, *args) where done_callback = function(buffer, bytes_read, error) loop.cancel_read_operation(fd, operation) loop.start_write_operation(fd, buffer, done_callback, *args) where done_callback = function(bytes_written, error) loop.cancel_write_operation(fd, operation) There probably can be a plenty refinement here to the naming buffer, or callback workings, but in general there should be start and cancel operations. This api might even be implemented for selectors (selectors might imitate behaviour with custom writer), thought probably it this usage might be discouraged in favour of add_writer/reader logic. As examples of this api besides IOCP (which is implementation in question here) there is linux aio (http://man7.org/linux/man-pages/man2/io_submit.2.html) api which uses similar proactor concepts. This api obviously can be wrapped to higher level api with futures, but this probably should remain low level functionality where it is responsibility of library implementer to do right thing. Usage is pretty limited here: mainly writing file descriptors and devices/ttys asynchronously on Win32 platform. Python itself is not exactly systems programming language, but it convenient for accessing some OS features. Sockets and pipes are covered by standard library. But still if could prevent plenty of hacks and give library writers and odd few users place to hang on. ---------- components: asyncio messages: 330160 nosy: Ignas Bra?i?kis, asvetlov, yselivanov priority: normal severity: normal status: open title: Make Proactor api extensible for reasonably any file handle type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 21 02:15:29 2018 From: report at bugs.python.org (Boris Yang) Date: Wed, 21 Nov 2018 07:15:29 +0000 Subject: [New-bugs-announce] [issue35289] wrong result for difflib.SequenceMatcher Message-ID: <1542784529.35.0.788709270274.issue35289@psf.upfronthosting.co.za> New submission from Boris Yang : How to repeat: # -*- coding: UTF-8 -*- from difflib import SequenceMatcher seqMatcher = SequenceMatcher(None, "????", "????") seqMatcher.get_matching_blocks() Expect Result: [Match(a=0, b=3, size=2), Match(a=2, b=0, size=2), Match(a=5, b=5, size=0)] Current Result: [Match(a=0, b=3, size=2), Match(a=5, b=5, size=0)] ---------- messages: 330175 nosy: Boris Yang priority: normal severity: normal status: open title: wrong result for difflib.SequenceMatcher type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 21 05:49:52 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 21 Nov 2018 10:49:52 +0000 Subject: [New-bugs-announce] [issue35290] [FreeBSD] test_c_locale_coercion: fsencoding is ASCII instead of UTF-8 on FreeBSD CURRENT buildbot Message-ID: <1542797392.41.0.788709270274.issue35290@psf.upfronthosting.co.za> New submission from STINNER Victor : It seems like the commit 02e6bf7f2025cddcbde6432f6b6396198ab313f4 (bpo-28604) broke test_c_locale_coercion on FreeBSD CURRENT Shared 3.x: https://buildbot.python.org/all/#/builders/168/builds/247 0:19:33 load avg: 7.69 [401/419/2] test_c_locale_coercion failed -- running: test_decimal (40 sec 626 ms), test_lib2to3 (2 min 3 sec) test_external_target_locale_configuration (test.test_c_locale_coercion.LocaleConfigurationTests) ... ok test_LC_ALL_set_to_C (test.test_c_locale_coercion.LocaleCoercionTests) ... ok test_PYTHONCOERCECLOCALE_not_set (test.test_c_locale_coercion.LocaleCoercionTests) ... test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) ... test_PYTHONCOERCECLOCALE_set_to_warn (test.test_c_locale_coercion.LocaleCoercionTests) ... test_PYTHONCOERCECLOCALE_set_to_zero (test.test_c_locale_coercion.LocaleCoercionTests) ... ok ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_set (test.test_c_locale_coercion.LocaleCoercionTests) (default_locale=True, PYTHONCOERCECLOCALE=None) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 341, in _check_c_locale_coercion self._check_child_encoding_details(base_var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_set (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='C', PYTHONCOERCECLOCALE=None) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'c', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_set (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='C', PYTHONCOERCECLOCALE=None) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_set (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE=None) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'invalid.ascii', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_set (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE=None) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (default_locale=True, PYTHONCOERCECLOCALE='') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 341, in _check_c_locale_coercion self._check_child_encoding_details(base_var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='C', PYTHONCOERCECLOCALE='') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'c', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='C', PYTHONCOERCECLOCALE='') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE='') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'invalid.ascii', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE='') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (default_locale=True, PYTHONCOERCECLOCALE='1') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 341, in _check_c_locale_coercion self._check_child_encoding_details(base_var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='C', PYTHONCOERCECLOCALE='1') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'c', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='C', PYTHONCOERCECLOCALE='1') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE='1') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'invalid.ascii', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE='1') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (default_locale=True, PYTHONCOERCECLOCALE='true') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 341, in _check_c_locale_coercion self._check_child_encoding_details(base_var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='C', PYTHONCOERCECLOCALE='true') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'c', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='C', PYTHONCOERCECLOCALE='true') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE='true') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'invalid.ascii', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE='true') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (default_locale=True, PYTHONCOERCECLOCALE='false') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 341, in _check_c_locale_coercion self._check_child_encoding_details(base_var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='C', PYTHONCOERCECLOCALE='false') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'c', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='C', PYTHONCOERCECLOCALE='false') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE='false') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'invalid.ascii', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_not_zero (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE='false') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_set_to_warn (test.test_c_locale_coercion.LocaleCoercionTests) (default_locale=True, PYTHONCOERCECLOCALE='warn') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 341, in _check_c_locale_coercion self._check_child_encoding_details(base_var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_set_to_warn (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='C', PYTHONCOERCECLOCALE='warn') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[131 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'c', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_set_to_warn (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='C', PYTHONCOERCECLOCALE='warn') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_set_to_warn (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LANG', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE='warn') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[143 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': 'invalid.ascii', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ====================================================================== FAIL: test_PYTHONCOERCECLOCALE_set_to_warn (test.test_c_locale_coercion.LocaleCoercionTests) (env_var='LC_CTYPE', nominal_locale='invalid.ascii', PYTHONCOERCECLOCALE='warn') ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 356, in _check_c_locale_coercion self._check_child_encoding_details(var_dict, File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_c_locale_coercion.py", line 231, in _check_child_encoding_details self.assertEqual(encoding_details, expected_details) AssertionError: {'fsencoding': 'ascii', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} != {'fsencoding': 'utf-8', 'stdin_info': 'utf-8:surrogateesc[130 chars]: ''} - {'fsencoding': 'ascii', ? ^^^^^ + {'fsencoding': 'utf-8', ? ^^^^^ 'lang': '', 'lc_all': '', 'lc_ctype': 'c.utf-8', 'stderr_info': 'utf-8:backslashreplace', 'stdin_info': 'utf-8:surrogateescape', 'stdout_info': 'utf-8:surrogateescape'} ---------------------------------------------------------------------- Ran 6 tests in 6.205s FAILED (failures=30) test test_c_locale_coercion failed ---------- components: Interpreter Core messages: 330189 nosy: vstinner priority: normal severity: normal status: open title: [FreeBSD] test_c_locale_coercion: fsencoding is ASCII instead of UTF-8 on FreeBSD CURRENT buildbot versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 21 10:12:32 2018 From: report at bugs.python.org (Jason Madden) Date: Wed, 21 Nov 2018 15:12:32 +0000 Subject: [New-bugs-announce] [issue35291] duplicate of memoryview from io.BufferedWriter leaks Message-ID: <1542813152.98.0.788709270274.issue35291@psf.upfronthosting.co.za> New submission from Jason Madden : Using Python 2.7.15, if a BufferedWriter wraps an IO object that duplicates the memoryview passed to the IO object's `write` method, that memoryview leaks. This script demonstrates the problem by leaking a memoryview for each iteration of the loop (if the `flush` is skipped, the leaks are less frequent but still occur): ``` from __future__ import print_function import io import gc def count_memoryview(): result = 0 for x in gc.get_objects(): if type(x) is memoryview: result += 1 return result class FileLike(object): closed = False def writable(self): return True def write(self, data): memoryview(data) # XXX: This causes the problem return len(data) bf = io.BufferedWriter(FileLike()) i = 0 memoryview_count = 0 while True: if i == 0 or i % 100 == 0: # This reports 100 new memoryview objects each time old = memoryview_count new = count_memoryview() print(i, "memoryview", new, "+%s" % (new - old)) memoryview_count = new bf.write(b"test") bf.flush() i += 1 ``` The leak can also be observed using the operating system's memory monitoring tools for the process (seen on both Fedora and macOS). Commenting out the line in `FileLike.write` that makes a duplicate memoryview of the given buffer solves the leak. Deleting the BufferedWriter doesn't appear to reclaim the leaked memoryviews. I can't duplicate this in Python 3.4 or above. Originally reported to gevent in https://github.com/gevent/gevent/issues/1318 Possibly related to Issue 26720 and Issue 15994 ---------- components: IO messages: 330206 nosy: jmadden priority: normal severity: normal status: open title: duplicate of memoryview from io.BufferedWriter leaks versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 21 12:41:40 2018 From: report at bugs.python.org (Steve Dower) Date: Wed, 21 Nov 2018 17:41:40 +0000 Subject: [New-bugs-announce] [issue35292] Make SimpleHTTPRequestHandler load mimetypes lazily Message-ID: <1542822100.42.0.788709270274.issue35292@psf.upfronthosting.co.za> New submission from Steve Dower : Importing http.server triggers mimetypes.init(), which can be fairly expensive on Windows (and potentially other platforms?) due to having to enumerate a lot of registry keys. Instead, SimpleHTTPRequestHandler.extensions_map can be a dict with just its default values in lib/http/server.py and the first call to guess_type() can initialize mimetypes if necessary. We should check whether people read from SimpleHTTPRequestHandler.extensions_map directly before calling guess_type(), and decide how quickly we can make the change. My gut feeling is we will be okay to make this in the next release but probably shouldn't backport it. ---------- components: Library (Lib), Windows keywords: easy messages: 330212 nosy: paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Make SimpleHTTPRequestHandler load mimetypes lazily type: performance versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 21 16:27:11 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 21 Nov 2018 21:27:11 +0000 Subject: [New-bugs-announce] [issue35293] make doctest (Sphinx) emits a lot of warnings Message-ID: <1542835631.23.0.788709270274.issue35293@psf.upfronthosting.co.za> New submission from STINNER Victor : The following commands emits a lot of warnings: make PYTHON=../python SPHINXOPTS="-q -W -j4" -C Doc/ venv doctest # adapt PYTHON to point to Python 3.8 compiled in debug mmode Travis CI logs: https://travis-ci.org/python/cpython/jobs/458140641 make: Entering directory `/home/travis/build/python/cpython/Doc' ../python -m venv ./venv (...) The venv has been created in the ./venv directory make[1]: Entering directory `/home/travis/build/python/cpython/Doc' mkdir -p build Building NEWS from Misc/NEWS.d with blurb PATH=./venv/bin:$PATH sphinx-build -b doctest -d build/doctrees -D latex_elements.papersize= -q -W -j4 -W . build/doctest /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/babel/localedata.py:17: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import MutableMapping /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/jinja2/runtime.py:318: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Mapping /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/jinja2/sandbox.py:82: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import MutableSet, MutableMapping, MutableSequence /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/docutils/parsers/rst/states.py:2130: RemovedInSphinx40Warning: highlightlang directive is deprecated. Please use highlight directive instead. result = directive_instance.run() /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/docutils/parsers/rst/states.py:2130: RemovedInSphinx40Warning: highlightlang directive is deprecated. Please use highlight directive instead. result = directive_instance.run() /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/docutils/parsers/rst/states.py:2130: RemovedInSphinx40Warning: highlightlang directive is deprecated. Please use highlight directive instead. result = directive_instance.run() /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/docutils/parsers/rst/states.py:2130: RemovedInSphinx40Warning: highlightlang directive is deprecated. Please use highlight directive instead. result = directive_instance.run() /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/sphinx/environment/__init__.py:340: RemovedInSphinx30Warning: env.versionchanges() is deprecated. Please use ChangeSetDomain instead. for version, changes in other.versionchanges.items(): /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/sphinx/environment/__init__.py:341: RemovedInSphinx30Warning: env.versionchanges() is deprecated. Please use ChangeSetDomain instead. self.versionchanges.setdefault(version, []).extend( /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/docutils/parsers/rst/states.py:2130: RemovedInSphinx40Warning: highlightlang directive is deprecated. Please use highlight directive instead. result = directive_instance.run() /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/docutils/parsers/rst/states.py:2130: RemovedInSphinx40Warning: highlightlang directive is deprecated. Please use highlight directive instead. result = directive_instance.run() /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/docutils/parsers/rst/states.py:2130: RemovedInSphinx40Warning: highlightlang directive is deprecated. Please use highlight directive instead. result = directive_instance.run() /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) /home/travis/build/python/cpython/Doc/tools/extensions/pyspecific.py:274: RemovedInSphinx30Warning: env.note_versionchange() is deprecated. Please use ChangeSetDomain.note_changeset() instead. env.note_versionchange('deprecated', version[0], node, self.lineno) :1: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly formatargspec(*getfullargspec(f)) :1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp obj dead or exiting /home/travis/build/python/cpython/Lib/socket.py:660: ResourceWarning: unclosed self._sock = None ResourceWarning: Enable tracemalloc to get the object allocation traceback make[1]: Leaving directory `/home/travis/build/python/cpython/Doc' make: Leaving directory `/home/travis/build/python/cpython/Doc' The command "if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then XVFB_RUN=xvfb-run; fi $XVFB_RUN make buildbottest TESTOPTS="-j4 -uall,-cpu" if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then $XVFB_RUN make PYTHON=../python SPHINXOPTS="-q -W -j4" -C Doc/ venv doctest fi " exited with 0. ---------- components: Build messages: 330217 nosy: vstinner priority: normal severity: normal status: open title: make doctest (Sphinx) emits a lot of warnings versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 21 20:02:32 2018 From: report at bugs.python.org (Ruslan Dautkhanov) Date: Thu, 22 Nov 2018 01:02:32 +0000 Subject: [New-bugs-announce] [issue35294] Race condition involving SocketServer.TCPServer Message-ID: <1542848552.12.0.788709270274.issue35294@psf.upfronthosting.co.za> New submission from Ruslan Dautkhanov : We had a long discussion in https://issues.apache.org/jira/browse/SPARK-26019 regarding a race condition that happens around https://github.com/apache/spark/blob/master/python/pyspark/accumulators.py#L289 The fix I created here - https://github.com/apache/spark/pull/23113/files basically changes bind_and_activate to False in SocketServer.TCPServer.__init__'s call and manually doing self.server_bind() self.server_activate() self.serve_forever() in that thread instead of main thread. We have a fix, but we're not sure if this is a bug in Python with multithreading / handling SocketServer.TCPServer ? Thank you. ---------- components: IO, Library (Lib) messages: 330228 nosy: Ruslan Dautkhanov priority: normal severity: normal status: open title: Race condition involving SocketServer.TCPServer versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 22 07:12:44 2018 From: report at bugs.python.org (Marcin Kowalczyk) Date: Thu, 22 Nov 2018 12:12:44 +0000 Subject: [New-bugs-announce] [issue35295] Please clarify whether PyUnicode_AsUTF8AndSize() or PyUnicode_AsUTF8String() is preferred Message-ID: <1542888764.29.0.788709270274.issue35295@psf.upfronthosting.co.za> New submission from Marcin Kowalczyk : The documentation is silent whether PyUnicode_AsUTF8AndSize() or PyUnicode_AsUTF8String() is preferred. We are under the assumption that both are acceptable for the given caller, i.e. the caller wants to access just the sequence of UTF-8 code units (e.g. for calling a C++ function which takes std::string_view or std::string as a parameter), and the caller either will copy the UTF-8 code units immediately or is willing to own a temporary object to ensure a lifetime of the UTF-8 code units. File comments in unicodeobject.h about PyUnicode_AsUTF8AndSize() have a warning: *** This API is for interpreter INTERNAL USE ONLY and will likely *** be removed or changed in the future. *** If you need to access the Unicode object as UTF-8 bytes string, *** please use PyUnicode_AsUTF8String() instead. The discrepancy between these comments and the documentation should be fixed. Either the documentation is correct and the comment is outdated, or the comment is correct and the documentation is lacking guidance. It is not even clear which function is better technically: - PyUnicode_AsUTF8String() always allocates the string. PyUnicode_AsUTF8AndSize() does not allocate the string if the unicode object is ASCII-only (this is common) or if PyUnicode_AsUTF8AndSize() was already called before. - If conversion must be performed, then PyUnicode_AsUTF8String() makes a single allocation, while PyUnicode_AsUTF8AndSize() first calls PyUnicode_AsUTF8String() and then copies the string. - If the string is converted multiple times, then PyUnicode_AsUTF8AndSize() caches the result - faster. If the string is converted once, then the result persists as long as the string persists - wastes memory. I see the following possible resolutions: 1a. Declare both functions equally acceptable. Remove comments claiming that PyUnicode_AsUTF8AndSize() should be avoided. 1b. 1a, and change the implementation of PyUnicode_AsUTF8AndSize() to avoid allocating the string twice if it needs to be materialized, so that PyUnicode_AsUTF8AndSize() is never significantly slower than PyUnicode_AsUTF8String(). 2a. Declare PyUnicode_AsUTF8String() preferred. Indicate this in the documentation. 2b. 2a, and provide a public interface to check and access UTF-8 code units without allocating a new string in case this is possible (I think PyUnicode_READY() + PyUnicode_IS_ASCII() + PyUnicode_DATA() + PyUnicode_GET_LENGTH() would work, but they are not documented; or possibly also check if the string has a cached UTF-8 representation without populating that cached representation), so that a combination of the check with PyUnicode_AsUTF8String() is rarely or never significantly slower than PyUnicode_AsUTF8AndSize(). ---------- assignee: docs at python components: Documentation, Interpreter Core, Unicode messages: 330249 nosy: Marcin Kowalczyk, docs at python, ezio.melotti, vstinner priority: normal severity: normal status: open title: Please clarify whether PyUnicode_AsUTF8AndSize() or PyUnicode_AsUTF8String() is preferred type: performance versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 22 12:33:21 2018 From: report at bugs.python.org (STINNER Victor) Date: Thu, 22 Nov 2018 17:33:21 +0000 Subject: [New-bugs-announce] [issue35296] Install Include/internal/ header files Message-ID: <1542908001.51.0.788709270274.issue35296@psf.upfronthosting.co.za> New submission from STINNER Victor : For some very specific use cases (ex: debuggers), it can be interesting to access the internal API of CPython. I propose to install the internal API: Include/internal/*.h header files. Attached PR implements this idea. ---------- components: Interpreter Core messages: 330271 nosy: eric.snow, nascheme, ncoghlan, vstinner priority: normal severity: normal status: open title: Install Include/internal/ header files versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 22 16:25:02 2018 From: report at bugs.python.org (Zsolt Cserna) Date: Thu, 22 Nov 2018 21:25:02 +0000 Subject: [New-bugs-announce] [issue35297] untokenize documentation is not correct Message-ID: <1542921902.22.0.788709270274.issue35297@psf.upfronthosting.co.za> New submission from Zsolt Cserna : untokenize documentation (https://docs.python.org/3/library/tokenize.html#tokenize.untokenize) states the following: """ Converts tokens back into Python source code. The iterable must return sequences with at least two elements, the token type and the token string. Any additional sequence elements are ignored. """ This last sentence is clearly not true because here: https://github.com/python/cpython/blob/master/Lib/tokenize.py#L242 The code checks for the length of the input token there, and the code behaves differently, in terms of whitespace, when an iterator of 2-tuples are given and when there are more elements in the tuple. When there are more elements in the tuple, the function renders whitespaces as the same as they were present in the original source. So this code: tokenize.untokenize(tokenize.tokenize(source.readline)) And this: tokenize.untokenize([x[:2] for x in tokenize.tokenize(source.readline)]) Have different results. I don't know that it is a documentation issue or a bug in the module itself, so I created this bugreport to seek for assistance in this regard. ---------- assignee: docs at python components: Documentation messages: 330281 nosy: csernazs, docs at python priority: normal severity: normal status: open title: untokenize documentation is not correct versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 22 19:14:54 2018 From: report at bugs.python.org (gilado) Date: Fri, 23 Nov 2018 00:14:54 +0000 Subject: [New-bugs-announce] [issue35298] Segfault in _PyObject_GenericGetAttrWithDict Message-ID: <1542932094.03.0.788709270274.issue35298@psf.upfronthosting.co.za> New submission from gilado : Running pulseeffects, it crashes occasionally. I have yet to find a cause, it just happens. I decided to run it under gdb to catch the crash. It worked for a few days before crashing. $ GDK_DPI_SCALE=0.6 gdb -args /usr/bin/python3 /usr/bin/pulseeffects gdb: Symbol `acs_map' has different size in shared object, consider re-linking GNU gdb (GDB) 7.8-1pclos2014 (PCLinuxOS release 2014) ... ... 13:57:26.125 - PulseEffects - CRITICAL - PM - context operation failed! 13:57:29.779 - PulseEffects - CRITICAL - PM - context operation failed! 13:57:30.391 - PulseEffects - CRITICAL - PM - context operation failed! [New LWP 27696] Program received signal SIGSEGV, Segmentation fault. [Switching to LWP 27696] 0x00007ffff73bcae6 in ?? () from /lib64/libc.so.6 (gdb) bt #0 0x00007ffff73bcae6 in () at /lib64/libc.so.6 #1 0x00007ffff29f8e08 in () at /usr/lib64/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so #2 0x00007ffff79baf1e in _PyObject_GenericGetAttrWithDict () at /usr/lib64/libpython3.6m.so.1.0 #3 0x00007ffff7a2b6b0 in _PyEval_EvalFrameDefault () at /usr/lib64/libpython3.6m.so.1.0 #4 0x00007ffff7a271df in () at /usr/lib64/libpython3.6m.so.1.0 #5 0x00007ffff7a2fce0 in _PyFunction_FastCallDict () at /usr/lib64/libpython3.6m.so.1.0 #6 0x00007ffff79719fe in _PyObject_FastCallDict () at /usr/lib64/libpython3.6m.so.1.0 #7 0x00007ffff7971c0d in _PyObject_Call_Prepend () at /usr/lib64/libpython3.6m.so.1.0 #8 0x00007ffff79717c8 in PyObject_Call () at /usr/lib64/libpython3.6m.so.1.0 #9 0x00007ffff29f433d in () at /usr/lib64/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so #10 0x00007ffff3f73dcf in ffi_closure_unix64_inner () at /usr/lib64/libffi.so.6 #11 0x00007ffff3f74148 in ffi_closure_unix64 () at /usr/lib64/libffi.so.6 #12 0x00007fffde2abaf5 in () at /usr/lib64/libpulse.so.0 #13 0x00007fffddf27ce1 in () at /usr/lib64/pulseaudio/libpulsecommon-12.2.so #14 0x00007fffddf28033 in pa_pdispatch_run () at /usr/lib64/pulseaudio/libpulsecommon-12.2.so #15 0x00007fffde2aaa9e in () at /usr/lib64/libpulse.so.0 #16 0x00007fffddf2ab4f in () at /usr/lib64/pulseaudio/libpulsecommon-12.2.so #17 0x00007fffddf2d5db in () at /usr/lib64/pulseaudio/libpulsecommon-12.2.so #18 0x00007fffddf2d979 in () at /usr/lib64/pulseaudio/libpulsecommon-12.2.so #19 0x00007fffddf2e1df in () at /usr/lib64/pulseaudio/libpulsecommon-12.2.so #20 0x00007fffde2bea58 in pa_mainloop_dispatch () at /usr/lib64/libpulse.so.0 #21 0x00007fffde2bee1e in pa_mainloop_iterate () at /usr/lib64/libpulse.so.0 #22 0x00007fffde2beea0 in pa_mainloop_run () at /usr/lib64/libpulse.so.0 #23 0x00007fffde2cc786 in () at /usr/lib64/libpulse.so.0 #24 0x00007fffddf3db48 in () at /usr/lib64/pulseaudio/libpulsecommon-12.2.so #25 0x00007ffff76ed62e in () at /lib64/libpthread.so.0 #26 0x00007ffff7421def in clone () at /lib64/libc.so.6 (gdb) Seems to be a python bug not validating a data pointer. A similar bug was fixed here https://bugs.python.org/issue12149 reviewing the code https://github.com/python/cpython/blob/master/Objects/object.c I think line 981 mentioned in the bug description is now line 1235 f = descr->ob_type->tp_descr_get; Which now is protected inside an if (descr != NULL). So they fixed it here. Further just below that both 'f' and 'descr' are used like this if (f != NULL && PyDescr_IsData(descr)) { res = f(descr, obj, (PyObject *)obj->ob_type); The problem now seem to be further below (line 1279) where the code is if (f != NULL) { res = f(descr, obj, (PyObject *)Py_TYPE(obj)); The problem is that they forget to check that descr is valid. ---------- components: Interpreter Core messages: 330289 nosy: gilado priority: normal severity: normal status: open title: Segfault in _PyObject_GenericGetAttrWithDict type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 23 01:31:25 2018 From: report at bugs.python.org (Jorge Ramos) Date: Fri, 23 Nov 2018 06:31:25 +0000 Subject: [New-bugs-announce] [issue35299] LGHT0091: Duplicate symbol 'File:include_pyconfig.h' found Message-ID: <1542954685.4.0.788709270274.issue35299@psf.upfronthosting.co.za> New submission from Jorge Ramos : Build of Python 3.6.7 fails with error "LGHT0091: Duplicate symbol 'File:include_pyconfig.h' found" I am using Windows 10 64bit. Steps to reproduce this error: 1) Install Visual Studio 2017 (With the python development and native dev tools) (I have also installed NVIDIA CUDA Toolkit but I don't think this matters) 2) Download source code from Python to folder E:\RepoGit\3.6 (this is the download folder) 3) Open a command prompt, navigate to "E:\RepoGit" and run "PCBuild\build.bat -p x64" 4) Close the command prompt 5) Copy file pyconfig.h file from E:\RepoGit\3.6\PC and paste it to E:\RepoGit\3.6\include. Also, create an environment variable called "LIB" that contains the folder "E:\RepoGiT\3.6\PCbuild\amd64" (this folder was created at step 3) 6) Open a command prompt and run "Tools\msi\buildrelease.bat -x64" NOTE1: if step 5 is skipped, the overall build does not fail, but the PGInstrument x64 Interpreter fails in distutils with error "E:\RepoGiT\3.6\include\Python.h(8): fatal error C1083: Cannot open include file: 'pyconfig.h': No such file or directory", as shown in message https://bugs.python.org/msg329247 of issue https://bugs.python.org/issue35157 NOTE2: if pyconfig.h in step 5 is copied but the environment variable is not created, the PGInstrument x64 Interpreter fails in distutils with error "LINK : fatal error LNK1104: cannot open file 'python36.lib'", and the overall build fails with the same error shown in the title of this Issue. NOTE3: If all the steps are run, the PGInstrument x64 Interpreter succeeds in its tests but the overall build fails with the error shown in the title of this issue. All the verbose of this compilation is included in the file attached. ---------- components: Build, Windows files: LIBenRepogiT.txt messages: 330299 nosy: neyuru, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: LGHT0091: Duplicate symbol 'File:include_pyconfig.h' found type: compile error versions: Python 3.6 Added file: https://bugs.python.org/file47941/LIBenRepogiT.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 23 06:50:20 2018 From: report at bugs.python.org (bolorsociedad) Date: Fri, 23 Nov 2018 11:50:20 +0000 Subject: [New-bugs-announce] [issue35300] Bug with memoization and mutable objects Message-ID: <1542973820.71.0.788709270274.issue35300@psf.upfronthosting.co.za> Change by bolorsociedad : ---------- components: Library (Lib) nosy: bolorsociedad priority: normal severity: normal status: open title: Bug with memoization and mutable objects type: behavior versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 23 09:21:13 2018 From: report at bugs.python.org (Jonathan) Date: Fri, 23 Nov 2018 14:21:13 +0000 Subject: [New-bugs-announce] [issue35301] python.exe crashes - lzma? Message-ID: <1542982873.09.0.788709270274.issue35301@psf.upfronthosting.co.za> New submission from Jonathan : Python 3.6.3 on Windows 7 64 bit. I keep getting intermittent crashes of Python.exe with my project. The error is below and as best I can see seems to be indicating the issue with the LZMA module. All I'm doing is using it to compress web-pages (typically XML ones). Problem is, I can't replicate it. When I try and run the process again, the page that previously crashed it now works. I've had this happen three times so far (out of about 150,000 pages downloaded and compressed). My use of LZMA is quite simply: from lzma import compress compress(page_content, preset=5) The pages it has crashed on so far (but which work fine now): http://www.geoportal.rlp.de/mapbender/php/wms.php?inspire=1&layer_id=35833&request=GetCapabilities&service=WMS&version=1.3.0 https://maps.runnymede.gov.uk/geoserver/planning/lp_ancient_woodland/wms?request=GetCapabilities&service=WMS&version=1.3.0 http://serviziogc.regione.fvg.it/geoserver/GEOLOGIA/wms?request=GetCapabilities&service=WMS&version=1.3.0 I took a mini dump (attached) and full dump using Process Explorer. The full dump is 100MB compressed (1GB uncompressed). ---- Problem signature: Problem Event Name: APPCRASH Application Name: python.exe Application Version: 3.6.3150.1013 Application Timestamp: 59d3d3a3 Fault Module Name: _lzma.pyd Fault Module Version: 3.6.3150.1013 Fault Module Timestamp: 59d3d343 Exception Code: c0000005 Exception Offset: 000000000002e368 OS Version: 6.1.7601.2.1.0.768.3 Locale ID: 2057 Additional Information 1: d00b Additional Information 2: d00be1cd6ce69f4b081e66c649a14f90 Additional Information 3: 8c17 Additional Information 4: 8c17b9c4b6a39b7e31bf71b3b1374f1b ---------- files: python-mini.7z messages: 330327 nosy: jonathan-lp priority: normal severity: normal status: open title: python.exe crashes - lzma? type: crash versions: Python 3.6 Added file: https://bugs.python.org/file47944/python-mini.7z _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 23 13:30:53 2018 From: report at bugs.python.org (Neil Booth) Date: Fri, 23 Nov 2018 18:30:53 +0000 Subject: [New-bugs-announce] [issue35302] create_connection with local_addr misses valid socket bindings Message-ID: <1542997853.2.0.788709270274.issue35302@psf.upfronthosting.co.za> New submission from Neil Booth : I run a machine with IPv4 and IPv6 interfaces on MacOSX Mojave. I try to loop.create_connection() to a remote machine whose domain resolves to an IPv6 address only, with a local_addr domain name argument that resolves to two local addresses: an IPv4 one first and an IPv6 one second. The loop https://github.com/python/cpython/blob/master/Lib/asyncio/base_events.py#L927-L943 that loops through the local addresses, IPv4 then IPv6, successfully binds the IPv4 laddr_info to the IPv6 socket successfully (something I find surprising) and then the connection attempt fails with OSError(65, 'No route to host'), at which point the sockets is closed and the IPv6 laddr_info is never tried and the connection attempt fails. If I reverse the order of the loop so that the IPv6 laddr_info is tried first then the connection succeeds. I suggest either all laddr_info bindings should be tried for each outer loop of infos, rather than just 1, or that those of a different socket "type" (IPv4 vs IPv6) should be skipped in the inner loop before attempting a binding. ---------- components: asyncio messages: 330354 nosy: asvetlov, kyuupichan, yselivanov priority: normal severity: normal status: open title: create_connection with local_addr misses valid socket bindings type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 23 13:36:38 2018 From: report at bugs.python.org (Zackery Spytz) Date: Fri, 23 Nov 2018 18:36:38 +0000 Subject: [New-bugs-announce] [issue35303] A reference leak in _operator.c's methodcaller_repr() Message-ID: <1542998198.28.0.788709270274.issue35303@psf.upfronthosting.co.za> Change by Zackery Spytz : ---------- components: Extension Modules nosy: ZackerySpytz priority: normal severity: normal status: open title: A reference leak in _operator.c's methodcaller_repr() versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 23 14:35:08 2018 From: report at bugs.python.org (liugang) Date: Fri, 23 Nov 2018 19:35:08 +0000 Subject: [New-bugs-announce] [issue35304] The return of truncate(size=None) (file io) is unexpected Message-ID: <1543001708.41.0.788709270274.issue35304@psf.upfronthosting.co.za> New submission from liugang : -- run in Windows 10 1 - f = open('test', "w+") f.write('xxx\nyyy\nzzz') f.seek(0) f.readline() print(f.tell()) # output 5 (xxx\r\n) x = f.truncate() print(x) # output 13 (xxx\r\nyyy\r\nzzz), why it is 13, not 5? 2 - f = open('test', "w+") f.write('xxx\nyyy\nzzz') f.seek(0) f.readline() print(f.tell()) # output 5 (xxx\r\n) f.seek(f.tell()) x = f.truncate() print(x) # output 5 ---------- components: IO messages: 330357 nosy: liugang93 priority: normal severity: normal status: open title: The return of truncate(size=None) (file io) is unexpected type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 23 23:36:41 2018 From: report at bugs.python.org (Henrik Bengtsson) Date: Sat, 24 Nov 2018 04:36:41 +0000 Subject: [New-bugs-announce] [issue35305] subprocess.Popen(['/sbin/ldconfig', '-p'], stdin=PIPE) itself hangs/deadlocks (Linux) Message-ID: <1543034201.31.0.788709270274.issue35305@psf.upfronthosting.co.za> New submission from Henrik Bengtsson : (originally posted to https://mail.python.org/pipermail/python-list/2018-November/738209.html) I ran into an interesting problem where calling 'subprocess.Popen(['/sbin/ldconfig', '-p'], stdin=PIPE)' hangs and never returns. $ python Python 2.7.9 (default, Apr 23 2015, 22:07:47) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess >>> p = subprocess.Popen(['/sbin/ldconfig', '-p'], stdout=subprocess.PIPE) ^CTraceback (most recent call last): File "", line 1, in File "/opt/Python/Python-2.7.9/lib/python2.7/subprocess.py", line 710, in __init__ errread, errwrite) File "/opt/Python/Python-2.7.9/lib/python2.7/subprocess.py", line 1316, in _execute_child data = _eintr_retry_call(os.read, errpipe_read, 1048576) File "/opt/Python/Python-2.7.9/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call return func(*args) KeyboardInterrupt >>> Note how I have to send a user interrupt to break out of 'subprocess.Popen()'. TROUBLESHOOTING: First, it's interesting to note that the following works: >>> import subprocess >>> p = subprocess.Popen(['/sbin/ldconfig -p'], stdout=subprocess.PIPE, shell=True) >>> out,err = p.communicate() >>> len(out) 102460 >>> which I believe is the same as: >>> import subprocess >>> p = subprocess.Popen(['sh', '-c', '/sbin/ldconfig -p'], stdout=subprocess.PIPE) >>> out,err = p.communicate() >>> len(out) 102460 >>> which also works. Second, calling: >>> import subprocess >>> p = subprocess.Popen(['/sbin/ldconfig', '-p']) 1562 libs found in cache `/etc/ld.so.cache' libzmq.so.1 (libc6,x86-64) => /usr/lib64/libzmq.so.1 libz.so.1 (libc6,x86-64) => /lib64/libz.so.1 [ ... all 102,460 bytes of ldconfig -p output ...] ld-linux-x86-64.so.2 (libc6,x86-64) => /lib64/ld-linux-x86-64.so.2 >>> also works, so the PIPE is my main suspect. Finally, if I do: >>> import subprocess >>> p = subprocess.Popen(['/sbin/ldconfig', '-p'], stdout=subprocess.PIPE) [ manually pkill -INT ldconfig' ] >>> out,err = p.communicate() >>> len(out) 65536 >>> then I notice that it reads exactly 65,536=2^16 bytes (out of 102,460 bytes). I suspect this is related to the default buffer-size limit of pipes set by the Linux kernel. Using `strace` on the latter Python process, reveals: [...] open("/opt/Python/Python-2.7.9/lib/python2.7/lib-dynload/cStringIO.so", O_RDONLY) = 6 read(6, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\32\0\0\0\0\0\0"..., 832) = 832 fstat(6, {st_mode=S_IFREG|0755, st_size=49556, ...}) = 0 mmap(NULL, 2115000, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 6, 0) = 0x2ad3ca6e7000 mprotect(0x2ad3ca6eb000, 2093056, PROT_NONE) = 0 mmap(0x2ad3ca8ea000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 6, 0x3000) = 0x2ad3ca8ea000 close(6) = 0 close(5) = 0 close(4) = 0 getrlimit(RLIMIT_NOFILE, {rlim_cur=64*1024, rlim_max=64*1024}) = 0 close(3) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ad3ca8ec000 write(1, "1\n", 21) = 2 pipe([3, 4]) = 0 fcntl(3, F_GETFD) = 0 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 fcntl(4, F_GETFD) = 0 fcntl(4, F_SETFD, FD_CLOEXEC) = 0 pipe([5, 6]) = 0 fcntl(5, F_GETFD) = 0 fcntl(5, F_SETFD, FD_CLOEXEC) = 0 fcntl(6, F_GETFD) = 0 fcntl(6, F_SETFD, FD_CLOEXEC) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x2ad3c972adf0) = 239074 close(6) = 0 mmap(NULL, 1052672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ad3ca8ed000 read(5, and 'strace' on the stalled 'ldconfig' process reveals: $ strace -p $(pgrep ldconfig) Process 239074 attached - interrupt to quit write(1, "ibgconfmm-2.6.so.1 (libc6,x86-64"..., 4096 RH 6.6 0:- 1:-* 2:-- That latter 'write()' contains the bytes after position 65,536, i.e. bytes 65,537 and beyond (not shown, but verified after careful inspection). MY CONCLUSION: To me, this looks like a deadlock in Popen() itself - is that correct? SESSION INFORMATION: All of the above is with Python 2.7.9 (installed from EPEL), but I can also reproduce it with Python 2.7.15 installed from source. What is also useful to know, is that I'm observing this on a legacy RHEL 6 system *with a customized kernel* part of the Scyld ClusterWare (https://www.penguincomputing.com/products/software/scyld-clusterware/) that *cannot* be updated: $ uname -a Linux n6 2.6.32-504.12.2.el6.664g0000.x86_64 #1 SMP Wed Mar 11 14:20:51 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux I appreciate any suggestions to further troubleshoot this and ideally resolve it. The reason for this being an important issue is that 'find_library()' of ctypes.util performs the above stalling 'Popen(['/sbin/ldconfig', '-p'])' call that was introduced in Python (>= 2.7.13). This happens for instance whenever we try to create a new virtual environment using 'virtualenv'. In other words, the solution is *not* really to change the code to use, say, the shell=True approach. ---------- components: ctypes messages: 330370 nosy: Henrik Bengtsson priority: normal severity: normal status: open title: subprocess.Popen(['/sbin/ldconfig', '-p'], stdin=PIPE) itself hangs/deadlocks (Linux) versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 24 00:55:59 2018 From: report at bugs.python.org (jimbo1qaz_ via Gmail) Date: Sat, 24 Nov 2018 05:55:59 +0000 Subject: [New-bugs-announce] [issue35306] OSError [WinError 123] when testing if pathlib.Path('*') (asterisks) exists Message-ID: <1543038959.25.0.788709270274.issue35306@psf.upfronthosting.co.za> New submission from jimbo1qaz_ via Gmail : I'm writing a program taking paths from user input through CLI. `path` is a pathlib.Path(). Since Windows doesn't expand asterisks, I check if the path doesn't exist. If so I expand using Path().glob(path). Unfortunately on Windows, if `path` (type: Path) contains asterisks, checking `path.exists()` or `path.is_dir()` raises WinError 123. Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from pathlib import Path >>> Path('*').exists() Traceback (most recent call last): File "", line 1, in File "C:\Users\jimbo1qaz\Miniconda3\envs\python37\lib\pathlib.py", line 1318, in exists self.stat() File "C:\Users\jimbo1qaz\Miniconda3\envs\python37\lib\pathlib.py", line 1140, in stat return self._accessor.stat(self) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '*' >>> Path('*').is_dir() Traceback (most recent call last): File "", line 1, in File "C:\Users\jimbo1qaz\Miniconda3\envs\python37\lib\pathlib.py", line 1330, in is_dir return S_ISDIR(self.stat().st_mode) File "C:\Users\jimbo1qaz\Miniconda3\envs\python37\lib\pathlib.py", line 1140, in stat return self._accessor.stat(self) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '*' I also reproduced on Miniconda 3.6.6, 3.7.0, and official Python 3.7.1. According to https://bugs.python.org/issue29827 , os.path.exists() (not Path.exists() ) returns False on any OSError. ----------------- On Linux, checking paths with null bytes (a less common occurrence) raises a different error: >>> import pathlib >>> pathlib.Path("\x00").exists() Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.6/pathlib.py", line 1336, in exists self.stat() File "/usr/lib/python3.6/pathlib.py", line 1158, in stat return self._accessor.stat(self) File "/usr/lib/python3.6/pathlib.py", line 387, in wrapped return strfunc(str(pathobj), *args) ValueError: embedded null byte ---------- components: Library (Lib) messages: 330371 nosy: jimbo1qaz_ priority: normal severity: normal status: open title: OSError [WinError 123] when testing if pathlib.Path('*') (asterisks) exists versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 24 05:11:50 2018 From: report at bugs.python.org (HolgerFrey) Date: Sat, 24 Nov 2018 10:11:50 +0000 Subject: [New-bugs-announce] [issue35307] Command line help example is missing "--prompt" option Message-ID: <1543054310.5.0.788709270274.issue35307@psf.upfronthosting.co.za> New submission from HolgerFrey : In the documentation of the command line options of the "vent" module, the option "--prompt" is missing: Current text: > [...] > > The command, if run with -h, will show the available options: > > usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear] > [--upgrade] [--without-pip] > ENV_DIR [ENV_DIR ...] > > [...] The prompt option is also missing in the rest of the example output output of python3 -m venv -h: > python3 -m venv -h > usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear] > [--upgrade] [--without-pip] [--prompt PROMPT] > ENV_DIR [ENV_DIR ...] > [...] ---------- assignee: docs at python components: Documentation messages: 330376 nosy: daftwullie, docs at python priority: normal severity: normal status: open title: Command line help example is missing "--prompt" option type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 24 10:26:41 2018 From: report at bugs.python.org (Zhiming Wang) Date: Sat, 24 Nov 2018 15:26:41 +0000 Subject: [New-bugs-announce] [issue35308] webbrowser regression: BROWSER env var not respected Message-ID: <1543073201.72.0.788709270274.issue35308@psf.upfronthosting.co.za> New submission from Zhiming Wang : This is a regression in Python 3.7: $ BROWSER=w3m python3.6 -c 'import sys; import webbrowser; print(sys.version); print(webbrowser.get()); print(webbrowser._tryorder)' 3.6.7 (default, Nov 24 2018, 09:47:01) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] ['w3m', 'MacOSX', 'chrome', 'firefox', 'safari', 'w3m'] $ BROWSER=w3m python3.7 -c 'import sys; import webbrowser; print(sys.version); print(webbrowser.get()); print(webbrowser._tryorder)' 3.7.1 (default, Nov 24 2018, 09:35:18) [Clang 10.0.0 (clang-1000.11.45.5)] ['MacOSX', 'chrome', 'firefox', 'safari', 'w3m', 'w3m'] Note how Python 3.7.1 webbrowser decides to choose MacOSX as the default although BROWSER is explicitly set to w3m. (The above code does not run on Python 3.7.0 due to bpo-31014). This is because of misinterpretation of the `preferred` kwarg when bpo-31014 was fixed. See https://github.com/python/cpython/commit/25b804a9c21c735ce322877f105ebab2539ccfc1#diff-546766353a40839aa72374ecca5b0925R566. Browsers in BROWSER should be registered as `preferred=True` instead. ---------- components: Library (Lib) messages: 330377 nosy: zmwangx priority: normal severity: normal status: open title: webbrowser regression: BROWSER env var not respected type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 24 15:16:14 2018 From: report at bugs.python.org (Jakub Wilk) Date: Sat, 24 Nov 2018 20:16:14 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue35309=5D_Typo_in_urllib=2E?= =?utf-8?q?request_warning=3A_cpath_=E2=86=92_cpath?= Message-ID: <1543090574.86.0.788709270274.issue35309@psf.upfronthosting.co.za> New submission from Jakub Wilk : It should be "capath", not "cpath", in this warning: DeprecationWarning: cafile, cpath and cadefault are deprecated, use a custom context instead. ---------- components: Library (Lib) messages: 330379 nosy: jwilk priority: normal severity: normal status: open title: Typo in urllib.request warning: cpath ? cpath _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 25 08:19:06 2018 From: report at bugs.python.org (Brian Maissy) Date: Sun, 25 Nov 2018 13:19:06 +0000 Subject: [New-bugs-announce] [issue35310] select which was interrupted by EINTR isn't re-run if the timeout has passed Message-ID: <1543151946.49.0.788709270274.issue35310@psf.upfronthosting.co.za> New submission from Brian Maissy : If a call to select.select() was interrupted by a signal and the select syscall set an errno of EINTR, then under PEP 475 the select call should be re-executed. If, however, there is a signal handler which takes enough time that the select's timeout expires, select() is not retried, and the rlist is returned as-is (with fds in it which are not ready for reading). Under this condition, either select() should be re-run with a timeout of 0, or the fd lists should be emptied before returning. Example code which reproduces the problem attached. ---------- files: select_eintr.py messages: 330388 nosy: Brian Maissy priority: normal severity: normal status: open title: select which was interrupted by EINTR isn't re-run if the timeout has passed type: behavior versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47945/select_eintr.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 25 17:02:05 2018 From: report at bugs.python.org (Anthony Sottile) Date: Sun, 25 Nov 2018 22:02:05 +0000 Subject: [New-bugs-announce] [issue35311] exception unpickling error causes `multiprocessing.Pool` to hang forever Message-ID: <1543183325.55.0.788709270274.issue35311@psf.upfronthosting.co.za> New submission from Anthony Sottile : ``` import multiprocessing class E(Exception): def __init__(self, a1, a2): Exception.__init__(self, '{}{}'.format(a1, a2)) def f(_): raise E(1, 2) multiprocessing.Pool(1).map(f, (1,)) ``` Running this causes a hang: ``` $ python3.7 t2.py Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python3.7/multiprocessing/pool.py", line 496, in _handle_results task = get() File "/usr/lib/python3.7/multiprocessing/contrnection.py", line 251, in recv return _ForkingPickler.loads(buf.getbuffer()) TypeError: __init__() missing 1 required positional argument: 'a2' ``` Upon eventual `^C` ``` ^CTraceback (most recent call last): Process ForkPoolWorker-1: File "t2.py", line 10, in multiprocessing.Pool(1).map(f, (1,)) File "/usr/lib/python3.7/multiprocessing/pool.py", line 290, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/usr/lib/python3.7/multiprocessing/pool.py", line 677, in get self.wait(timeout) File "/usr/lib/python3.7/multiprocessing/pool.py", line 674, in wait Traceback (most recent call last): File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap self.run() File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python3.7/multiprocessing/pool.py", line 110, in worker task = get() File "/usr/lib/python3.7/multiprocessing/queues.py", line 352, in get res = self._reader.recv_bytes() File "/usr/lib/python3.7/multiprocessing/connection.py", line 216, in recv_bytes buf = self._recv_bytes(maxlength) File "/usr/lib/python3.7/multiprocessing/connection.py", line 407, in _recv_bytes buf = self._recv(4) File "/usr/lib/python3.7/multiprocessing/connection.py", line 379, in _recv chunk = read(handle, remaining) KeyboardInterrupt self._event.wait(timeout) File "/usr/lib/python3.7/threading.py", line 552, in wait signaled = self._cond.wait(timeout) File "/usr/lib/python3.7/threading.py", line 296, in wait waiter.acquire() KeyboardInterrupt Traceback (most recent call last): File "/usr/lib/python3.7/multiprocessing/util.py", line 265, in _run_finalizers finalizer() File "/usr/lib/python3.7/multiprocessing/util.py", line 189, in __call__ res = self._callback(*self._args, **self._kwargs) File "/usr/lib/python3.7/multiprocessing/pool.py", line 611, in _terminate_pool "Cannot have cache with result_hander not alive") AssertionError: Cannot have cache with result_hander not alive ``` (I've also tried this against master at 158695817d736df8b18682866033c87e46252309) ---------- components: Library (Lib) messages: 330397 nosy: Anthony Sottile priority: normal severity: normal status: open title: exception unpickling error causes `multiprocessing.Pool` to hang forever versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 25 23:03:58 2018 From: report at bugs.python.org (Anthony Sottile) Date: Mon, 26 Nov 2018 04:03:58 +0000 Subject: [New-bugs-announce] [issue35312] lib2to3.pgen2.parser.ParseError is not roundtrip pickleable Message-ID: <1543205038.25.0.788709270274.issue35312@psf.upfronthosting.co.za> New submission from Anthony Sottile : related to https://bugs.python.org/issue35311 encountered here: https://gitlab.com/pycqa/flake8/issues/473 minimal reproduction: class TestPickleableException(unittest.TestCase): def test_ParseError(self): err = ParseError('msg', 2, None, (1, 'context')) err2 = pickle.loads(pickle.dumps(err)) self.assertEqual(vars(err), vars(err2)) ====================================================================== ERROR: test_ParseError (lib2to3.tests.test_parser.TestPickleableException) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/asottile/workspace/cpython/Lib/lib2to3/tests/test_parser.py", line 628, in test_ParseError err2 = pickle.loads(pickle.dumps(err)) TypeError: __init__() missing 3 required positional arguments: 'type', 'value', and 'context' ---------- components: Library (Lib) messages: 330404 nosy: Anthony Sottile priority: normal severity: normal status: open title: lib2to3.pgen2.parser.ParseError is not roundtrip pickleable versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 02:41:08 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Mon, 26 Nov 2018 07:41:08 +0000 Subject: [New-bugs-announce] [issue35313] test_embed fails in travis CI when tests are executed from a virtual environment Message-ID: <1543218068.72.0.788709270274.issue35313@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : I noticed GCC related test always failing in Travis but it's optional and builds were always green. It's consistent and related to test_embed. It seems that the tests are ran from a virtual environment for GCC that causes some difference in the prefix for the new tests added in test_embed. With virtual environment prefix points to virtual environment path and not to /usr/local. Other tests are ran with built CPython and not with virtual environment hence tests pass. To reproduce this build CPython and activate a virtual environment to run test_embed under the virtual environment. I thought to file it anyway as reference and I don't know if the tests need to be fixed or Travis config. Sample failure in Travis : https://travis-ci.org/tirkarthi/cpython/builds/459615265 cpython git:(test_embed_travis) ./python.exe -m venv test_venv cpython git:(test_embed_travis) ./test_venv/bin/python -m test --fail-env-changed -v test.test_embed == CPython 3.8.0a0 (heads/master:f0e0f2008d, Nov 26 2018, 11:08:07) [Clang 7.0.2 (clang-700.1.81)] == Darwin-14.4.0-x86_64-i386-64bit little-endian == cwd: /Users/karthikeyansingaravelan/stuff/python/cpython/build/test_python_11655 == CPU count: 4 == encodings: locale=UTF-8, FS=utf-8 Run tests sequentially 0:00:00 load avg: 2.40 [1/1] test.test_embed test_bpo20891 (test.test_embed.EmbeddingTests) ... ok test_forced_io_encoding (test.test_embed.EmbeddingTests) ... ok test_initialize_pymain (test.test_embed.EmbeddingTests) ... ok test_initialize_twice (test.test_embed.EmbeddingTests) ... ok test_pre_initialization_api (test.test_embed.EmbeddingTests) ... ok test_pre_initialization_sys_options (test.test_embed.EmbeddingTests) ... ok test_subinterps_different_ids (test.test_embed.EmbeddingTests) ... ok test_subinterps_distinct_state (test.test_embed.EmbeddingTests) ... ok test_subinterps_main (test.test_embed.EmbeddingTests) ... ok test_init_default_config (test.test_embed.InitConfigTests) ... FAIL test_init_dev_mode (test.test_embed.InitConfigTests) ... FAIL test_init_env (test.test_embed.InitConfigTests) ... FAIL test_init_from_config (test.test_embed.InitConfigTests) ... FAIL test_init_global_config (test.test_embed.InitConfigTests) ... FAIL test_init_isolated (test.test_embed.InitConfigTests) ... FAIL ====================================================================== FAIL: test_init_default_config (test.test_embed.InitConfigTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 488, in test_init_default_config self.check_config("init_default_config", {}) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config self.check_core_config(config, expected, env) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config self.assertEqual(core_config, expected) AssertionError: {'ins[248 chars] 0, 'coerce_c_locale': 0, 'coerce_c_locale_war[722 chars]': 0} != {'ins[248 chars] 0, 'filesystem_encoding': 'utf-8', 'filesyste[824 chars]': 0} {'_check_hash_pycs_mode': 'default', '_frozen': 0, '_install_importlib': 1, 'allocator': None, 'argv': [], 'base_exec_prefix': '/usr/local', 'base_prefix': '/usr/local', 'buffered_stdio': 1, 'bytes_warning': 0, 'coerce_c_locale': 0, 'coerce_c_locale_warn': 0, 'dev_mode': 0, 'dump_refs': 0, - 'exec_prefix': '/usr/local', + 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'faulthandler': 0, 'filesystem_encoding': 'utf-8', 'filesystem_errors': 'surrogateescape', 'hash_seed': 0, 'home': None, 'import_time': 0, 'inspect': 0, 'install_signal_handlers': 1, 'interactive': 0, 'isolated': 0, 'malloc_stats': 0, 'module_search_path_env': None, 'optimization_level': 0, 'parser_debug': 0, - 'prefix': '/usr/local', + 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'program': None, 'program_name': './_testembed', 'pycache_prefix': None, 'quiet': 0, 'show_alloc_count': 0, 'show_ref_count': 0, 'site_import': 1, 'stdio_encoding': 'utf-8', 'stdio_errors': 'strict', 'tracemalloc': 0, 'use_environment': 1, 'use_hash_seed': 0, 'user_site_directory': 1, 'utf8_mode': 0, 'verbose': 0, 'warnoptions': [], 'write_bytecode': 1, 'xoptions': []} ====================================================================== FAIL: test_init_dev_mode (test.test_embed.InitConfigTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 586, in test_init_dev_mode self.check_config("init_dev_mode", config) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config self.check_core_config(config, expected, env) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config self.assertEqual(core_config, expected) AssertionError: {'ins[251 chars] 0, 'coerce_c_locale': 0, 'coerce_c_locale_war[722 chars]': 0} != {'ins[251 chars] 0, 'filesystem_encoding': 'utf-8', 'filesyste[824 chars]': 0} {'_check_hash_pycs_mode': 'default', '_frozen': 0, '_install_importlib': 1, 'allocator': 'debug', 'argv': [], 'base_exec_prefix': '/usr/local', 'base_prefix': '/usr/local', 'buffered_stdio': 1, 'bytes_warning': 0, 'coerce_c_locale': 0, 'coerce_c_locale_warn': 0, 'dev_mode': 1, 'dump_refs': 0, - 'exec_prefix': '/usr/local', + 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'faulthandler': 1, 'filesystem_encoding': 'utf-8', 'filesystem_errors': 'surrogateescape', 'hash_seed': 0, 'home': None, 'import_time': 0, 'inspect': 0, 'install_signal_handlers': 1, 'interactive': 0, 'isolated': 0, 'malloc_stats': 0, 'module_search_path_env': None, 'optimization_level': 0, 'parser_debug': 0, - 'prefix': '/usr/local', + 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'program': None, 'program_name': './_testembed', 'pycache_prefix': None, 'quiet': 0, 'show_alloc_count': 0, 'show_ref_count': 0, 'site_import': 1, 'stdio_encoding': 'utf-8', 'stdio_errors': 'strict', 'tracemalloc': 0, 'use_environment': 1, 'use_hash_seed': 0, 'user_site_directory': 1, 'utf8_mode': 0, 'verbose': 0, 'warnoptions': [], 'write_bytecode': 1, 'xoptions': []} ====================================================================== FAIL: test_init_env (test.test_embed.InitConfigTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 578, in test_init_env self.check_config("init_env", config) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config self.check_core_config(config, expected, env) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config self.assertEqual(core_config, expected) AssertionError: {'ins[259 chars] 1, 'coerce_c_locale': 0, 'coerce_c_locale_war[743 chars]': 0} != {'ins[259 chars] 1, 'filesystem_encoding': 'utf-8', 'filesyste[845 chars]': 0} {'_check_hash_pycs_mode': 'default', '_frozen': 0, '_install_importlib': 1, 'allocator': 'malloc_debug', 'argv': [], 'base_exec_prefix': '/usr/local', 'base_prefix': '/usr/local', 'buffered_stdio': 0, 'bytes_warning': 0, 'coerce_c_locale': 0, 'coerce_c_locale_warn': 0, 'dev_mode': 1, 'dump_refs': 0, - 'exec_prefix': '/usr/local', + 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'faulthandler': 1, 'filesystem_encoding': 'utf-8', 'filesystem_errors': 'surrogateescape', 'hash_seed': 42, 'home': None, 'import_time': 1, 'inspect': 1, 'install_signal_handlers': 1, 'interactive': 0, 'isolated': 0, 'malloc_stats': 1, 'module_search_path_env': None, 'optimization_level': 2, 'parser_debug': 0, - 'prefix': '/usr/local', + 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'program': None, 'program_name': './_testembed', 'pycache_prefix': 'env_pycache_prefix', 'quiet': 0, 'show_alloc_count': 0, 'show_ref_count': 0, 'site_import': 1, 'stdio_encoding': 'iso8859-1', 'stdio_errors': 'replace', 'tracemalloc': 2, 'use_environment': 1, 'use_hash_seed': 1, 'user_site_directory': 0, 'utf8_mode': 1, 'verbose': 1, 'warnoptions': [], 'write_bytecode': 0, 'xoptions': []} ====================================================================== FAIL: test_init_from_config (test.test_embed.InitConfigTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 553, in test_init_from_config self.check_config("init_from_config", config) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config self.check_core_config(config, expected, env) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config self.assertEqual(core_config, expected) AssertionError: {'ins[260 chars] 1, 'coerce_c_locale': 0, 'coerce_c_locale_war[859 chars]': 1} != {'ins[260 chars] 1, 'filesystem_encoding': 'utf-8', 'filesyste[961 chars]': 1} {'_check_hash_pycs_mode': 'always', '_frozen': 1, '_install_importlib': 1, 'allocator': 'malloc_debug', 'argv': ['-c', 'pass'], 'base_exec_prefix': '/usr/local', 'base_prefix': '/usr/local', 'buffered_stdio': 0, 'bytes_warning': 1, 'coerce_c_locale': 0, 'coerce_c_locale_warn': 0, 'dev_mode': 0, 'dump_refs': 0, - 'exec_prefix': '/usr/local', + 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'faulthandler': 1, 'filesystem_encoding': 'utf-8', 'filesystem_errors': 'surrogateescape', 'hash_seed': 123, 'home': None, 'import_time': 1, 'inspect': 1, 'install_signal_handlers': 0, 'interactive': 1, 'isolated': 0, 'malloc_stats': 1, 'module_search_path_env': None, 'optimization_level': 2, 'parser_debug': 0, - 'prefix': '/usr/local', + 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'program': 'conf_program', 'program_name': './conf_program_name', 'pycache_prefix': 'conf_pycache_prefix', 'quiet': 1, 'show_alloc_count': 1, 'show_ref_count': 1, 'site_import': 0, 'stdio_encoding': 'iso8859-1', 'stdio_errors': 'replace', 'tracemalloc': 2, 'use_environment': 1, 'use_hash_seed': 1, 'user_site_directory': 0, 'utf8_mode': 1, 'verbose': 1, 'warnoptions': ['default', 'error::ResourceWarning'], 'write_bytecode': 0, 'xoptions': ['core_xoption1=3', 'core_xoption2=', 'core_xoption3']} ====================================================================== FAIL: test_init_global_config (test.test_embed.InitConfigTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 511, in test_init_global_config self.check_config("init_global_config", config) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config self.check_core_config(config, expected, env) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config self.assertEqual(core_config, expected) AssertionError: {'ins[248 chars] 0, 'coerce_c_locale': 0, 'coerce_c_locale_war[730 chars]': 1} != {'ins[248 chars] 0, 'filesystem_encoding': 'utf-8', 'filesyste[832 chars]': 1} {'_check_hash_pycs_mode': 'default', '_frozen': 1, '_install_importlib': 1, 'allocator': None, 'argv': [], 'base_exec_prefix': '/usr/local', 'base_prefix': '/usr/local', 'buffered_stdio': 0, 'bytes_warning': 1, 'coerce_c_locale': 0, 'coerce_c_locale_warn': 0, 'dev_mode': 0, 'dump_refs': 0, - 'exec_prefix': '/usr/local', + 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'faulthandler': 0, 'filesystem_encoding': 'utf-8', 'filesystem_errors': 'surrogateescape', 'hash_seed': 0, 'home': None, 'import_time': 0, 'inspect': 1, 'install_signal_handlers': 1, 'interactive': 1, 'isolated': 0, 'malloc_stats': 0, 'module_search_path_env': None, 'optimization_level': 2, 'parser_debug': 0, - 'prefix': '/usr/local', + 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'program': None, 'program_name': './globalvar', 'pycache_prefix': None, 'quiet': 1, 'show_alloc_count': 0, 'show_ref_count': 0, 'site_import': 0, 'stdio_encoding': 'utf-8', 'stdio_errors': 'surrogateescape', 'tracemalloc': 0, 'use_environment': 1, 'use_hash_seed': 0, 'user_site_directory': 0, 'utf8_mode': 1, 'verbose': 1, 'warnoptions': [], 'write_bytecode': 0, 'xoptions': []} ====================================================================== FAIL: test_init_isolated (test.test_embed.InitConfigTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 594, in test_init_isolated self.check_config("init_isolated", config) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 483, in check_config self.check_core_config(config, expected, env) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_embed.py", line 450, in check_core_config self.assertEqual(core_config, expected) AssertionError: {'ins[248 chars] 0, 'coerce_c_locale': 0, 'coerce_c_locale_war[722 chars]': 0} != {'ins[248 chars] 0, 'filesystem_encoding': 'utf-8', 'filesyste[824 chars]': 0} {'_check_hash_pycs_mode': 'default', '_frozen': 0, '_install_importlib': 1, 'allocator': None, 'argv': [], 'base_exec_prefix': '/usr/local', 'base_prefix': '/usr/local', 'buffered_stdio': 1, 'bytes_warning': 0, 'coerce_c_locale': 0, 'coerce_c_locale_warn': 0, 'dev_mode': 0, 'dump_refs': 0, - 'exec_prefix': '/usr/local', + 'exec_prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'faulthandler': 0, 'filesystem_encoding': 'utf-8', 'filesystem_errors': 'surrogateescape', 'hash_seed': 0, 'home': None, 'import_time': 0, 'inspect': 0, 'install_signal_handlers': 1, 'interactive': 0, 'isolated': 1, 'malloc_stats': 0, 'module_search_path_env': None, 'optimization_level': 0, 'parser_debug': 0, - 'prefix': '/usr/local', + 'prefix': '/Users/karthikeyansingaravelan/stuff/python/cpython/test_venv', 'program': None, 'program_name': './_testembed', 'pycache_prefix': None, 'quiet': 0, 'show_alloc_count': 0, 'show_ref_count': 0, 'site_import': 1, 'stdio_encoding': 'utf-8', 'stdio_errors': 'strict', 'tracemalloc': 0, 'use_environment': 0, 'use_hash_seed': 0, 'user_site_directory': 0, 'utf8_mode': 0, 'verbose': 0, 'warnoptions': [], 'write_bytecode': 1, 'xoptions': []} ---------------------------------------------------------------------- Ran 15 tests in 11.761s FAILED (failures=6) test test.test_embed failed test.test_embed failed == Tests result: FAILURE == 1 test failed: test.test_embed Total duration: 11 sec 931 ms Tests result: FAILURE ---------- components: Tests messages: 330406 nosy: pablogsal, vstinner, xtreak priority: normal severity: normal status: open title: test_embed fails in travis CI when tests are executed from a virtual environment versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 05:58:12 2018 From: report at bugs.python.org (Cyker Way) Date: Mon, 26 Nov 2018 10:58:12 +0000 Subject: [New-bugs-announce] [issue35314] fnmatch failed with leading caret (^) Message-ID: <1543229892.22.0.788709270274.issue35314@psf.upfronthosting.co.za> New submission from Cyker Way : In short, `fnmatch.fnmatch` doesn't match shell result. To test this, create a dir with 2 files: `a.py` and `b.py`. Then `ls [!b].py` and `ls [^b].py` will both show `a.py`. However, `fnmatch.fnmatch('a.py', '[!b].py')` returns `True` but `fnmatch.fnmatch('a.py', '[^b].py')` returns `False`. Problem seems to come from an escaped caret: https://github.com/python/cpython/blob/master/Lib/fnmatch.py#L124 I don't see why caret and exclamation mark are different from `man bash`: > ...If the first character following the [ is a ! or a ^ then any character not enclosed is matched... Could someone please confirm it's a bug or intended behavior? ---------- components: Library (Lib) messages: 330417 nosy: cykerway priority: normal severity: normal status: open title: fnmatch failed with leading caret (^) versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 06:03:31 2018 From: report at bugs.python.org (Ruchi kumari) Date: Mon, 26 Nov 2018 11:03:31 +0000 Subject: [New-bugs-announce] [issue35315] Error (Segmentation fault - core dumped) while installing Python3.5.2 Message-ID: <1543230211.24.0.788709270274.issue35315@psf.upfronthosting.co.za> New submission from Ruchi kumari : Regularly getting segmentation fault (core dumped) while trying to install Python3.5.2. Also seeing the following warning while doing ./configure configure: WARNING: linux/random.h: present but cannot be compiled configure: WARNING: linux/random.h: check for missing prerequisite headers? configure: WARNING: linux/random.h: see the Autoconf documentation configure: WARNING: linux/random.h: section "Present But Cannot Be Compiled" configure: WARNING: linux/random.h: proceeding with the compiler's result ---------- messages: 330418 nosy: Ruchi kumari priority: normal severity: normal status: open title: Error (Segmentation fault - core dumped) while installing Python3.5.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 09:11:47 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 26 Nov 2018 14:11:47 +0000 Subject: [New-bugs-announce] [issue35316] test_eintr fails randomly on macOS Message-ID: <1543241507.8.0.788709270274.issue35316@psf.upfronthosting.co.za> New submission from STINNER Victor : test_sleep() of test_eintr fails on VSTS/macOS. select.select() sleeps 200 ms, the process is supposed to get a signal every 100 ms, but the test says that the signal handler was not called during the test. All tests pass, the issue seems to be specific to macOS. Maybe select() cannot be interrupted by SIGALRM on macOS? https://dev.azure.com/Python/cpython/_build/results?buildId=34604&view=logs 2018-11-26T12:51:16.6867210Z FAIL: test_sleep (__main__.TimeEINTRTest) 2018-11-26T12:51:16.6868140Z ---------------------------------------------------------------------- 2018-11-26T12:51:16.6868300Z Traceback (most recent call last): 2018-11-26T12:51:16.6868450Z File "/Users/vsts/agent/2.142.1/work/1/s/Lib/test/eintrdata/eintr_tester.py", line 73, in tearDown 2018-11-26T12:51:16.6868570Z self.assertGreater(self.signals, 0) 2018-11-26T12:51:16.6869080Z AssertionError: 0 not greater than 0 2018-11-26T12:49:29.9119300Z os.uname: posix.uname_result(sysname='Darwin', nodename='Mac-329.local', release='17.7.0', version='Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64', machine='x86_64') I added the check (which fails) last week, ensure that the signal handler has been called at least once: * bpo-35189 * commit aac1f81eef971876ba5b1673db9ce6620311c469 ---------- components: Tests, macOS messages: 330432 nosy: ned.deily, pablogsal, ronaldoussoren, vstinner priority: normal severity: normal status: open title: test_eintr fails randomly on macOS versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 09:53:28 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 26 Nov 2018 14:53:28 +0000 Subject: [New-bugs-announce] [issue35317] test_email: test_localtime_daylight_false_dst_true() fails depending on the timezone Message-ID: <1543244008.28.0.788709270274.issue35317@psf.upfronthosting.co.za> New submission from STINNER Victor : The two following tests fail on glibc-2.28.9000-19.fc30.x86_64 on Fedora Rawhide depending on the timezone. Australia/Lord_Howe: ok EDT4: fail EST+05EDT,M3.2.0,M11.1.0: ok Europe/Kiev: ok Europe/Minsk: ok MSK-03: fail MST+07MDT,M4.1.0,M10.5.0: ok STD-1DST,M3.2.0,M11.1.0: ok STD-1DST,M4.1.0,M10.1.0: ok UTC: fail sh-4.4# TZ=UTC ./python -m test test_email -m 'test_localtime_daylight_*' -v == CPython 3.7.1 (default, Nov 26 2018, 15:33:31) [GCC 8.2.1 20181105 (Red Hat 8.2.1-5)] == Linux-4.19.2-301.fc29.x86_64-x86_64-with-fedora-30-Rawhide little-endian == cwd: /builddir/Python-3.7.1/build/test_python_9582 == CPU count: 8 == encodings: locale=UTF-8, FS=utf-8 Run tests sequentially 0:00:00 load avg: 0.33 [1/1] test_email test_localtime_daylight_false_dst_false (test.test_email.test_utils.LocaltimeTests) ... ok test_localtime_daylight_false_dst_true (test.test_email.test_utils.LocaltimeTests) ... ERROR test_localtime_daylight_true_dst_false (test.test_email.test_utils.LocaltimeTests) ... ok test_localtime_daylight_true_dst_true (test.test_email.test_utils.LocaltimeTests) ... ERROR ====================================================================== ERROR: test_localtime_daylight_false_dst_true (test.test_email.test_utils.LocaltimeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/Python-3.7.1/Lib/test/test_email/test_utils.py", line 88, in test_localtime_daylight_false_dst_true t1 = utils.localtime(t0, isdst=1) File "/builddir/Python-3.7.1/Lib/email/utils.py", line 361, in localtime seconds = time.mktime(tm) OverflowError: mktime argument out of range ====================================================================== ERROR: test_localtime_daylight_true_dst_true (test.test_email.test_utils.LocaltimeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/Python-3.7.1/Lib/test/test_email/test_utils.py", line 81, in test_localtime_daylight_true_dst_true t1 = utils.localtime(t0, isdst=1) File "/builddir/Python-3.7.1/Lib/email/utils.py", line 361, in localtime seconds = time.mktime(tm) OverflowError: mktime argument out of range ---------------------------------------------------------------------- Ran 4 tests in 0.007s FAILED (errors=2) test test_email failed test_email failed == Tests result: FAILURE == 1 test failed: test_email Total duration: 259 ms Tests result: FAILURE sh-4.4# rpm -q glibc glibc-2.28.9000-19.fc30.x86_64 sh-4.4# cat /etc/fedora-release Fedora release 30 (Rawhide) sh-4.4# date lun. nov. 26 14:53:14 UTC 2018 ---------- components: Tests, email messages: 330435 nosy: barry, r.david.murray, vstinner priority: normal severity: normal status: open title: test_email: test_localtime_daylight_false_dst_true() fails depending on the timezone versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 13:49:06 2018 From: report at bugs.python.org (Raymond Hettinger) Date: Mon, 26 Nov 2018 18:49:06 +0000 Subject: [New-bugs-announce] [issue35318] Check accuracy of str() doc string for its encoding argument Message-ID: <1543258146.71.0.788709270274.issue35318@psf.upfronthosting.co.za> New submission from Raymond Hettinger : The "encoding" parameter is documented to default to sys.getdefaultencoding(). That may be true but there doesn't seem to be a way to use that default because objects will all have a __str__ or __repr__ that will be run instead. ------------------------------------------- >>> import sys >>> sys.getdefaultencoding() # Default encoding is utf-8 'utf-8' >>> buffer = b'lim x \xe2\x9f\xb6 \xe2\x88\x9e, 1/sin\xc2\xb2(x)' >>> str(buffer, 'utf-8') # Explicit argument decodes properly 'lim x ? ?, 1/sin?(x)' >>> str(buffer) # Despite the default, repr is shown "b'lim x \\xe2\\x9f\\xb6 \\xe2\\x88\\x9e, 1/sin\\xc2\\xb2(x)'" >>> print(str.__doc__) str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'. ---------- assignee: docs at python components: Documentation messages: 330454 nosy: docs at python, rhettinger priority: normal severity: normal status: open title: Check accuracy of str() doc string for its encoding argument versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 14:15:58 2018 From: report at bugs.python.org (Kevin Norris) Date: Mon, 26 Nov 2018 19:15:58 +0000 Subject: [New-bugs-announce] [issue35319] pkgutil.get_data() is a wrapper for a deprecated class Message-ID: <1543259758.29.0.788709270274.issue35319@psf.upfronthosting.co.za> New submission from Kevin Norris : pkgutil.get_data()'s documentation[1] says it is a wrapper for importlib.abc.ResourceLoader.get_data(), but the latter's documentation[2] says the whole class is deprecated since 3.7. Please either: A. Formally deprecate pkgutil.get_data() (and ideally provide a "nice" alternative wrapper, so that I don't have to muck about with importlib's endless heterarchy of opaque objects which return other opaque objects). B. Modify pkgutil.get_data() to use ResourceReader instead of ResourceLoader. C. (A) or (B) has already been done, just document it. [1]: https://docs.python.org/3/library/pkgutil.html#pkgutil.get_data [2]: https://docs.python.org/3.8/library/importlib.html#importlib.abc.ResourceLoader ---------- assignee: docs at python components: Documentation, Library (Lib) messages: 330456 nosy: Kevin.Norris, docs at python priority: normal severity: normal status: open title: pkgutil.get_data() is a wrapper for a deprecated class type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 18:00:16 2018 From: report at bugs.python.org (=?utf-8?b?R8Opcnk=?=) Date: Mon, 26 Nov 2018 23:00:16 +0000 Subject: [New-bugs-announce] [issue35320] Writable __spec__.has_location attribute Message-ID: <1543273216.1.0.788709270274.issue35320@psf.upfronthosting.co.za> New submission from G?ry : How to reproduce: Assign the __spec__.has_location attribute of any module. Observed result: __spec__.has_location is a writable. Expected result: __spec__.has_location should be read-only, as defined in PEP 451: https://www.python.org/dev/peps/pep-0451/#attributes ---------- components: Library (Lib) messages: 330474 nosy: barry, brett.cannon, docs at python, eric.snow, maggyero, mdk, ncoghlan priority: normal severity: normal status: open title: Writable __spec__.has_location attribute type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 18:19:31 2018 From: report at bugs.python.org (=?utf-8?b?R8Opcnk=?=) Date: Mon, 26 Nov 2018 23:19:31 +0000 Subject: [New-bugs-announce] [issue35321] None _frozen_importlib.__spec__.origin attribute Message-ID: <1543274371.24.0.788709270274.issue35321@psf.upfronthosting.co.za> New submission from G?ry : How to reproduce: In Python: > import _frozen_importlib > print(_frozen_importlib.__spec__.origin) Observed result: The __spec__.origin attribute of the _frozen_importlib module is None. Expected result: The __spec__.origin attribute of the _frozen_importlib module should be 'frozen', like it is already the case for the _frozen_importlib_external module and documented for all frozen modules in PEP 451: https://www.python.org/dev/peps/pep-0451/#origin ---------- components: Library (Lib) messages: 330479 nosy: barry, brett.cannon, docs at python, eric.snow, maggyero, mdk, ncoghlan priority: normal severity: normal status: open title: None _frozen_importlib.__spec__.origin attribute versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 19:20:52 2018 From: report at bugs.python.org (STINNER Victor) Date: Tue, 27 Nov 2018 00:20:52 +0000 Subject: [New-bugs-announce] [issue35322] test_datetime leaks memory Message-ID: <1543278052.7.0.788709270274.issue35322@psf.upfronthosting.co.za> New submission from STINNER Victor : test_datetime currently leaks memory blocks: test_datetime leaked [3, 4, 3] memory blocks, sum=10 Attached patch should be added to Lib/test/ to only run a minimum set of tests which reproduce the bug. ---------- files: datetimetester.py messages: 330482 nosy: vstinner priority: normal severity: normal status: open title: test_datetime leaks memory Added file: https://bugs.python.org/file47948/datetimetester.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 26 21:25:52 2018 From: report at bugs.python.org (liang feng) Date: Tue, 27 Nov 2018 02:25:52 +0000 Subject: [New-bugs-announce] [issue35323] Windows x86 executable installer can't install Message-ID: <1543285552.0.0.788709270274.issue35323@psf.upfronthosting.co.za> New submission from liang feng <15901111500 at 139.com>: see log ---------- files: Python 3.7.1 (32-bit)_20181127100820.log messages: 330486 nosy: outofthink priority: normal severity: normal status: open title: Windows x86 executable installer can't install versions: Python 3.7 Added file: https://bugs.python.org/file47950/Python 3.7.1 (32-bit)_20181127100820.log _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 27 01:38:41 2018 From: report at bugs.python.org (josephshi@yahoo.com) Date: Tue, 27 Nov 2018 06:38:41 +0000 Subject: [New-bugs-announce] [issue35324] ssl: FileNotFoundError when do handshake Message-ID: <1543300721.51.0.788709270274.issue35324@psf.upfronthosting.co.za> New submission from josephshi at yahoo.com : After upgrade my python from 3.6 to 3.7, one of my program got following error msgs and I suppose it is related to the 'ssl' module: Traceback (most recent call last): File "M:\SUPPOR~1\ONEDAY~1\ODD2\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen chunked=chunked) File "M:\SUPPOR~1\ONEDAY~1\ODD2\lib\site-packages\urllib3\connectionpool.py", line 343, in _make_request self._validate_conn(conn) File "M:\SUPPOR~1\ONEDAY~1\ODD2\lib\site-packages\urllib3\connectionpool.py", line 839, in _validate_conn conn.connect() File "M:\SUPPOR~1\ONEDAY~1\ODD2\lib\site-packages\urllib3\connection.py", line 344, in connect ssl_context=context) File "M:\SUPPOR~1\ONEDAY~1\ODD2\lib\site-packages\urllib3\util\ssl_.py", line 357, in ssl_wrap_socket return context.wrap_socket(sock) File "f:\Anaconda3\Lib\ssl.py", line 412, in wrap_socket session=session File "f:\Anaconda3\Lib\ssl.py", line 853, in _create self.do_handshake() File "f:\Anaconda3\Lib\ssl.py", line 1117, in do_handshake self._sslobj.do_handshake() FileNotFoundError: [Errno 2] No such file or directory The background is, the program works all fine under python 3.6. I actually use the 'requests' lib which use the 'urllib3' inside. I don't know how to fix this so I just report here. I hope some one can help. ---------- assignee: christian.heimes components: SSL messages: 330491 nosy: christian.heimes, josephshi at yahoo.com priority: normal severity: normal status: open title: ssl: FileNotFoundError when do handshake type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 27 02:27:04 2018 From: report at bugs.python.org (Stefan Bauer (TraceTronic)) Date: Tue, 27 Nov 2018 07:27:04 +0000 Subject: [New-bugs-announce] [issue35325] imp.find_module() return value documentation discrepancy Message-ID: <1543303624.81.0.788709270274.issue35325@psf.upfronthosting.co.za> New submission from Stefan Bauer (TraceTronic) : I?d like to report a discrepancy between the documentation and implementation of the method imp.find_module(). The documentation currently says ?If the module does not live in a file, the returned file is None, pathname is the __empty_string__, [?]? The implementation , on the other hand, returns __None__ for built-in and frozen modules. Yours, Stefan ---------- assignee: docs at python components: Documentation messages: 330495 nosy: StefanBauerTT, docs at python priority: normal severity: normal status: open title: imp.find_module() return value documentation discrepancy versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 27 06:00:03 2018 From: report at bugs.python.org (Mordechai Botrashvily) Date: Tue, 27 Nov 2018 11:00:03 +0000 Subject: [New-bugs-announce] [issue35326] ctypes cast and from_address cause crash on Windows 10 Message-ID: <1543316403.16.0.788709270274.issue35326@psf.upfronthosting.co.za> New submission from Mordechai Botrashvily : Hi, Using cast() or from_address() to convert from c_void_p (or integer) address to POINTER(c_ubyte) causes the interpreter to crash, when accessing the contents of the array. The problem seems to happen when running the following combination: Windows 10 @ 64 bit, version 1803 (OS build 17134.407) and python 3 64 bit, starting with 3.5 until 3.7 (the last that was tested). The following code works fine on the same system using python 2.7.15 or python 3 until 3.4 (inclusive), 64 bit. In addition, it works well also under Windows 7 64 bit and python 3.5/3.6/3.7 etc. How to reproduce? ``` from ctypes import wintypes, windll, c_void_p, c_size_t, POINTER, c_ubyte, cast # Define constants. FILE_MAP_ALL_ACCESS = 983071 PAGE_READWRITE = 4 # Configure function arguments. windll.kernel32.CreateFileMappingA.argtypes = [wintypes.HANDLE, c_void_p, wintypes.DWORD, wintypes.DWORD, wintypes.DWORD, wintypes.LPCSTR] windll.kernel32.CreateFileMappingA.restype = wintypes.HANDLE windll.kernel32.MapViewOfFile.argtypes = [wintypes.HANDLE, wintypes.DWORD, wintypes.DWORD, wintypes.DWORD, c_size_t] windll.kernel32.MapViewOfFile.restypes = wintypes.LPVOID # Open shared-memory. handle = windll.kernel32.CreateFileMappingA(-1, None, PAGE_READWRITE, 0, 1024 * 1024, b'TestSHMEM') # Obtain pointer to SHMEM buffer. ptr = windll.kernel32.MapViewOfFile(handle, FILE_MAP_ALL_ACCESS, 0, 0, 1024 * 1024) arr = cast(ptr, POINTER(c_ubyte)) # or #arr = POINTER(c_ubyte).from_address(ptr) arr[0] # now crashes ``` Also note that changing the return type of MapViewOfFile as follows: windll.kernel32.MapViewOfFile.restypes = wintypes.LPVOID is changed to: windll.kernel32.MapViewOfFile.restypes = POINTER(c_ubyte) The contents of the buffer can be directly accessed without a problem. Just in case I'm not using it properly with new python releases? Thanks! Moti. ---------- components: ctypes files: test_ctypes_shmem.py messages: 330503 nosy: Mordechai Botrashvily priority: normal severity: normal status: open title: ctypes cast and from_address cause crash on Windows 10 type: crash versions: Python 3.5, Python 3.6, Python 3.7 Added file: https://bugs.python.org/file47951/test_ctypes_shmem.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 27 10:24:28 2018 From: report at bugs.python.org (Paul Ganssle) Date: Tue, 27 Nov 2018 15:24:28 +0000 Subject: [New-bugs-announce] [issue35327] Using skipTest with subTest gives a misleading UI. Message-ID: <1543332268.01.0.788709270274.issue35327@psf.upfronthosting.co.za> New submission from Paul Ganssle : It seems that if you call skipTest *anywhere* in a test function, even in a subTest, the *entire* function gets marked as "skipped", even if only one sub-test is skipped. Example: import unittest class SomeTest(unittest.TestCase): def test_something(self): for i in range(1, 3): with self.subTest(i): if i > 1: self.skipTest('Not supported') self.assertEqual(i, 1) If you run `python3.7 -m unittest -v` on this, you get: $ python -m unittest -v test_something (test_mod.SomeTest) ... skipped 'Not supported' ---------------------------------------------------------------------- Ran 1 test in 0.000s OK (skipped=1) Despite the fact that the test *was* run in the `i == 1` case. Similarly, pytest marks this as a single skipped test: ========= test session starts ======= platform linux -- Python 3.7.1, pytest-4.0.1, py-1.7.0, pluggy-0.8.0 rootdir: /tmp/test_mod, inifile: collected 1 item test_mod.py s [100%] ===== 1 skipped in 0.00 seconds ===== The solution to this is not obvious, unfortunately. One way to solve it would be to have each subtest considered a "separate test". Another would be to detect whether subTests have been skipped and expose only the *skipped* tests as separate tests. You could also add a "partially skipped" marker, so to say, "Some parts of this were skipped" I suspect the right answer is some combination of these three answers - possibly adding an extra-verbose mode that splits out all sub tests and having skipped subTests default to being displayed separately. Somewhat related to issue #30997. ---------- components: Tests messages: 330527 nosy: ezio.melotti, michael.foord, p-ganssle, rbcollins priority: normal severity: normal status: open title: Using skipTest with subTest gives a misleading UI. versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 27 11:12:29 2018 From: report at bugs.python.org (Baptiste Darthenay) Date: Tue, 27 Nov 2018 16:12:29 +0000 Subject: [New-bugs-announce] [issue35328] Set a environment variable for venv prompt Message-ID: <1543335149.71.0.788709270274.issue35328@psf.upfronthosting.co.za> New submission from Baptiste Darthenay : When creating a new virtual env with `python3 -m venv .venv --prompt env`, the prompt information is only used to set a temporary PS1. This information is lost when using custom prompt, for example with ZSH. I propose to set VIRTUAL_ENV_PROMPT=__VENV_PROMPT__ when activating the newly created venv, to be used by tools and other shells. ---------- messages: 330533 nosy: batisteo priority: normal severity: normal status: open title: Set a environment variable for venv prompt versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 27 11:43:56 2018 From: report at bugs.python.org (Hans Strijker) Date: Tue, 27 Nov 2018 16:43:56 +0000 Subject: [New-bugs-announce] [issue35329] Documentation - capitalization issue Message-ID: <1543337036.72.0.788709270274.issue35329@psf.upfronthosting.co.za> New submission from Hans Strijker : In the documentation I noticed "from Package import specific_submodule". I recon package should be all lowercase in accordance with pep8. (https://www.python.org/dev/peps/pep-0008/#package-and-module-names) It may be far from the most important bug ever, but it's my first bug reported, and gotta start small... :-) https://docs.python.org/3/tutorial/modules.html#importing-from-a-package 6.4.1. Importing * From a Package ... Remember, there is nothing wrong with using from Package import specific_submodule! In fact, this is the recommended notation unless the importing module needs to use submodules with the same name from different packages. ---------- assignee: docs at python components: Documentation messages: 330537 nosy: Strijker, docs at python priority: normal severity: normal status: open title: Documentation - capitalization issue versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 27 12:26:39 2018 From: report at bugs.python.org (Noam Yorav-Raphael) Date: Tue, 27 Nov 2018 17:26:39 +0000 Subject: [New-bugs-announce] [issue35330] When using mock to wrap an existing object, side_effect requires return_value Message-ID: <1543339599.43.0.788709270274.issue35330@psf.upfronthosting.co.za> New submission from Noam Yorav-Raphael : When using mock to wrap an existing object, and using side_effect to set a function to wrap a method, I would expect the wrapper function to be called instead of the wrapped function, and its return value to be returned. Instead, both the wrapper function and the wrapped functions are being called, and the return value of the wrapped function is returned. If, in addition to side_effect, return_value is set, the return_value is ignored, but my expected behavior actually happens: only the wrapper function is called, and its return value is returned. Python 3.7.0 (default, Aug 22 2018, 20:50:05) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from unittest import mock >>> class MyClass(object): ... def func(self): ... print('func called') ... return 1 ... >>> c = MyClass() >>> m = mock.Mock(wraps=c) >>> def func2(): ... print('func2 called') ... return 2 ... >>> m.func.side_effect = func2 >>> m.func() func2 called func called 1 >>> m.func.return_value = 3 >>> m.func() func2 called 2 ---------- components: Library (Lib) messages: 330540 nosy: noamraph priority: normal severity: normal status: open title: When using mock to wrap an existing object, side_effect requires return_value type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 27 13:22:25 2018 From: report at bugs.python.org (Dan Snider) Date: Tue, 27 Nov 2018 18:22:25 +0000 Subject: [New-bugs-announce] [issue35331] Incorrect __module__ attribute for _struct.Struct and perhaps a few others Message-ID: <1543342945.38.0.788709270274.issue35331@psf.upfronthosting.co.za> New submission from Dan Snider : _struct.Struct not defining a valid __module__ by prefixing its tp_name slot with "_struct" is inconsistent with every other extension type which is available in the corresponding module globals. >From the documentation of the `tp_name` slot: Pointer to a NUL-terminated string containing the name of the type. For types that are accessible as module globals, the string should be the full module name, followed by a dot, followed by the type name; for built-in types, it should be just the type name. If the module is a submodule of a package, the full package name is part of the full module name. For example, a type named T defined in module M in subpackage Q in package P should have the tp_name initializer "P.Q.M.T". For dynamically allocated type objects, this should just be the type name, and the module name explicitly stored in the type dict as the value for key '__module__'. ---- I know that this is also a way to make something unpickleable, but that seems like a poor way to do it and since _struct.Struct was relatively alone in this, I figured it was an oversight. At the end is the script I made to display all currently alive "builtins" classes that have been "PyType_Ready"ed. For brevity I further manually filtered out obvious cases where a specified module would be inappropriate. The main point is that I think the new contextvars classes, _struct.Struct, and the weakref classes are missing the "_struct", "_contextvars", and "_weakref" prefixes in their tp_name slots, respectively. Since _contextvars is one of the few extension modules using the multiphase initialization protocol, maybe it should go in their type dicts (although the prefix method still works) instead, although i think the docs were referring to heap allocated types. if __name__=='__main__': import sys, collections subclassesof = type.__subclasses__ def get_types(*names): r = {"__builtins__":{'__import__':__import__, 'globals':globals}} for name in names: exec(f'from {name} import __dict__ as d; globals().update(d)', r) return dict.fromkeys(r[k] for k in r if isinstance(r[k],type)).keys() def derivative_classes(cls): a = b = r = {*subclassesof(cls)} while b: r, a, b, = r|b, b, set().union(*map(subclassesof, b)) return r | a classes = derivative_classes(object) singles = None, NotImplemented, ... od = collections.OrderedDict() odtypes = iter(od), od.keys(), od.items(), od.values() bltns = {cls for cls in classes if cls.__module__=='builtins'} bltns-= get_types('builtins', 'types', '_collections_abc') bltns-= {*map(type, odtypes)} | {*map(type, singles)} for cls in sorted(bltns, key=vars(type)['__name__'].__get__): print(f'# {sys.getrefcount(cls):4} {cls.__name__}') # all of these are in _contextvars.__dict__ but have their __module__=='builtins': # 25 Context # 15 ContextVar # 12 Token # from _struct # 23 Struct # IS in _struct.__dict__ # 11 unpack_iterator # no tp_new so make sense to leave as-is # These are here because it's a mystery how they were included in the results # without importing _testcapi: # 25 hamt # 8 hamt_array_node # 8 hamt_bitmap_node # 8 hamt_collision_node # no idea what these are: # 11 items # 11 values # 11 keys # these are all in _weakref.__dict__ # 76 weakcallableproxy # 76 weakproxy # 32 weakref ---------- messages: 330544 nosy: bup priority: normal severity: normal status: open title: Incorrect __module__ attribute for _struct.Struct and perhaps a few others versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 27 14:51:53 2018 From: report at bugs.python.org (Ronal Abraham) Date: Tue, 27 Nov 2018 19:51:53 +0000 Subject: [New-bugs-announce] [issue35332] shutil.rmtree(..., ignore_errors=True) doesn't ignore errors from os.close() Message-ID: <1543348313.91.0.788709270274.issue35332@psf.upfronthosting.co.za> New submission from Ronal Abraham : These lines throw intermittently for me on AIX when removing a directory on NFS (python version 3.6.6-1), even when "ignore_errors=True": https://github.com/python/cpython/blob/v3.6.6rc1/Lib/shutil.py#L433 https://github.com/python/cpython/blob/v3.6.6rc1/Lib/shutil.py#L492 Should there be try-except blocks around these lines and calls to onerror(...)? ---------- components: Library (Lib) messages: 330553 nosy: rabraham priority: normal severity: normal status: open title: shutil.rmtree(..., ignore_errors=True) doesn't ignore errors from os.close() type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 27 19:12:34 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 28 Nov 2018 00:12:34 +0000 Subject: [New-bugs-announce] [issue35333] Rename private structs to use names closer to types Message-ID: <1543363954.23.0.788709270274.issue35333@psf.upfronthosting.co.za> New submission from STINNER Victor : To prevent a compiler warning/error (on clang), I had modify Include/object.h and Include/pystate.h: * Replace "PyTypeObject" with "struct _typeobject" * Replace "PyInterpreterState" with "struct _is" * Replace "PyThreadState" with "struct _ts" => see commit 9bdd2de84c1af55fbc006d3f892313623bd0195c of bpo-35134. I propose to rename "struct _ts" to "struct PyThreadState" or "struct _PyThreadState", and do a similar change for "struct _ts" and "struct _typeobject". My intent is to make the Include/object.h and Include/pystate.h less surprising. Maybe "struct _frame" should also be renamed to "struct _PyFrameObject"? -- Python header files use many "private" C structures (struct): struct _addr_pair struct _arena PyArena struct _ceval_runtime_state struct _dictkeysobject struct _err_stackitem struct _frame struct _gc_runtime_state struct _gil_runtime_state gil struct _heaptypeobject struct _is struct _longobject struct _object struct _odictobject PyODictObject struct _pending_calls struct _pycontextobject struct _pycontexttokenobject struct _pycontextvarobject struct _symtable_entry struct _traceback struct _ts struct _typeobject struct _warnings_runtime_state struct _xid struct _xidregitem The following structures are documented: * struct _frozen: https://docs.python.org/dev/c-api/import.html#c._frozen * struct _inittab: https://docs.python.org/dev/c-api/import.html#c._inittab * struct _node: https://docs.python.org/dev/c-api/veryhigh.html#c.PyParser_SimpleParseString ---------- components: Interpreter Core messages: 330564 nosy: vstinner priority: normal severity: normal status: open title: Rename private structs to use names closer to types versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 01:53:30 2018 From: report at bugs.python.org (Arno-Can Uestuensoez) Date: Wed, 28 Nov 2018 06:53:30 +0000 Subject: [New-bugs-announce] [issue35334] urllib3 fails with type error exception, when cannot reach PyPI - urllib3.util.retry Message-ID: <1543388010.85.0.788709270274.issue35334@psf.upfronthosting.co.za> New submission from Arno-Can Uestuensoez : Hi, I am using the installation script *adafruit-pitft.sh* which tries to apply *urllib3* which itself tries to install nested dependencies, here *evdev* from PyPI. When the installation is offline - e.g. by internal mirror of debian/raspbian - PyPI is not accessible. The code fails than by an type error exception: > adafruit-pitft.sh # or pitft.sh > https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/blob/master/adafruit-pitft.sh > > ... > > _stacktrace=sys.exc_info()[2]) > File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3 none-any.whl/urllib3/util/retry.py", line 228, in increment > > total -= 1 > > TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' For the current distribution(based on debian-9.6.0/stretch): > File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment > > total -= 1 > > TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' See also: https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry The following - dirty *:) - patch enables a sounding error trace: # File: retry.py - in *def increment(self, ..* about line 315 # original: total = self.total # patch: quick-and-dirty-fix # START: if isinstance(self.total, Retry): self.total = self.total.total if type(self.total) is not int: self.total = 2 # default is 10 # END: # continue with original: total = self.total if total is not None: total -= 1 connect = self.connect read = self.read redirect = self.redirect cause = 'unknown' status = None redirect_location = None if error and self._is_connection_error(error): # Connect retry? if connect is False: raise six.reraise(type(error), error, _stacktrace) elif connect is not None: connect -= 1 The sounding output with the temporary patch is(twice...): > Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at/ > > Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at/ > > Could not find a version that satisfies the requirement evdev (from versions: ) > > No matching distribution found for evdev > > WARNING : Pip failed to install software! In this case I did not thoroughly analysed the actual error source, thus did a quick and dirty patch only. My proposal is to add the inplace operator to the class *Reply* with the default assignment in case of an type error and display an error message. This is still not really the correct solution, but resolves a lot of confusion by required interpretation of the exception. Arno-Can Uestuensoez ---------- components: Library (Lib) messages: 330574 nosy: Quentin.Pradet, acue, deivid, martin.panter priority: normal severity: normal status: open title: urllib3 fails with type error exception, when cannot reach PyPI - urllib3.util.retry type: crash versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 02:26:19 2018 From: report at bugs.python.org (s-ball) Date: Wed, 28 Nov 2018 07:26:19 +0000 Subject: [New-bugs-announce] [issue35335] msgfmt should be able to merge more than one po file Message-ID: <1543389979.14.0.788709270274.issue35335@psf.upfronthosting.co.za> New submission from s-ball : GNU gettext msgfmt can merge several po files into one single mo file. The current version of msgfmt can only compile one po file to one mo file. After looking at the code, the enhancement should be simple to implement. Command line: if one output file is given (option -o) and several input files, then all the input files should be combined. Implementation: - main should pass all the parameters to make (*args) - make should accept one single string for compatibility or an iterable of string. In that latter case, the current processing should be repeated on all input files. I could propose a patch (but I am afraid it ends being rather large) or a pull request. As a new user here, I do not know what is the best way... ---------- components: Demos and Tools messages: 330575 nosy: s-ball priority: normal severity: normal status: open title: msgfmt should be able to merge more than one po file type: enhancement versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 05:42:16 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 28 Nov 2018 10:42:16 +0000 Subject: [New-bugs-announce] [issue35336] Bug in C locale coercion with PYTHONCOERCECLOCALE=1 Message-ID: <1543401736.44.0.788709270274.issue35336@psf.upfronthosting.co.za> New submission from STINNER Victor : PYTHONCOERCECLOCALE=1 should not force C locale coercion, Python should still check if the LC_CTYPE locale is "C". Bug: $ ./python -c 'import locale; print(locale.setlocale(locale.LC_CTYPE, None))' fr_FR.UTF-8 $ PYTHONCOERCECLOCALE=1 ./python -c 'import locale; print(locale.setlocale(locale.LC_CTYPE, None))' C.UTF-8 It should be fr_FR.UTF-8 as well in the second example :-( It seems to be a regression that I introduced in the middle of my refactoring on the Python initialization. The bug is around: static void config_init_locale(_PyCoreConfig *config) { if (config->coerce_c_locale < 0) { /* The C locale enables the C locale coercion (PEP 538) */ if (_Py_LegacyLocaleDetected()) { config->coerce_c_locale = 1; } } ... } The 3.7 branch and the 3.7.0 release are affected :-( $ ./python -V Python 3.7.0 $ PYTHONCOERCECLOCALE=1 ./python -c 'import locale; print(locale.setlocale(locale.LC_CTYPE, None))' C.UTF-8 ---------- components: Interpreter Core messages: 330590 nosy: vstinner priority: normal severity: normal status: open title: Bug in C locale coercion with PYTHONCOERCECLOCALE=1 versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 08:17:08 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 28 Nov 2018 13:17:08 +0000 Subject: [New-bugs-announce] [issue35337] Check index in PyTuple_GET_ITEM/PyTuple_SET_ITEM in debug mode Message-ID: <1543411028.15.0.788709270274.issue35337@psf.upfronthosting.co.za> New submission from STINNER Victor : I propose to add assertions to PyTuple_GET_ITEM/PyTuple_SET_ITEM in debug mode to check the index when Python is compiled in debug mode (./configure --with-pydebug). This change is backward incompatible when PyTuple_GET_ITEM/PyTuple_SET_ITEM is used on a structseq with unnamed fields. Well, that's a bug in the user code, PyStructSequence_GET_ITEM/PyStructSequence_SET_ITEM should be used instead. ---------- components: Interpreter Core messages: 330597 nosy: vstinner priority: normal severity: normal status: open title: Check index in PyTuple_GET_ITEM/PyTuple_SET_ITEM in debug mode versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 09:50:55 2018 From: report at bugs.python.org (David Miguel Susano Pinto) Date: Wed, 28 Nov 2018 14:50:55 +0000 Subject: [New-bugs-announce] [issue35338] set union/intersection/difference could accept zero arguments Message-ID: <1543416655.98.0.788709270274.issue35338@psf.upfronthosting.co.za> New submission from David Miguel Susano Pinto : set union, intersection, difference methods accept any non-zero number of sets and return a new set instance, like so: >>> a = set([1, 2]) >>> b = set([1, 3]) >>> c = set([3, 5]) >>> set.union(a, b, c) {1, 2, 3, 5} even if it's only one argument: >>> set.union(a) {1, 2} I think it would be nice if zero arguments were not an error: >>> set.union() Traceback (most recent call last): File "", line 1, in TypeError: descriptor 'union' of 'set' object needs an argument This would allow to handle any sequence of sets which otherwise requires this: if len(sequence): return set.union(*sequence) else: return set() ---------- messages: 330601 nosy: carandraug priority: normal severity: normal status: open title: set union/intersection/difference could accept zero arguments type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 12:05:42 2018 From: report at bugs.python.org (Daugeras) Date: Wed, 28 Nov 2018 17:05:42 +0000 Subject: [New-bugs-announce] [issue35339] Populating instances of class automatically Message-ID: <1543424742.68.0.788709270274.issue35339@psf.upfronthosting.co.za> New submission from Daugeras : Hello, I am not sure it is a bug, but it is a very strange behavior of Python, which I do not understand. I created a class (mainly a structure) and instantiated an object of this class in a first function (Object 1). The function populates Object 1. In another function, I instantiate another object of the same class (Object 2) , and Object 2 is automatically populated with the data of Object 1. Note than Object 1 and Object 2 have different memory adresses. This behavior is very strange. Is it normal for Python or is it a Bug ? ---------- messages: 330613 nosy: Daugeras priority: normal severity: normal status: open title: Populating instances of class automatically type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 12:17:11 2018 From: report at bugs.python.org (Matthias Klose) Date: Wed, 28 Nov 2018 17:17:11 +0000 Subject: [New-bugs-announce] [issue35340] global symbol "freegrammar" should be made static ore renamed Message-ID: <1543425431.95.0.788709270274.issue35340@psf.upfronthosting.co.za> New submission from Matthias Klose : seen at least on the 2.7, a new symbol polluting the symbol namespace. the global symbol "freegrammar" should be made static ore renamed ---------- components: Interpreter Core messages: 330615 nosy: doko priority: normal severity: normal status: open title: global symbol "freegrammar" should be made static ore renamed versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 12:17:38 2018 From: report at bugs.python.org (Ismo Toijala) Date: Wed, 28 Nov 2018 17:17:38 +0000 Subject: [New-bugs-announce] [issue35341] Add generic version of OrderedDict to typing module Message-ID: <1543425458.24.0.788709270274.issue35341@psf.upfronthosting.co.za> New submission from Ismo Toijala : The other collections from the collections module (namedtuple, deque, ChainMap, Counter, defaultdict) have generic versions in the typing module for use in type annotations. The problem is currently the following: from __future__ import annotations import typing from collections import OrderedDict # Understood by mypy def f(d: OrderedDict[str, str]) -> None: pass typing.get_type_hints(f) gives: Traceback (most recent call last): File "foo.py", line 9, in typing.get_type_hints(f) File "/usr/lib/python3.7/typing.py", line 1001, in get_type_hints value = _eval_type(value, globalns, localns) File "/usr/lib/python3.7/typing.py", line 260, in _eval_type return t._evaluate(globalns, localns) File "/usr/lib/python3.7/typing.py", line 464, in _evaluate eval(self.__forward_code__, globalns, localns), File "", line 1, in TypeError: 'type' object is not subscriptable To fix this, a line like the following could be added to Lib/typing.py near line 1250: OrderedDict = _alias(collections.OrderedDict, (KT, VT)) There might be a reasoning for why this has not been done yet, but I have not been able to find any. If this is acceptable, I could prepare a PR. I suppose there is no hope of a backport to 3.7, since this is a new feature (though very minor). ---------- components: Library (Lib) messages: 330616 nosy: itoijala priority: normal severity: normal status: open title: Add generic version of OrderedDict to typing module type: enhancement versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 12:37:10 2018 From: report at bugs.python.org (Richard Brooksby) Date: Wed, 28 Nov 2018 17:37:10 +0000 Subject: [New-bugs-announce] [issue35342] email "default" policy raises exception iterating over unparseable date headers Message-ID: <1543426629.99.0.788709270274.issue35342@psf.upfronthosting.co.za> New submission from Richard Brooksby : It is not possible to loop over the headers of a message with an unparseable date field using the "default" policy. This means that a poison email can break email processing. I expect to be able to process an email with an unparseable date field using the "default" policy. $ python3 --version Python 3.6.7 $ python3 Python 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import email >>> import email.policy >>> email.message_from_string('Date: not a parseable date', policy=email.policy.default).items() Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.6/email/message.py", line 460, in items for k, v in self._headers] File "/usr/lib/python3.6/email/message.py", line 460, in for k, v in self._headers] File "/usr/lib/python3.6/email/policy.py", line 162, in header_fetch_parse return self.header_factory(name, value) File "/usr/lib/python3.6/email/headerregistry.py", line 589, in __call__ return self[name](name, value) File "/usr/lib/python3.6/email/headerregistry.py", line 197, in __new__ cls.parse(value, kwds) File "/usr/lib/python3.6/email/headerregistry.py", line 306, in parse value = utils.parsedate_to_datetime(value) File "/usr/lib/python3.6/email/utils.py", line 210, in parsedate_to_datetime *dtuple, tz = _parsedate_tz(data) TypeError: 'NoneType' object is not iterable >>> Related: https://docs.python.org/3/library/email.headerregistry.html#email.headerregistry.DateHeader does not specify what happens to the datetime field if a date header cannot be parsed. Related: https://docs.python.org/3/library/email.utils.html#email.utils.parsedate_to_datetime does not specify what happens if a date cannot be parsed. Suggested tests: random fuzz testing of the contents of all email headers, especially those with parsers in the header registry. ---------- components: email messages: 330621 nosy: barry, r.david.murray, rptb1 priority: normal severity: normal status: open title: email "default" policy raises exception iterating over unparseable date headers type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 17:03:48 2018 From: report at bugs.python.org (Owen Pembery) Date: Wed, 28 Nov 2018 22:03:48 +0000 Subject: [New-bugs-announce] [issue35343] Importlib.reload has different behaviour in script and interactive mode Message-ID: <1543442628.31.0.788709270274.issue35343@psf.upfronthosting.co.za> New submission from Owen Pembery : This may be a bug, or may be a hole in my understanding of how importlib.reload works. In short, when running importlib.reload in a script, it seems that a module is not reloaded before it is used, whereas running the same script a line at a time in interactive mode seems to reload the script. Relevant scripts are in the github repository: https://github.com/orpembery/python-reload-bug. I find the bug using python 3.5.2 on Ubuntu 16.04. The expected output from running python3 master.py is: 1 2 However, I instead find that the output is: 1 1 If I paste the commands in master.py into the interpreter one at a time, I get the expected behaviour: Python 3.5.2 (default, Nov 12 2018, 13:43:14) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from shutil import copy >>> >>> from importlib import reload >>> # Move a file ... copy('fn_1.py','fn.py') 'fn.py' >>> # Import it ... import fn >>> # Run it ... fn.fn() 1 >>> # Move a different file to the same location. ... copy('fn_2.py','fn.py') 'fn.py' >>> # Reload it ... reload(fn) >>> # Run it ... fn.fn() 2 However, if the commands in master.py are pasted in all at one (i.e., with a single CTRL-V keystroke), I obtain the unexpected behaviour: Python 3.5.2 (default, Nov 12 2018, 13:43:14) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from shutil import copy >>> from importlib import reload >>> >>> # Move a file ... copy('fn_1.py','fn.py') 'fn.py' >>> >>> # Import it ... import fn >>> >>> # Run it ... fn.fn() 1 >>> >>> # Move a different file to the same location. ... copy('fn_2.py','fn.py') 'fn.py' >>> >>> # Reload it ... reload(fn) >>> >>> # Run it ... fn.fn() 1 Possible causes: I'm very far from an expert, but it seems to be something to do with caching; running python3 -B master.py gives the expected behaviour. ---------- components: Library (Lib) messages: 330631 nosy: brett.cannon, orpembery priority: normal severity: normal status: open title: Importlib.reload has different behaviour in script and interactive mode versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 17:55:01 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 28 Nov 2018 22:55:01 +0000 Subject: [New-bugs-announce] [issue35344] platform: get macOS version rather than darwin version? Message-ID: <1543445701.98.0.788709270274.issue35344@psf.upfronthosting.co.za> New submission from STINNER Victor : Would it be possible to get the macOS version (platform.mac_ver()) rather than the darwin version (uname()) for platform.platform()? As an user, I prefer the OS (macOS) version rather than the kernel (darwin) version. Current output $ ./python.exe -m platform Darwin-17.7.0-x86_64-i386-64bit versus $ ./python.exe -c 'import platform; print(platform.mac_ver())' ('10.13.6', ('', '', ''), 'x86_64') I tested on: $ uname -a Darwin macbook 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64 $ sw_vers ProductName: Mac OS X ProductVersion: 10.13.6 BuildVersion: 17G65 ---------- components: Library (Lib), macOS messages: 330636 nosy: ned.deily, ronaldoussoren, vstinner priority: normal severity: normal status: open title: platform: get macOS version rather than darwin version? versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 18:54:11 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 28 Nov 2018 23:54:11 +0000 Subject: [New-bugs-announce] [issue35345] Remove platform.popen(), deprecated since Python 3.3 Message-ID: <1543449251.4.0.788709270274.issue35345@psf.upfronthosting.co.za> New submission from STINNER Victor : platform.popen() is deprecated since Python 3.3: bpo-11377. Calling the function emits a DeprecationWarning and the function is documented as being deprecated. The function is documented in the "Win95/98 specific": https://docs.python.org/dev/library/platform.html#win95-98-specific Python 3.5 dropped Windows XP support. I don't think that Python 2.7 still support Windows 98. So it's time to remove support for this old OS. Python 3 now has a os.popen() function: https://docs.python.org/dev/library/os.html#os.popen ---------- components: Library (Lib) messages: 330639 nosy: vstinner priority: normal severity: normal status: open title: Remove platform.popen(), deprecated since Python 3.3 versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 28 20:42:39 2018 From: report at bugs.python.org (STINNER Victor) Date: Thu, 29 Nov 2018 01:42:39 +0000 Subject: [New-bugs-announce] [issue35346] Modernize Lib/platform.py code Message-ID: <1543455759.08.0.788709270274.issue35346@psf.upfronthosting.co.za> New submission from STINNER Victor : Lib/platform.py still contains code to support Python 2.3. It's maybe time to modernize it. platform imports subprocess since commit fc990e942fb55be78e8352f4913749e91cac381d. The two calls to os.popen() can now be replaced with subprocess.Popen. ---------- components: Library (Lib) messages: 330657 nosy: vstinner priority: normal severity: normal status: open title: Modernize Lib/platform.py code versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 29 04:32:02 2018 From: report at bugs.python.org (STINNER Victor) Date: Thu, 29 Nov 2018 09:32:02 +0000 Subject: [New-bugs-announce] [issue35347] test_socket: NonBlockingTCPTests.testRecv() uses a weak 100 ms sleep as synchronization Message-ID: <1543483922.25.0.788709270274.issue35347@psf.upfronthosting.co.za> New submission from STINNER Victor : Failure seen on the Windows XP buildbot: https://buildbot.python.org/all/#/builders/45/builds/288 0:02:14 [ 35/404/1] test_socket failed test test_socket failed -- Traceback (most recent call last): File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\test\test_socket.py", line 1020, in testRecv self.fail("Error trying to do non-blocking recv.") AssertionError: Error trying to do non-blocking recv. In fact, the master branch still uses the weak 100 ms sleep as synchronization primitive :-( Attached PR replaces time.sleep() with a threading.Event(). ---------- components: Tests messages: 330671 nosy: vstinner priority: normal severity: normal status: open title: test_socket: NonBlockingTCPTests.testRecv() uses a weak 100 ms sleep as synchronization versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 29 07:33:34 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 29 Nov 2018 12:33:34 +0000 Subject: [New-bugs-announce] [issue35348] Problems with handling the file command output in platform.architecture() Message-ID: <1543494814.29.0.788709270274.issue35348@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The code of _syscmd_file() in the platform module does not match the docstring. The "-b" option was removed in 685fffa (issue16112), and this leads to inclusion the executable path in the file command output. If the executable path contains some key strings like "32-bit" or "PE", platform.architecture() can return an incorrect result. I think that the "-b" option should be restored. $ python3 -c 'import platform; print(platform.architecture("/usr/bin/python3.6"))' ('64bit', 'ELF') $ cp /usr/bin/python3.6 /tmp/32-bitPE $ python3 -c 'import platform; print(platform.architecture("/tmp/32-bitPE"))' ('32bit', 'ELF') Other problem is that the code tests if the string "executable" is contained in the file command output. But it is not always contained for executables on Linux. $ file python python: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=d3cfa06c2bdcbf7b6af9e4e6be5061cb8398c086, with debug_info, not stripped $ file /usr/bin/python2.7 /usr/bin/python2.7: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=fd3904306c73383fb371287416257b82d6a3363b, stripped $ file /usr/bin/python3.6 /usr/bin/python3.6: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=9dae0eec9b3f9cb82612d20dc0c3088feab9e356, stripped ---------- components: Library (Lib) messages: 330686 nosy: lemburg, serhiy.storchaka, vstinner priority: normal severity: normal status: open title: Problems with handling the file command output in platform.architecture() type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 29 10:05:12 2018 From: report at bugs.python.org (Leonard de Ruijter) Date: Thu, 29 Nov 2018 15:05:12 +0000 Subject: [New-bugs-announce] [issue35349] collections.abc.Sequence isn't an abstract base class for array.array Message-ID: <1543503912.1.0.788709270274.issue35349@psf.upfronthosting.co.za> New submission from Leonard de Ruijter : array.array seems to have all the abstract methods of a collections.abc.Sequence and all the classes it inherits from, still the following returns False: `isinstance(array.array("u"), collections.abc.Sequence)` ---------- messages: 330695 nosy: Leonard de Ruijter priority: normal severity: normal status: open title: collections.abc.Sequence isn't an abstract base class for array.array type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 29 10:17:47 2018 From: report at bugs.python.org (David) Date: Thu, 29 Nov 2018 15:17:47 +0000 Subject: [New-bugs-announce] [issue35350] importing "ctypes" immediately causes a segmentation fault Message-ID: <1543504667.76.0.788709270274.issue35350@psf.upfronthosting.co.za> New submission from David : ~Environment Cross compiled Python 2.7.15 for ARM Cortex-A7 target, Linux Kernel 4.18 uname -a: Linux Test-0002 4.18.13 #1 SMP Wed Oct 31 11:20:07 CET 2018 armv7l GNU/Linux ~Description of the problem Importing the "ctypes" module in order to load shared libraries causes a segmentation fault: root [ /tmpfs/root ] $ python Python 2.7.15 (default, Nov 29 2018, 13:57:56) [GCC 8.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import ctypes Segmentation fault I have found a similiar issue here: https://bugs.python.org/issue11048 But the changes are already applied in 2.7.15. Here is the GDB output similiar to the link I posted: (gdb) file python2.7 Reading symbols from python2.7...done. (gdb) run -c "import ctypes" Starting program: /usr/bin/python2.7 -c "import ctypes" warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. Program received signal SIGSEGV, Segmentation fault. 0x76a4fa94 in CThunkObject_dealloc (_self=0x76adb920) at /home/user/ARM_Linux/src/Python-2.7.15/Modules/_ctypes/callbacks.c:25 25 /home/user/ARM_Linux/src/Python-2.7.15/Modules/_ctypes/callbacks.c: No such file or directory. (gdb) >From what I can see it tries to use the path from the host I cross compiled for the callbacks.c. Is this the cause of the segmentation fault? If yes, how can I correct the path during compilation? I also attached the strace log of the command 'python -c "import ctypes"' Thank you in advance! ---------- components: ctypes files: strace_python.log messages: 330696 nosy: n0s69z priority: normal severity: normal status: open title: importing "ctypes" immediately causes a segmentation fault type: crash versions: Python 2.7 Added file: https://bugs.python.org/file47954/strace_python.log _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 29 10:29:01 2018 From: report at bugs.python.org (Charalampos Stratakis) Date: Thu, 29 Nov 2018 15:29:01 +0000 Subject: [New-bugs-announce] [issue35351] LTOFLAGS are passed to BASECFLAGS when using LTO Message-ID: <1543505341.98.0.788709270274.issue35351@psf.upfronthosting.co.za> New submission from Charalampos Stratakis : Through configure.ac and this change [0] LTOFLAGS and more specifically -flto is baked into BASECFLAGS when using link time optimizations, which will make this flag propagate to distutils. [0] https://github.com/python/cpython/commit/69a3f153a92fd8c86080e8da477ee50df18fc0d1#diff-67e997bcfdac55191033d57a16d1408aL1350 ---------- components: Build, Extension Modules messages: 330697 nosy: cstratak priority: normal severity: normal status: open title: LTOFLAGS are passed to BASECFLAGS when using LTO versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 29 11:13:50 2018 From: report at bugs.python.org (Charalampos Stratakis) Date: Thu, 29 Nov 2018 16:13:50 +0000 Subject: [New-bugs-announce] [issue35352] test_asyncio fails on RHEL8 Message-ID: <1543508030.73.0.788709270274.issue35352@psf.upfronthosting.co.za> New submission from Charalampos Stratakis : When compiling python3 on RHEL8 and run the tests, test_asyncio fails with 8 failures (and more on older branches). openssl version is 1.1.1 Attaching the failures for the various branches. ---------- components: Tests, asyncio files: asyncio_failures_3.8.log messages: 330698 nosy: asvetlov, cstratak, yselivanov priority: normal severity: normal status: open title: test_asyncio fails on RHEL8 versions: Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47955/asyncio_failures_3.8.log _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 29 12:04:25 2018 From: report at bugs.python.org (Christian Klein) Date: Thu, 29 Nov 2018 17:04:25 +0000 Subject: [New-bugs-announce] [issue35353] Add frame command to pub Message-ID: <1543511065.26.0.788709270274.issue35353@psf.upfronthosting.co.za> New submission from Christian Klein : Add command fr(ame) to jump to a stack frame in the Python debugger ---------- components: Library (Lib) messages: 330703 nosy: cnklein priority: normal pull_requests: 10045 severity: normal status: open title: Add frame command to pub _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 29 13:40:29 2018 From: report at bugs.python.org (-) Date: Thu, 29 Nov 2018 18:40:29 +0000 Subject: [New-bugs-announce] [issue35354] Generator functions stack overflow Message-ID: <1543516829.1.0.788709270274.issue35354@psf.upfronthosting.co.za> New submission from - : G?t `Fatal Python error: Cannot recover from stack overflow.` on Windows 10, not tested on other os. Crashed when use undefined variable. ---------- components: Interpreter Core files: crash.py messages: 330710 nosy: SUHAR1K priority: normal severity: normal status: open title: Generator functions stack overflow type: crash versions: Python 3.7 Added file: https://bugs.python.org/file47958/crash.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 29 15:00:38 2018 From: report at bugs.python.org (Evan Newman) Date: Thu, 29 Nov 2018 20:00:38 +0000 Subject: [New-bugs-announce] [issue35355] Some Errors involving formatted strings aren't reported in the right place. Message-ID: <1543521638.64.0.788709270274.issue35355@psf.upfronthosting.co.za> New submission from Evan Newman : Formatted strings seem to have some quirks. if you try putting in this, for example; print(f'{0 0}') ; you get a syntax error, which is probably intended, but where the error is reported is not always accurate. for example; #just a comment, it doesn't matter what it says print(f'{0 0}') ;will raise the syntax error, and highlight the j,u,and s in the comment! that doesn't help, and makes it look like the comment is the error. this is a real pain to debug if you hadn't known about this. it took me about 2 hours to track down the problem. seriously, this should be fixed. I haven't tested the problem in any editor but idle, so the cause could be anywhere. I was first using 3.7.0, I've just updated to 3.7.1 to make sure it still happens, and it does. ---------- assignee: terry.reedy components: IDLE files: recreation.py messages: 330719 nosy: Enewman, terry.reedy priority: normal severity: normal status: open title: Some Errors involving formatted strings aren't reported in the right place. type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file47959/recreation.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 01:42:28 2018 From: report at bugs.python.org (Zackery Spytz) Date: Fri, 30 Nov 2018 06:42:28 +0000 Subject: [New-bugs-announce] [issue35356] A possible reference leak in the nis module Message-ID: <1543560148.62.0.788709270274.issue35356@psf.upfronthosting.co.za> New submission from Zackery Spytz : In nis_maps(), the result of PyUnicode_FromString() is leaked if the PyList_Append() call fails. ---------- components: Extension Modules messages: 330747 nosy: ZackerySpytz priority: normal severity: normal status: open title: A possible reference leak in the nis module versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 02:55:37 2018 From: report at bugs.python.org (Chris Withers) Date: Fri, 30 Nov 2018 07:55:37 +0000 Subject: [New-bugs-announce] [issue35357] unittest.mock.call can't represent calls to a method called 'parent' Message-ID: <1543564537.68.0.788709270274.issue35357@psf.upfronthosting.co.za> New submission from Chris Withers : While working on https://bugs.python.org/issue35226, I stumbled upon this: >>> from unittest.mock import call >>> call.parent() Traceback (most recent call last): File "", line 1, in TypeError: 'NoneType' object is not callable Guess we need to make .parent and friends more uniquely named ;-) ---------- assignee: cjw296 messages: 330757 nosy: cjw296, mariocj89, michael.foord priority: normal severity: normal status: open title: unittest.mock.call can't represent calls to a method called 'parent' _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 03:30:51 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Fri, 30 Nov 2018 08:30:51 +0000 Subject: [New-bugs-announce] [issue35358] avoid '-' in importlib.import_module and builtins.__import__ Message-ID: <1543566651.92.0.788709270274.issue35358@psf.upfronthosting.co.za> New submission from St?phane Wirtel : maybe related to this issue: https://bugs.python.org/issue18831 we can't import a module where the name contains '-', for example from my-module import my_function but with importlib.import_module we can import this module. import_module does not respect the python syntax for the name of the module, we should avoid that. 1. Add a DeprecationWarning for 3.8+ 2. in 3.10, remove this DeprecationWarning and remove the support of the '-' in importlib.import_module ---------- messages: 330761 nosy: matrixise priority: normal severity: normal status: open title: avoid '-' in importlib.import_module and builtins.__import__ versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 06:57:56 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 30 Nov 2018 11:57:56 +0000 Subject: [New-bugs-announce] [issue35359] [2.7][Windows] Define _CRT_SECURE_NO_WARNINGS to build Modules\zlib\ Message-ID: <1543579076.36.0.788709270274.issue35359@psf.upfronthosting.co.za> New submission from STINNER Victor : The compilation of Modules\zlib\ on Python 2.7 emits a lot of warnings: see AppVeyor logs above. I propose to define _CRT_SECURE_NO_WARNINGS in the pythoncore project to make these warnings quiet, to spot more easily new warnings. Attached PR adds _CRT_SECURE_NO_WARNINGS to Python 2.7 pythoncore project. In the master branch, the following project also set _CRT_SECURE_NO_WARNINGS: * PCbuild/_decimal.vcxproj * PCbuild/_elementtree.vcxproj * PCbuild/_ssl.vcxproj * PCbuild/pyexpat.vcxproj Note: In the master branch, encode_current_locale() of Python/fileutils.c also uses wcstombs(), but no warning is emitted, whereas the C file is compiled by the pythoncore project which doesn't define _CRT_SECURE_NO_WARNINGS. AppVeyor logs: [00:01:51] ..\Modules\zlib\gzlib.c(193): warning C4996: 'wcstombs': This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdlib.h(534) : see declaration of 'wcstombs' [00:01:51] ..\Modules\zlib\gzlib.c(208): warning C4996: 'wcstombs': This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdlib.h(534) : see declaration of 'wcstombs' [00:01:51] ..\Modules\zlib\gzlib.c(214): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see declaration of '_snprintf' [00:01:51] ..\Modules\zlib\gzlib.c(245): warning C4996: '_wopen': This function or variable may be unsafe. Consider using _wsopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(276) : see declaration of '_wopen' [00:01:51] ..\Modules\zlib\gzlib.c(245): warning C4996: 'open': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(316) : see declaration of 'open' [00:01:51] ..\Modules\zlib\gzlib.c(296): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see declaration of '_snprintf' [00:01:51] ..\Modules\zlib\gzlib.c(612): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see declaration of '_snprintf' [00:01:51] gzread.c [00:01:51] ..\Modules\zlib\gzread.c(35): warning C4996: 'read': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(317) : see declaration of 'read' [00:01:51] ..\Modules\zlib\gzread.c(41): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(126) : see declaration of 'strerror' [00:01:51] ..\Modules\zlib\gzread.c(651): warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(306) : see declaration of 'close' [00:01:51] gzwrite.c [00:01:51] ..\Modules\zlib\gzwrite.c(89): warning C4996: 'write': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _write. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(322) : see declaration of 'write' [00:01:51] ..\Modules\zlib\gzwrite.c(91): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(126) : see declaration of 'strerror' [00:01:51] ..\Modules\zlib\gzwrite.c(110): warning C4996: 'write': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _write. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(322) : see declaration of 'write' [00:01:51] ..\Modules\zlib\gzwrite.c(112): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(126) : see declaration of 'strerror' [00:01:51] ..\Modules\zlib\gzwrite.c(428): warning C4996: 'vsnprintf': This function or variable may be unsafe. Consider using vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(350) : see declaration of 'vsnprintf' [00:01:51] ..\Modules\zlib\gzwrite.c(661): warning C4996: 'close': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details. [C:\projects\cpython\PCbuild\pythoncore.vcxproj] [00:01:51] C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\io.h(306) : see declaration of 'close' ---------- components: Build messages: 330777 nosy: vstinner priority: normal severity: normal status: open title: [2.7][Windows] Define _CRT_SECURE_NO_WARNINGS to build Modules\zlib\ versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 07:14:30 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 30 Nov 2018 12:14:30 +0000 Subject: [New-bugs-announce] [issue35360] [Windows] Update SQLite dependency Message-ID: <1543580070.45.0.788709270274.issue35360@psf.upfronthosting.co.za> New submission from STINNER Victor : Windows and macOS installers require SQLite, but they require different versions! Windows uses 3.21 or 3.14, but macOS uses 3.22. I'm talking about the following line in PCbuild\get_externals.bat: set libraries=%libraries% sqlite-3.21.0.0 * 3.6, 3.7 and master branches: SQLite[Windows]: 3.21.0.0 SQLite[macOS]: 3.22.0 * 2.7 branch: SQLite[Windows]: 3.14.2.0 SQLite[macOS]: 3.22.0 Note: I wrote a script to get external dependencies: https://github.com/vstinner/misc/blob/master/cpython/external_versions.py ---------- components: Build messages: 330779 nosy: vstinner priority: normal severity: normal status: open title: [Windows] Update SQLite dependency versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 07:37:15 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 30 Nov 2018 12:37:15 +0000 Subject: [New-bugs-announce] [issue35361] Update libffi dependency to 3.2.1? Message-ID: <1543581435.81.0.788709270274.issue35361@psf.upfronthosting.co.za> New submission from STINNER Victor : Python 2.7 and 3.6 embed a copy of libffi 3.1, whereas libffi 3.2.1 was released on November 12, 2014. Should we update libffi? I'm talking about the directory Modules/_ctypes/libffi/. It seems like Fedora 29 still uses libffi 3.1: $ rpm -q libffi libffi-3.1-18.fc29.x86_64 Note: Not only we vendor a copy of libffi and we also modify it :-/ Hopefully, libffi copy has been removed from Python 3.7! ---------- components: Build messages: 330784 nosy: vstinner priority: normal severity: normal status: open title: Update libffi dependency to 3.2.1? versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 10:30:25 2018 From: report at bugs.python.org (vassilis Lemonidis) Date: Fri, 30 Nov 2018 15:30:25 +0000 Subject: [New-bugs-announce] [issue35362] list inheritor with abc method does not raise Message-ID: <1543591825.01.0.788709270274.issue35362@psf.upfronthosting.co.za> New submission from vassilis Lemonidis : The following does not raise: class Test(list, metaclass=ABCMeta): @abstractmethod def test(self): pass test = Test() There is not enough documentation to support this problem, so I believe this can be classified as a bug. Anyone please elaborate. ---------- components: Library (Lib) messages: 330793 nosy: vaslem priority: normal severity: normal status: open title: list inheritor with abc method does not raise versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 10:54:17 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 30 Nov 2018 15:54:17 +0000 Subject: [New-bugs-announce] [issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot Message-ID: <1543593257.05.0.788709270274.issue35363@psf.upfronthosting.co.za> New submission from STINNER Victor : test_open() of test_eintr hangs randomly on x86-64 El Capitan 3.x buildbot. test_eintr failed but then passed when run again. pythoninfo: platform.platform: Darwin-15.6.0-x86_64-i386-64bit # macOS 10.11 (El Capitan) https://buildbot.python.org/all/#/builders/93/builds/1574 test_all (test.test_eintr.EINTRTests) ... FAIL ====================================================================== FAIL: test_all (test.test_eintr.EINTRTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/test_eintr.py", line 18, in test_all script_helper.assert_python_ok("-u", tester) File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/support/script_helper.py", line 157, in assert_python_ok return _assert_python(True, *args, **env_vars) File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/support/script_helper.py", line 143, in _assert_python res.fail(cmd_line) File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/support/script_helper.py", line 70, in fail raise AssertionError("Process return code is %d\n" AssertionError: Process return code is 1 command line: ['/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/python.exe', '-X', 'faulthandler', '-I', '-u', '/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/eintrdata/eintr_tester.py'] stdout: --- --- stderr: --- ........ss.s.ss.Timeout (0:10:00)! Thread 0x00007fff7c082000 (most recent call first): File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/eintrdata/eintr_tester.py", line 349 in python_open File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/eintrdata/eintr_tester.py", line 345 in _test_open File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/support/__init__.py", line 596 in wrapper File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/eintrdata/eintr_tester.py", line 353 in test_open File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/case.py", line 642 in run File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/case.py", line 702 in __call__ File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/suite.py", line 122 in run File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/suite.py", line 84 in __call__ File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/suite.py", line 122 in run File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/suite.py", line 84 in __call__ File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/runner.py", line 176 in run File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/main.py", line 271 in runTests File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/main.py", line 101 in __init__ File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/eintrdata/eintr_tester.py", line 527 in --- ---------------------------------------------------------------------- Ran 1 test in 605.488s FAILED (failures=1) Warning -- files was modified by test_eintr Before: [] After: ['@test_57532_tmp'] test test_eintr failed ---------- components: Tests messages: 330795 nosy: vstinner priority: normal severity: normal status: open title: test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 12:25:41 2018 From: report at bugs.python.org (Adrien) Date: Fri, 30 Nov 2018 17:25:41 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue35364=5D_Datetime_?= =?utf-8?q?=E2=80=9Cfromtimestamp=28=29=E2=80=9D_ignores_inheritance_if_ti?= =?utf-8?q?mezone_is_not_None?= Message-ID: <1543598741.31.0.788709270274.issue35364@psf.upfronthosting.co.za> New submission from Adrien : Hello. I created a class inheriting from "datetime.datetime". While creating a new instance using the classmethod "fromtimestamp" it seems to work, except if I provide a timezone object. In such case, the returned object is of base type datetime. This looks like a bug, isn't it? If not, I guess this should be mentioned somewhere in the documentation. Tested on Python 3.6 and 3.7, my apologies if this has been fixed in 3.8. NB: I first opened a question on SO -> https://stackoverflow.com/questions/53561996/datetime-fromtimestamp-ignores-inheritance-if-timezone-is-not-none ---------- components: Library (Lib) files: test.py messages: 330811 nosy: Delgan priority: normal severity: normal status: open title: Datetime ?fromtimestamp()? ignores inheritance if timezone is not None type: behavior versions: Python 3.6, Python 3.7 Added file: https://bugs.python.org/file47960/test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 14:34:39 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 30 Nov 2018 19:34:39 +0000 Subject: [New-bugs-announce] [issue35365] Use wchar_t* buffer instead of Unicode object in code page decoder Message-ID: <1543606479.07.0.788709270274.issue35365@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : Currently the code page decoder uses the legacy Unicode C API for creating an output buffer as a Unicode object with PyUnicode_WCHAR_KIND. Proposed PR makes it using a raw wchar_t* buffer. This is necessary for deprecating and removing the legacy Unicode C API in future. ---------- assignee: serhiy.storchaka components: Interpreter Core messages: 330816 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Use wchar_t* buffer instead of Unicode object in code page decoder versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 14:36:49 2018 From: report at bugs.python.org (Vijay) Date: Fri, 30 Nov 2018 19:36:49 +0000 Subject: [New-bugs-announce] [issue35366] Monkey Patching class derived from ctypes.Union doesn't work Message-ID: <1543606609.9.0.788709270274.issue35366@psf.upfronthosting.co.za> New submission from Vijay : I am trying to "monkey patch" a class derived from Python ctypes "Union", but I am unable to do so - getting weird errors and sometimes seg-faults. The same thing works quite well when deriving from ctypes "Structure". I have narrowed this to down to the simplest possible test case which I am posting below. I am using Python 3.6.4. I am wondering if I am doing something wrong (or is there a problem with the ctypes "Union" implementation?). The example python code is attached with this issue. Please see the output below (for the attached code in Python 3.6.4). Using Structure: ---------------- Print Type #1: [ 10, 20 ] Original : Patched : Patched (dict) : Print Type #2: ( 10, 20 ) Using Union: ------------ Print Type #1: [ 20, 20 ] Original : Patched : Patched (dict) : Traceback (most recent call last): File "ctypes_bug.py", line 54, in print(a) TypeError: 'managedbuffer' object is not callable Clearly, I am able to "patch" __str__ when the corresponding Python object was derived from "Structure", but I am unable to "patch" __str__ when the corresponding Python object was derived from "Union". Interestingly, MyUnion.__dict__[__str__] and MyUnion.__str__ shows different results - which is weird as well. Is there something I am doing wrong here, or is there an issue with ctypes.Union? I highly appreciate any help or insight! ---------- components: ctypes files: ctypes_bug.py messages: 330817 nosy: rvijayc priority: normal severity: normal status: open title: Monkey Patching class derived from ctypes.Union doesn't work type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47961/ctypes_bug.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 15:43:02 2018 From: report at bugs.python.org (Rich Jones) Date: Fri, 30 Nov 2018 20:43:02 +0000 Subject: [New-bugs-announce] [issue35367] FileExistsError During os.symlink() Displays Arrow in the Wrong Direction Message-ID: <1543610582.95.0.788709270274.issue35367@psf.upfronthosting.co.za> New submission from Rich Jones : If I try to create a symlink which already exists, I get a FileExistsError. In this error message, the explanatory arrow is pointing in the wrong direction. This gave us a big scare in our logs! Example: ``` $ ls HELLO.txt $ python3 Python 3.7.0 (default, Jul 23 2018, 20:22:55) [Clang 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.symlink('HELLO.txt', 'GOODBYE.txt') $ ls -lah * lrwxr-xr-x 1 rjones staff 9B Nov 30 15:36 GOODBYE.txt -> HELLO.txt -rw-r--r-- 1 rjones staff 4B Nov 30 15:34 HELLO.txt $ python3 Python 3.7.0 (default, Jul 23 2018, 20:22:55) [Clang 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.symlink('HELLO.txt', 'GOODBYE.txt') Traceback (most recent call last): File "", line 1, in FileExistsError: [Errno 17] File exists: 'HELLO.txt' -> 'GOODBYE.txt' ``` Notice that the arrow in the error message is pointing from HELLO to GOODBYE, but if you if you look at the `ls` output, it is pointing from GOODBYE to HELLO, which is the correct behavior. The Python3 error message should be changed to reflect the correct direction of the symlink. This is a Python3 only bug, as the paths aren't displayed in Python2. I can PR if this is accepted as a bug. Thanks! Rich ---------- components: Library (Lib) messages: 330826 nosy: miserlou priority: normal severity: normal status: open title: FileExistsError During os.symlink() Displays Arrow in the Wrong Direction type: behavior versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 18:07:48 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 30 Nov 2018 23:07:48 +0000 Subject: [New-bugs-announce] [issue35368] [2.7] Make PyMem_Malloc() thread-safe in debug mode Message-ID: <1543619268.28.0.788709270274.issue35368@psf.upfronthosting.co.za> New submission from STINNER Victor : While fixing bpo-33015, I discovered that PyMem_Malloc() isn't thread-safe when Python is compiled in debug mode: https://bugs.python.org/issue33015#msg330806 I wrote PR 10828 to make PyMem_Malloc() thread-safe when Python is compiled in debug mode. ---------- components: Interpreter Core messages: 330833 nosy: gregory.p.smith, vstinner priority: normal severity: normal status: open title: [2.7] Make PyMem_Malloc() thread-safe in debug mode versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 30 22:33:53 2018 From: report at bugs.python.org (David Wyde) Date: Sat, 01 Dec 2018 03:33:53 +0000 Subject: [New-bugs-announce] [issue35369] List sorting makes duplicate comparisons Message-ID: <1543635233.42.0.788709270274.issue35369@psf.upfronthosting.co.za> New submission from David Wyde : Python's Timsort sometimes makes the same comparison twice. This leads to extra compares, which can hurt performance. Python sorts several length-3 permutations in 4 steps, and the problem accumulates with bigger data. There are ~9,800 duplicate less-than checks when sorting a million randomly ordered numbers, and 24,386 wasted comparisons when sorting all permutations of length 8. I've attached a patch to fix this issue. Feedback and improvements are appreciated. Speed seems roughly comparable, and should be much improved for expensive comparison functions. The same problem occurs in the Chromium Browser, and probably other ports of Python's Timsort implementation. ---------- files: sort-fix.diff keywords: patch messages: 330839 nosy: dwyde, tim.peters priority: normal severity: normal status: open title: List sorting makes duplicate comparisons type: performance versions: Python 3.8 Added file: https://bugs.python.org/file47962/sort-fix.diff _______________________________________ Python tracker _______________________________________