From report at bugs.python.org Thu Jun 1 02:32:30 2017 From: report at bugs.python.org (Stefan Behnel) Date: Thu, 01 Jun 2017 06:32:30 +0000 Subject: [New-bugs-announce] [issue30534] error message for incorrect call degraded in 3.7 Message-ID: <1496298750.6.0.367163132505.issue30534@psf.upfronthosting.co.za> New submission from Stefan Behnel: I'm seeing doctest failures in Cython's test suite with Py3.7 due to the change of an error message: Failed example: func1(arg=None) Expected: Traceback (most recent call last): ... TypeError: func1() takes no keyword arguments Got: Traceback (most recent call last): File "/opt/python/3.7-dev/lib/python3.7/doctest.py", line 1329, in __run compileflags, 1), test.globs) File "", line 1, in func1(arg=None) TypeError: func1() takes exactly one argument (0 given) I'd normally just adapt the doctest and move on, but this seems like the error message is worse than before, so I thought I'd bring it up here. func1() is implemented as a METH_O C function. Suggesting that it does not accept keyword arguments seems better than saying that it expects "exactly one argument" instead of the exactly one argument that was passed. ---------- components: Interpreter Core messages: 294906 nosy: scoder priority: normal severity: normal status: open title: error message for incorrect call degraded in 3.7 type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 1 04:59:10 2017 From: report at bugs.python.org (Xavier Morel) Date: Thu, 01 Jun 2017 08:59:10 +0000 Subject: [New-bugs-announce] [issue30535] Warn that meta_path is not empty Message-ID: <1496307550.81.0.122215532062.issue30535@psf.upfronthosting.co.za> New submission from Xavier Morel: Encountered this issue porting Python 2 code manipulating meta_path to Python 3. In Python 2, meta_path is empty by default and its documentation specifically notes that: > sys.meta_path is searched before any implicit default finders or sys.path. As a result, sys.meta_path.append() works perfectly well and is overwhelmingly common[0]. In Python 3, this note was removed but the documentation does not specifically state default finders are present in meta_path, and the old code using sys.meta_path.append may now break as the default finders will silently take precedence on the custom ones if they believe they can do the job. I'd like to add a warning to the Python 3 documentation (3.5+?) noting the presence of existing default loaders, and to the Python 2 documentation suggesting `sys.meta_path.insert(0, finder)` for future-proofing, would there be objections or issues? [0] https://github.com/search?q=meta_path.append&type=Code&utf8=? ---------- assignee: docs at python components: Documentation messages: 294919 nosy: docs at python, xmorel priority: normal severity: normal status: open title: Warn that meta_path is not empty type: behavior versions: Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 1 06:42:19 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Jun 2017 10:42:19 +0000 Subject: [New-bugs-announce] [issue30536] SubinterpThreadingTests.test_threads_join_2() of test_threading leaks references Message-ID: <1496313739.63.0.850001827966.issue30536@psf.upfronthosting.co.za> New submission from STINNER Victor: Ah! I succeeded to hack a tool to bisect -m test -R 3:3 failure (issue #29512, I will publish it later, right now it's too hackish), so I found a first guilty of failure on the Gentoo Refleak failure. Maybe it's related to recent Eric Snow's work. Maybe not. I didn't dig the bug yet. haypo at selma$ ./python -m test -R 3:3 -m test_threads_join_2 test_threading Run tests sequentially 0:00:00 load avg: 0.16 [1/1] test_threading beginning 6 repetitions 123456 ...... test_threading leaked [3, 3, 3] references, sum=9 test_threading failed 1 test failed: test_threading Total duration: 2 sec Tests result: FAILURE ---------- messages: 294932 nosy: eric.snow, haypo, serhiy.storchaka, zach.ware priority: normal severity: normal status: open title: SubinterpThreadingTests.test_threads_join_2() of test_threading leaks references type: resource usage versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 1 07:26:09 2017 From: report at bugs.python.org (Michael Seifert) Date: Thu, 01 Jun 2017 11:26:09 +0000 Subject: [New-bugs-announce] [issue30537] Using PyNumber_AsSsize_t in itertools.islice Message-ID: <1496316369.93.0.672552876761.issue30537@psf.upfronthosting.co.za> New submission from Michael Seifert: In a question on StackOverflow (https://stackoverflow.com/questions/44302946/itertools-does-not-recognize-numpy-ints-as-valid-inputs-on-python-3-6) it was mentioned that numpys scalars cannot be used as index for `itertools.islice`. The reason for this is because the numbers are converted with `PyLong_AsSsize_t` (which requires a PyLongObject [or subclass]) instead of `PyNumber_AsSsize_t` (which only requires an `__index__` method). I'm not sure if there are many use-cases where numpy scalars make sense as inputs for `islice` but it's definetly unexpected that `itertools.islice([1, 2, 3, 4, 5, 6], np.int32(3))` currently throws a `ValueError: Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize.` ---------- components: Library (Lib) messages: 294934 nosy: MSeifert priority: normal severity: normal status: open title: Using PyNumber_AsSsize_t in itertools.islice type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 1 07:32:35 2017 From: report at bugs.python.org (Cheryl Sabella) Date: Thu, 01 Jun 2017 11:32:35 +0000 Subject: [New-bugs-announce] [issue30538] Functional Programming HOWTO describes one argument itertools.count() Message-ID: <1496316755.99.0.127514740016.issue30538@psf.upfronthosting.co.za> New submission from Cheryl Sabella: The Functional Programming HOWTO describes single variable itertools.count instead of the two variable version that is linked to. ---------- assignee: docs at python components: Documentation messages: 294935 nosy: csabella, docs at python priority: normal severity: normal status: open title: Functional Programming HOWTO describes one argument itertools.count() versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 1 09:59:06 2017 From: report at bugs.python.org (jabdoa) Date: Thu, 01 Jun 2017 13:59:06 +0000 Subject: [New-bugs-announce] [issue30539] Make Proactor public in asyncio.ProactorEventLoop Message-ID: <1496325546.51.0.723953827271.issue30539@psf.upfronthosting.co.za> New submission from jabdoa: pyserial-asyncio cannot use IOCP for serial sockets on windows because _proactor is private on the ProactorEventLoop. Can it be made public? Currently, pyserial-asyncio has to rely on polling for windows which is suboptimal. Some forks use Proactor (e.g. https://github.com/m-labs/asyncserial/blob/master/asyncserial/asyncserial.py#L172) but it would be nice to use a stable API in official pyserial-asyncio. Issue for this is here: https://github.com/pyserial/pyserial-asyncio/issues/3 ---------- components: asyncio messages: 294939 nosy: jabdoa, yselivanov priority: normal severity: normal status: open title: Make Proactor public in asyncio.ProactorEventLoop versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 1 15:39:14 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Jun 2017 19:39:14 +0000 Subject: [New-bugs-announce] [issue30540] regrtest: add --matchfile option Message-ID: <1496345954.5.0.308373538443.issue30540@psf.upfronthosting.co.za> New submission from STINNER Victor: Attached pull request adds the --matchfile option to regrtest. * Add a new option taking a filename to get a list of test names to filter tests. * support.match_tests becomes a list. * Modify run_unittest() to accept to match the whole test identifier, not just a part of a test identifier. For example, the following command only runs test_default_timeout() of the BarrierTests class of test_threading: $ ./python -m test -v test_threading -m test.test_threading.BarrierTests.test_default_timeout ---------- components: Tests messages: 294959 nosy: haypo, martin.panter, serhiy.storchaka priority: normal severity: normal status: open title: regrtest: add --matchfile option type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 1 16:16:56 2017 From: report at bugs.python.org (Mario Corchero) Date: Thu, 01 Jun 2017 20:16:56 +0000 Subject: [New-bugs-announce] [issue30541] Add restricted mocks to the python unittest mocking framework Message-ID: <1496348216.16.0.694231026308.issue30541@psf.upfronthosting.co.za> New submission from Mario Corchero: Define a way to disable the automatic generation of submocks when accessing an attribute of a mock which is not set. Rationale: Inspired by GMock RestrictedMock, it aims to allow the developer to declare a narrow interface to the mock that defines what the mocks allows to be called on. The feature of mocks returning mocks by default is extremely useful but not always desired. Quite often you rely on it only at the time you are writing the test but you want it to be disabled at the time the mock is passed into your code. It also prevents user errors when mocking incorrect paths or having typos when calling attributes/methods of the mock. We have tried it internally in our company and it gives quite a nicer user experience for many use cases, specially for new users of mock as it helps out when you mock the wrong path. Posible interfaces: New Mock type, SeledMock which can be used instead of the "common" mock that has an attribute "sealed" which once set to true disables the dynamic generation of "submocks" The final goal is to be able to write tests like: >>> m = mock.Mock() # or = mock.SealableMock() >>> m.method1.return_value.attr1.method2.return_value = 1 >>> mock.seal(m) # or mock.sealed = True >>> m.method1().attr1.method2() # This path has been declared above # 1 >>> m.method1().attr2 # This was not defined so it is going to raise a meaningful exception # Exception: SealedMockAttributeAccess: mock.method1().attr2 ---------- components: Library (Lib) messages: 294961 nosy: Mario Corchero, haypo priority: normal severity: normal status: open title: Add restricted mocks to the python unittest mocking framework type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 1 16:42:40 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Jun 2017 20:42:40 +0000 Subject: [New-bugs-announce] [issue30542] test_files() of test_tools.test_unparse.DirectoryTestCase leaks references Message-ID: <1496349760.43.0.933956477831.issue30542@psf.upfronthosting.co.za> New submission from STINNER Victor: haypo at selma$ ./python -m test -R 3:3 test_tools -m test_files Run tests sequentially 0:00:00 load avg: 0.57 [1/1] test_tools beginning 6 repetitions 123456 ...... test_tools leaked [0, 4, 0] references, sum=4 test_tools leaked [0, 3, 0] memory blocks, sum=3 test_tools failed 1 test failed: test_tools Total duration: 12 sec Tests result: FAILURE Note: I found it using Zachary's x86 Gentoo Refleaks buildbot and bpo-29512. ---------- components: Tests messages: 294963 nosy: haypo priority: normal severity: normal status: open title: test_files() of test_tools.test_unparse.DirectoryTestCase leaks references versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 1 17:27:02 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 01 Jun 2017 21:27:02 +0000 Subject: [New-bugs-announce] [issue30543] test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: ConnectionResetError: [Errno 54] Connection reset by peer Message-ID: <1496352422.89.0.341222891297.issue30543@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Debug%203.x/builds/350/steps/test/logs/stdio testAcceptTimeout (test.test_timeout.TCPTimeoutTestCase) ... ok testConnectTimeout (test.test_timeout.TCPTimeoutTestCase) ... skipped "Resource 'blackhole.snakebite.net' is not available" testRecvTimeout (test.test_timeout.TCPTimeoutTestCase) ... ok testSend (test.test_timeout.TCPTimeoutTestCase) ... ERROR testSendall (test.test_timeout.TCPTimeoutTestCase) ... ok testSendto (test.test_timeout.TCPTimeoutTestCase) ... ERROR testRecvfromTimeout (test.test_timeout.UDPTimeoutTestCase) ... test test_timeout failed ok ====================================================================== ERROR: testSend (test.test_timeout.TCPTimeoutTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_timeout.py", line 151, in tearDown self.sock.close() File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 417, in close self._real_close() File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 411, in _real_close _ss.close(self) ConnectionResetError: [Errno 54] Connection reset by peer ====================================================================== ERROR: testSendto (test.test_timeout.TCPTimeoutTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_timeout.py", line 151, in tearDown self.sock.close() File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 417, in close self._real_close() File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/socket.py", line 411, in _real_close _ss.close(self) ConnectionResetError: [Errno 54] Connection reset by peer ---------------------------------------------------------------------- Ran 14 tests in 10.084s FAILED (errors=2, skipped=1) 1 test failed again: test_timeout Total duration: 17 min 14 sec Tests result: FAILURE ---------- components: Tests messages: 294971 nosy: haypo priority: normal severity: normal status: open title: test_timeout fails on AMD64 FreeBSD CURRENT Debug 3.x: ConnectionResetError: [Errno 54] Connection reset by peer versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 1 18:57:43 2017 From: report at bugs.python.org (Segev Finer) Date: Thu, 01 Jun 2017 22:57:43 +0000 Subject: [New-bugs-announce] [issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails Message-ID: <1496357863.69.0.978506561912.issue30544@psf.upfronthosting.co.za> New submission from Segev Finer: Found due to this: https://github.com/pytest-dev/py/issues/103 I'm going to submit a PR. ---------- components: IO, Windows messages: 294975 nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 00:58:59 2017 From: report at bugs.python.org (Madhav Datt) Date: Fri, 02 Jun 2017 04:58:59 +0000 Subject: [New-bugs-announce] [issue30545] Enum equality across modules: comparing objects instead of values Message-ID: <1496379539.81.0.670964151039.issue30545@psf.upfronthosting.co.za> New submission from Madhav Datt: The problem is described with an example in this StackOverflow question (https://stackoverflow.com/questions/26589805/python-enums-across-modules). Like in C and other languages, I would expect Enum equality to work across modules and not compare enum states/values, instead of just checking for the same object. A possible simple fix for this problem would be to override the __eq__() function by default in the enum.Enum class with the following: def __eq__(self, other): if isinstance(other, self.__class__): return self.value == other.value return False I would be happy to create a GitHub pull request to fix this, however, I do not have the experience or knowledge to know if - the current behavior is by design; - whether this is worth fixing; and - whether fixing this will break anything else. ---------- components: Library (Lib) messages: 294983 nosy: Madhav Datt priority: normal severity: normal status: open title: Enum equality across modules: comparing objects instead of values type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 04:53:09 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Jun 2017 08:53:09 +0000 Subject: [New-bugs-announce] [issue30546] test_uname_win32_ARCHITEW6432() of test_platform leaks references Message-ID: <1496393589.85.0.680266409693.issue30546@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%203.6/builds/15/steps/test/logs/stdio 0:00:17 [ 4/405/1] test_platform failed ...... beginning 6 repetitions 123456 test_platform leaked [12, 12, 12] references, sum=36 test_platform leaked [4, 4, 4] memory blocks, sum=12 To reproduce the bug, use the command: python -m test -R 3:3 -m test_uname_win32_ARCHITEW6432 test_platform Note: Leak isolated my bisect_test.py of bpo-29512. ---------- components: Windows messages: 294989 nosy: eryksun, haypo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: test_uname_win32_ARCHITEW6432() of test_platform leaks references type: resource usage versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 04:58:24 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 02 Jun 2017 08:58:24 +0000 Subject: [New-bugs-announce] [issue30547] [Windows] SubinterpreterTest.test_callbacks_leak() of test_atexit leaks references Message-ID: <1496393904.76.0.689922881358.issue30547@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%203.6/builds/15/steps/test/logs/stdio 0:02:58 [ 28/405/2] test_atexit failed ...... beginning 6 repetitions 123456 test_atexit leaked [12, 12, 12] references, sum=36 test_atexit leaked [4, 4, 4] memory blocks, sum=12 Code of of the test: def test_callbacks_leak(self): # This test shows a leak in refleak mode if atexit doesn't # take care to free callbacks in its per-subinterpreter module # state. n = atexit._ncallbacks() code = r"""if 1: import atexit def f(): pass atexit.register(f) del atexit """ ret = support.run_in_subinterp(code) self.assertEqual(ret, 0) self.assertEqual(atexit._ncallbacks(), n) Hum, I don't understand: the test leaks references on purpose? To reproduce the bug, use the command: python -m test -R 3:3 -m test_callbacks_leak test_atexit Note: Leak isolated my bisect_test.py of bpo-29512. ---------- components: Tests, Windows messages: 294990 nosy: eryksun, haypo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: [Windows] SubinterpreterTest.test_callbacks_leak() of test_atexit leaks references type: resource usage versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 05:06:21 2017 From: report at bugs.python.org (=?utf-8?q?Erik_Bystr=C3=B6m?=) Date: Fri, 02 Jun 2017 09:06:21 +0000 Subject: [New-bugs-announce] [issue30548] typo in documentation for create_autospec Message-ID: <1496394381.09.0.91116482689.issue30548@psf.upfronthosting.co.za> New submission from Erik Bystr?m: "a class" should most probably be replaced by "an instance" in the documentation for create_autospec. "You can use a class as the spec for an instance object by passing instance=True. The returned mock will only be callable if instances of the mock are callable." https://docs.python.org/3/library/unittest.mock.html#unittest.mock.create_autospec ---------- assignee: docs at python components: Documentation messages: 294993 nosy: Erik Bystr?m, docs at python priority: normal severity: normal status: open title: typo in documentation for create_autospec type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 05:15:57 2017 From: report at bugs.python.org (=?utf-8?q?Roberto_Mart=C3=ADnez?=) Date: Fri, 02 Jun 2017 09:15:57 +0000 Subject: [New-bugs-announce] [issue30549] ProcessPoolExecutor hangs forever if the object raises on __getstate__ Message-ID: <1496394957.59.0.444319046255.issue30549@psf.upfronthosting.co.za> New submission from Roberto Mart?nez: Hi, I detected that a ProcessPoolExecutor hangs if the object fails to picklelize. I attached the simplest code to reproduce the behavior. Note that the interpreter should exit after the exception but it doesn't and hangs forever. I tested with python 3.4, 3.5 and 3.6 with the same results. ---------- files: test_noshutdown.py messages: 294999 nosy: Roberto Mart?nez priority: normal severity: normal status: open title: ProcessPoolExecutor hangs forever if the object raises on __getstate__ type: behavior versions: Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file46919/test_noshutdown.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 05:47:27 2017 From: report at bugs.python.org (Eric O. LEBIGOT) Date: Fri, 02 Jun 2017 09:47:27 +0000 Subject: [New-bugs-announce] [issue30550] Document order-preserving dictionary output Message-ID: <1496396847.32.0.655591837652.issue30550@psf.upfronthosting.co.za> New submission from Eric O. LEBIGOT: The JSON encoder for dictionaries preserves the order of the items in a dictionary: it would be useful to document this behavior, so that users can rely on it. While JSON itself does not have ordered key/value pairs, this feature can be useful (for modifying the original JSON document while maintaining as much of it untouched, for manipulating our own extension of JSON with ordered dictionaries, etc.). The documentation could also usefully mention that _reading_ sets of key/value pairs can also be done in an order-preserving way with `object_pairs_hook=OrderedDict`. Reference: the json module does not alter the order of the dictionary items upon encoding: https://github.com/python/cpython/blob/aacd53f6cb96fe8c4fe9ce894f22e25f356a97c3/Lib/json/encoder.py#L355. ---------- components: Library (Lib) messages: 295001 nosy: lebigot priority: normal severity: normal status: open title: Document order-preserving dictionary output type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 07:06:01 2017 From: report at bugs.python.org (Mahira) Date: Fri, 02 Jun 2017 11:06:01 +0000 Subject: [New-bugs-announce] [issue30551] Attribute Error Message-ID: <1496401561.24.0.276619479836.issue30551@psf.upfronthosting.co.za> New submission from Mahira: Hai, I am New to python and I am training with some open source projects now am Practising GUI.... I get the Error Message Traceback (most recent call last): File "C:/Users/Mahira/AppData/Local/Programs/Python/Python36/Lib/graphics_setup/Shape Gra Ex.py", line 6, in circle.draw("win") File "C:/Users/Mahira/AppData/Local/Programs/Python/Python36/Lib/graphics_setup\graphics.py", line 482, in draw if graphwin.isClosed(): raise GraphicsError("Can't draw to closed window") AttributeError: 'str' object has no attribute 'isClosed' And my Program is Following below: from graphics import * win=GraphWin('Shapes') center=Point(100,100) circle=Circle(center,30) circle.setFill('red') circle.draw("win") label=Text(center,"Red Circle") label.draw(win) rect=Rectangle(Point(30,30),Point(70,70)) r.draw(win) line=Line(Point(20,30),Point(180,199)) line.draw(win) oval=Oval(Point(20,150),Point(180,199)) oval.draw(win) ---------- messages: 295004 nosy: Mahira priority: normal severity: normal status: open title: Attribute Error type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 07:07:51 2017 From: report at bugs.python.org (Mahira) Date: Fri, 02 Jun 2017 11:07:51 +0000 Subject: [New-bugs-announce] [issue30552] Bugs Message-ID: New submission from Mahira: Hai Python Team, Am very new to programming Am facing following error in python Traceback (most recent call last): File "C:/Users/Mahira/AppData/Local/Programs/Python/Python36/Lib/graphics_setup/Shape Gra Ex.py", line 6, in circle.draw("win") File "C:/Users/Mahira/AppData/Local/Programs/Python/Python36/Lib/graphics_setup\graphics.py", line 482, in draw if graphwin.isClosed(): raise GraphicsError("Can't draw to closed window") AttributeError: 'str' object has no attribute 'isClosed My Program is: from graphics import * win=GraphWin('Shapes') center=Point(100,100) circle=Circle(center,30) circle.setFill('red') circle.draw("win") label=Text(center,"Red Circle") label.draw(win) rect=Rectangle(Point(30,30),Point(70,70)) r.draw(win) line=Line(Point(20,30),Point(180,199)) line.draw(win) oval=Oval(Point(20,150),Point(180,199)) oval.draw(win) Kindly help me to solve this issue ---------- messages: 295005 nosy: Mahira priority: normal severity: normal status: open title: Bugs _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 08:50:32 2017 From: report at bugs.python.org (Julien) Date: Fri, 02 Jun 2017 12:50:32 +0000 Subject: [New-bugs-announce] [issue30553] Add HTTP Response code 421 Message-ID: <1496407832.3.0.808781068022.issue30553@psf.upfronthosting.co.za> New submission from Julien: The `http.HTTPStatus` class provides constants for most of the HTTP status codes. Status code 421 was added by the RFC 7540 (HTTP/2), and is not part of this class. It is described as follows: > The 421 (Misdirected Request) status code indicates that the request > was directed at a server that is not able to produce a response. > This can be sent by a server that is not configured to produce > responses for the combination of scheme and authority that are > included in the request URI. Would it be possible to create the corresponding constant in `http.HTTPStatus`? For reference: * Status code 421 in the RFC 7540: https://tools.ietf.org/html/rfc7540#section-9.1.2 * Documentation on the HTTPStatus class in python 3.6: https://docs.python.org/3/library/http.html#http-status-codes * Another opened issue relative to the status code 451 currently pending review: https://bugs.python.org/issue26589 ---------- components: Library (Lib) messages: 295013 nosy: julienc priority: normal severity: normal status: open title: Add HTTP Response code 421 type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 12:01:56 2017 From: report at bugs.python.org (Igor Kozyrenko (ikseek)) Date: Fri, 02 Jun 2017 16:01:56 +0000 Subject: [New-bugs-announce] [issue30554] Inaccessible attribute characters_written on OSError instances Message-ID: <1496419316.76.0.0335094522467.issue30554@psf.upfronthosting.co.za> New submission from Igor Kozyrenko (ikseek): If I enumerate attributes on OSError instance with dir dir(OSError()) I see an 'characters_written' attribute (which is supposed to be defined on BlockingIOError according to docs). If I try to access it getattr(OSError(), 'characters_written') I get an AttributeError ---------- components: Library (Lib) messages: 295030 nosy: Igor Kozyrenko (ikseek) priority: normal severity: normal status: open title: Inaccessible attribute characters_written on OSError instances type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 12:56:53 2017 From: report at bugs.python.org (Segev Finer) Date: Fri, 02 Jun 2017 16:56:53 +0000 Subject: [New-bugs-announce] [issue30555] _io._WindowsConsoleIO breaks in the face of fd redirection Message-ID: <1496422613.2.0.0803212432553.issue30555@psf.upfronthosting.co.za> New submission from Segev Finer: _WindowsConsoleIO works by taking the handle out of the file descriptors of the stdio handles (get_osfhandle) and reading/writing to it directly using ReadConsoleW/WriteConsoleW. The problem is that some Python code wants to do file descriptor level redirection by overwriting the standard file descriptors using dup2. The problem is that this is also going to close the handle that Python itself is going to use to read/write to the console. Leading to the following: >>> fd = os.open('stdout.txt', os.O_CREAT | os.O_WRONLY) >>> os.dup2(fd, 1) >>> print('spam') Traceback (most recent call last): File "", line 1, in OSError: [WinError 87] The parameter is incorrect # "OSError: [WinError 6] The handle is invalid" after https://bugs.python.org/issue30544 This manifests itself for example in Pytest which does fd redirection to capture test output. See https://github.com/pytest-dev/py/issues/103 for the issue. And see https://github.com/pytest-dev/pytest/pull/2462 for an WIP attempt to workaround this. This issue also impacts other code that uses console handles itself like colorama: https://github.com/pytest-dev/pytest/issues/2465. Though that code is likely going to have to deal with this by itself. Those file descriptors are an emulation implemented by the Universal CRT and you can see their implementation in your copy of the Windows SDK. It's quite possible that this doesn't happen in older CRT versions either since colorama doesn't seem to break on Python 2.7 for example. One way I can think working around this is that Python will DuplicateHandle the console handles so that even if dup2 closes the original ones it will keep on working. We can also switch to calling _get_osfhandle always instead of caching the handle, it will break when the fd is redirected to a non-console. But so does _WindowsConsoleIO in general since it will try to continue writing to the console despite the redirection, meaning that Python code doing redirection has to handle sys.std* anyhow. Though I'm not sure about the performance of constantly calling _get_osfhandle. And their yet might be other ways to solve this. Also see comment by eryksun https://bugs.python.org/msg294988 Solving this in CPython will remove the need for hacks like the PR I referenced. ---------- components: IO, Windows messages: 295041 nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: _io._WindowsConsoleIO breaks in the face of fd redirection type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 13:47:13 2017 From: report at bugs.python.org (Samuel Colvin) Date: Fri, 02 Jun 2017 17:47:13 +0000 Subject: [New-bugs-announce] [issue30556] asyncio.wait very slow with FIRST_COMPLETED Message-ID: <1496425633.34.0.560515372039.issue30556@psf.upfronthosting.co.za> New submission from Samuel Colvin: This is best described the script at https://gist.github.com/samuelcolvin/00f01793c118bf9aafae886ffbc81a58. Basically, completing a set of tasks using asyncio.wait(...return_when=asyncio.FIRST_COMPLETED) in a loop to wait for them to finish is much much slower than completing the same set of tasks using just asyncio.wait(pending_tasks, loop=loop, return_when=asyncio.ALL_COMPLETED). In my example, the ALL_COMPLETED case takes ~5s, but the FIRST_COMPLETED case takes 18 - 47s. The screenshot on the gist shows network usage with a very long tail, in other words very few tasks are taking a long time to complete. This example uses aiohttp get a url as the test case but I'm pretty sure this isn't an issue with aiohttp. I tried the same thing with uvloop but got broadly the same result. ---------- components: asyncio files: asyncio_wait_test.py messages: 295045 nosy: samuelcolvin, yselivanov priority: normal severity: normal status: open title: asyncio.wait very slow with FIRST_COMPLETED type: performance versions: Python 3.6 Added file: http://bugs.python.org/file46920/asyncio_wait_test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 2 17:09:30 2017 From: report at bugs.python.org (Steve Dower) Date: Fri, 02 Jun 2017 21:09:30 +0000 Subject: [New-bugs-announce] [issue30557] faulthandler does not correctly filter fatal exceptions on Windows Message-ID: <1496437770.9.0.75244624328.issue30557@psf.upfronthosting.co.za> New submission from Steve Dower: faulthandler adds a structured exception handler on Windows so we can dump a Python traceback before crashing. This should only be done for fatal exceptions, but is currently done for some non-fatal exceptions. The current test is `flags & EXCEPTION_NONCONTINUABLE`, which is incorrect (as evidenced by the fact that the check is wrong in its current context and should be `!(flags & EXCEPTION_NONCONTINUABLE)`). Instead, `code & 0x80000000` determines whether the exception is an error. If not, we should skip logging any info. ---------- assignee: steve.dower components: Windows messages: 295054 nosy: haypo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: patch review status: open title: faulthandler does not correctly filter fatal exceptions on Windows type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 3 00:05:36 2017 From: report at bugs.python.org (Jacob Pratt) Date: Sat, 03 Jun 2017 04:05:36 +0000 Subject: [New-bugs-announce] [issue30558] [Suggestion] Improve documentation for set() API Message-ID: <1496462736.53.0.208043684916.issue30558@psf.upfronthosting.co.za> New submission from Jacob Pratt: While going through the documentation, I found that set() has surprisingly little documentation, not even a list of built-in methods. I'm not sure exactly what is missing, but I know that issubset and issuperset isn't in there (that's what I was looking for, specifically). Thanks! ---------- messages: 295064 nosy: Jacob Pratt priority: normal severity: normal status: open title: [Suggestion] Improve documentation for set() API type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 3 04:36:44 2017 From: report at bugs.python.org (Mahira) Date: Sat, 03 Jun 2017 08:36:44 +0000 Subject: [New-bugs-announce] [issue30559] Bugs in Web app Message-ID: <1496479004.44.0.605071340261.issue30559@psf.upfronthosting.co.za> New submission from Mahira: Hai I followed your Tutorial In the Following Program, i am getting Traceback (most recent call last): File "C:\Users\Mahira\AppData\Local\Programs\Python\Python36\Scripts\localhost.py", line 1, in import web File "C:\Users\Mahira\AppData\Local\Programs\Python\Python36\Scripts\web.py", line 6, in app = web.application(("urls"),globals()) AttributeError: module 'web' has no attribute 'application' And my program is: import web urls = ( '/', 'index' ) class index: def GET(self): return "Hello, world!" if __name__ == "__main__": app = web.application(urls, globals()) app.run() ---------- assignee: terry.reedy components: IDLE messages: 295071 nosy: Mahira, terry.reedy priority: normal severity: normal status: open title: Bugs in Web app type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 3 15:15:43 2017 From: report at bugs.python.org (Thomas Perl) Date: Sat, 03 Jun 2017 19:15:43 +0000 Subject: [New-bugs-announce] [issue30560] Py_SetFatalErrorAbortFunc: Allow embedding program to handle fatal errors Message-ID: <1496517343.89.0.835339034855.issue30560@psf.upfronthosting.co.za> New submission from Thomas Perl: In our application that embeds a Python interpreter, we had the issue that certain system configurations (namely, a lone "libpython27.dll" without any standard library) caused silent failures (note that this is using Python 2.7, but Python 3.x would be similarly affected, as the Py_FatalError() handling is still the same): https://github.com/gpodder/gpodder/issues/286 There exists a Stack Overflow thread about this: https://stackoverflow.com/questions/7688374/how-to-i-catch-and-handle-a-fatal-error-when-py-initialize-fails The workaround described therein is: "I solved this by creating a separate executable that attempts to initialize python. My primary process will launch it and check the exit code and only call PyInitialize if the child process was successful. So, python is initialized twice, but it is better than an apparent crash to the user." So, what if instead we allow the embedding program to set a function pointer to a function that will get called instead of abort()? We have to make clear in the docs that after this function is called, the Python interpreter cannot be used, and the application should probably exit, but at least it would allow applications to capture the error message and show it to the user (e.g. using a MessageBox() on Windows) before exiting -- see attached patch. Any alternative solutions would be fine as well that don't require us to create a new process and "try to" Py_Initialize() there, especially since Py_FatalError() might potentially be called in other places and in all those cases, a user-visible dialog would be better than an apparent "crash" (application exits). ---------- components: Interpreter Core files: Py_SetFatalErrorAbortFunc.patch keywords: patch messages: 295098 nosy: thomas.perl priority: normal severity: normal status: open title: Py_SetFatalErrorAbortFunc: Allow embedding program to handle fatal errors versions: Python 3.6 Added file: http://bugs.python.org/file46921/Py_SetFatalErrorAbortFunc.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 3 16:16:30 2017 From: report at bugs.python.org (Leonardo De Marchi) Date: Sat, 03 Jun 2017 20:16:30 +0000 Subject: [New-bugs-announce] [issue30561] sync-up gammavariate and expovariate code Message-ID: <1496520990.41.0.958054362061.issue30561@psf.upfronthosting.co.za> New submission from Leonardo De Marchi: As suggested by rhettinger in http://bugs.python.org/msg294438: I agree that the comment should be changed. While we at it, perhaps sync-up with expovariate() code and eliminate the ``u <= 1e-7`` test: Instead of: elif alpha == 1.0: # expovariate(1) u = random() while u <= 1e-7: u = random() return -_log(u) * beta Use this instead: elif alpha == 1.0: # expovariate(1.0 / beta) return -_log(1.0 - random()) * beta ---------- messages: 295102 nosy: leodema priority: normal severity: normal status: open title: sync-up gammavariate and expovariate code type: performance _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 3 17:15:42 2017 From: report at bugs.python.org (Allan Crooks) Date: Sat, 03 Jun 2017 21:15:42 +0000 Subject: [New-bugs-announce] [issue30562] SSL socket does not respect SO_RCVTIME0 timeouts Message-ID: <1496524542.15.0.101995784955.issue30562@psf.upfronthosting.co.za> New submission from Allan Crooks: I initially filed this ticket against the ldap3 library, as this is where I first encountered the issue: https://github.com/cannatag/ldap3/issues/356 I've attached a file which reproduces the issue using the standard library - it makes both a HTTP and HTTPS request to a link that should return a HTTP response after 10 seconds, but we set the socket option SO_RCVTIMEO to 2 seconds. This should result in a read timeout while waiting for a response. On my 64 bit Ubuntu 16.04 machine, the HTTP connection times out as expected, but the HTTPS connection doesn't time out at all (and so ends up reading the HTTP response). It doesn't seem to be an issue specific to HTTPS - I ran into the original issue while using TLS for an LDAP connection using the ldap3 library. If you follow the comments in the ticket, a connection with SO_RCVTIMEO set to 3 seconds ended up taking 1076 seconds to timeout, while on an OSX machine, it took 148 seconds to timeout. On a Windows machine, it seems to work just fine (it timed out after the desired 3 seconds). Is this option fully supported for SSL sockets? ---------- assignee: christian.heimes components: SSL files: httpdelay.py messages: 295106 nosy: allanc, christian.heimes priority: normal severity: normal status: open title: SSL socket does not respect SO_RCVTIME0 timeouts type: behavior versions: Python 2.7, Python 3.5 Added file: http://bugs.python.org/file46922/httpdelay.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 4 02:54:26 2017 From: report at bugs.python.org (Julien Verger) Date: Sun, 04 Jun 2017 06:54:26 +0000 Subject: [New-bugs-announce] [issue30563] multiprocessing module with pool object issue Message-ID: <1496559266.31.0.239393976491.issue30563@psf.upfronthosting.co.za> New submission from Julien Verger: Hello, i'm trying to use the sample code that is documented here: https://docs.python.org/2/library/multiprocessing.html from multiprocessing import Pool def f(x): return x*x if __name__ == '__main__': p = Pool(5) print(p.map(f, [1, 2, 3])) This code behaves differently depending on the python version that i use. I use 2 versions of python interpreter, first on my windows 7 OS and second in cygwin. The code behaves normaly when i execute it on windows python version, but nothing seems to happen when i use python interpreter from cygwin. Other objects than 'pool' seems to be impacted but this short exemple helps me to show how to reproduce quickly my issue. Here are somme informations on the python versions that i'm using: On the windows side: Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. On the cygwin side: Python 2.7.13 (default, Mar 13 2017, 20:56:15) [GCC 5.4.0] on cygwin Type "help", "copyright", "credits" or "license" for more information. Please help Regards ---------- components: Library (Lib) messages: 295114 nosy: Julien Verger priority: normal severity: normal status: open title: multiprocessing module with pool object issue type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 4 03:59:06 2017 From: report at bugs.python.org (Monty Evans) Date: Sun, 04 Jun 2017 07:59:06 +0000 Subject: [New-bugs-announce] [issue30564] Base64 decoding gives incorrect outputs. Message-ID: <1496563146.86.0.359393365699.issue30564@psf.upfronthosting.co.za> Changes by Monty Evans : ---------- nosy: ShiftedBit priority: normal severity: normal status: open title: Base64 decoding gives incorrect outputs. type: behavior versions: Python 2.7, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 4 05:57:45 2017 From: report at bugs.python.org (Nick Coghlan) Date: Sun, 04 Jun 2017 09:57:45 +0000 Subject: [New-bugs-announce] [issue30565] PEP 538: default to skipping warning for implicit locale coercion? Message-ID: <1496570265.14.0.856980503052.issue30565@psf.upfronthosting.co.za> New submission from Nick Coghlan: This is a follow-up to PEP 538 that reflects the uncertainty over whether or not the warning on *successful* implicit locale coercion is a good idea. The argument for this warning is that it alerts redistributors, system integrators, and application developers to the fact that LC_CTYPE may not be what they expect it to be. The argument against it is that in many, and potentially even most, cases where the warning is omitted, there won't be any subsequent problems, and so the warning qualifies as a false alarm (especially for end users of applications that just happen to be written in Python), and the PEP 538 section in the .37 What's New, together with the fact that "LC_CTYPE=C.UTF-8" (or similar) appears in the process environment can be considered sufficient notice of the change for debugging purposes. The initial PEP 538 implementation at https://github.com/python/cpython/pull/659 includes the warning, this issue reflects the possibility that we may decide to reverse that decision prior to the release of Python 3.7.0. ---------- assignee: ncoghlan messages: 295120 nosy: ncoghlan priority: normal severity: normal status: open title: PEP 538: default to skipping warning for implicit locale coercion? type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 4 11:49:54 2017 From: report at bugs.python.org (Vikram Hegde) Date: Sun, 04 Jun 2017 15:49:54 +0000 Subject: [New-bugs-announce] [issue30566] punycode codec raises IndexError in decode_generalized_number() Message-ID: <1496591394.26.0.00653153658066.issue30566@psf.upfronthosting.co.za> New submission from Vikram Hegde: Here is the relevant code snippet from decode_generalized_number() in punycode.py try: char = ord(extended[extpos]) except IndexError: if errors == "strict": raise UnicodeError("incomplete punicode string") return extpos + 1, None extpos += 1 if 0x41 <= char <= 0x5A: # A-Z digit = char - 0x41 elif 0x30 <= char <= 0x39: digit = char - 22 # 0x30-26 elif errors == "strict": raise UnicodeError("Invalid extended code point '%s'" % extended[extpos]) While raising the UnicodeError() in the last line above, it accesses extended[extpos]. However extpos was incremented by 1 a few lines above that. This causes two errors: 1) The UnicodeError() prints the wrong character (the one after the character we want) 2) If the previous extpos was the last character in the string, then attempting to print character at extpos+1 will raise an IndexError. ---------- components: Library (Lib) messages: 295127 nosy: Vikram Hegde priority: normal severity: normal status: open title: punycode codec raises IndexError in decode_generalized_number() type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 4 13:20:58 2017 From: report at bugs.python.org (Segev Finer) Date: Sun, 04 Jun 2017 17:20:58 +0000 Subject: [New-bugs-announce] [issue30567] Leak in sys.getwindowsversion Message-ID: <1496596858.95.0.123933382892.issue30567@psf.upfronthosting.co.za> New submission from Segev Finer: There is a ref leak in sys.getwindowsversion due to using PyTuple_Pack and forgetting that it increments the ref count of passed in objects. Found here: https://github.com/python/cpython/pull/1927#issuecomment-306019512. Clearly shows up in python -m test -R 3:2 test_sys ---------- components: Interpreter Core messages: 295132 nosy: Segev Finer priority: normal severity: normal status: open title: Leak in sys.getwindowsversion type: resource usage versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 4 16:02:18 2017 From: report at bugs.python.org (James Lu) Date: Sun, 04 Jun 2017 20:02:18 +0000 Subject: [New-bugs-announce] [issue30568] README Formatting Message-ID: <1496606538.63.0.614342546478.issue30568@psf.upfronthosting.co.za> New submission from James Lu: - Shorten the Copyright statement from a list of years (`2001, 2002, 2003, ... 2017`) into `2001-2017` - Extend copyright date at end of README from 2016 to 2017 - Ensure that there are two newlines before every header throughout the file (this was the original format) ---------- assignee: docs at python components: Documentation messages: 295140 nosy: James.Lu, docs at python priority: normal pull_requests: 2020 severity: normal status: open title: README Formatting type: enhancement versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 4 16:52:33 2017 From: report at bugs.python.org (Cheryl Sabella) Date: Sun, 04 Jun 2017 20:52:33 +0000 Subject: [New-bugs-announce] [issue30569] Tutorial section 2.1 has *nix example at 3.7, but Windows at 3.6 Message-ID: <1496609553.39.0.613003310721.issue30569@psf.upfronthosting.co.za> New submission from Cheryl Sabella: https://docs.python.org/3.7/tutorial/interpreter.html The first lines for the location/command have been updated for 3.7, but next paragraph for Windows has not been updated. ---------- assignee: docs at python components: Documentation messages: 295142 nosy: csabella, docs at python priority: normal severity: normal status: open title: Tutorial section 2.1 has *nix example at 3.7, but Windows at 3.6 type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 4 20:25:34 2017 From: report at bugs.python.org (Daniel Lepage) Date: Mon, 05 Jun 2017 00:25:34 +0000 Subject: [New-bugs-announce] [issue30570] issubclass segfaults on objects with weird __getattr__ Message-ID: <1496622334.44.0.71686890535.issue30570@psf.upfronthosting.co.za> New submission from Daniel Lepage: The following code causes a segmentation fault: class Failure(object): def __getattr__(self, attr): return (self, None) issubclass(Failure(), int) I am running a macbook pro, OS X 10.12.4, and have observed the problem in python 3.5.2, 3.6.0, and 3.6.1. It appears that returning (self,) causes it to go into an infinite loop attempting to get `x.__bases__`, and returning `(self, y)` for any value `y` causes it to attempt to get `x.__bases__` 262,030 times and then segfault. A crash log is attached. ---------- components: Interpreter Core files: segfault.crash messages: 295150 nosy: Daniel Lepage priority: normal severity: normal status: open title: issubclass segfaults on objects with weird __getattr__ type: crash versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file46924/segfault.crash _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 5 00:03:26 2017 From: report at bugs.python.org (Raymond Hettinger) Date: Mon, 05 Jun 2017 04:03:26 +0000 Subject: [New-bugs-announce] [issue30571] Add integer formatting code for fixed-width signed arithmetic (2's complement) Message-ID: <1496635406.76.0.985439209964.issue30571@psf.upfronthosting.co.za> New submission from Raymond Hettinger: The current 'b' formatting code in inconvenient for emulating, demonstrating, and teaching two's complement arithmetic. The problem is that negative inputs are always formatted with a minus sign. I propose that some formatting code be provided for fixed-width display where the leading bit is a sign bit. For example, if code were a capital 'B' and the total width were 8-bits: >>> x = -12 >>> format(12, '08B') '11110100' Currently, to achieve the same effect, one of the following is used: >>> format(x if x >= 0 else x + 2**8, '08b') '11110100' or >>> format(x & (2**8 - 1), '08b') '11110100' For values outside the valid range, perhaps a ValueError could be raised: >>> format(-200, '08B') Traceback (most recent call last): ... ValueError: Expected value in range -128 <= x < 128, not -200 I'm not sure what the right code should be. The idea of capital 'B' is attractive, but we already have a different relationship between 'X' and 'x'. There could also be a modifier symbol such as '!' in '!8b'. ---------- components: Interpreter Core messages: 295162 nosy: mark.dickinson, rhettinger, talin priority: low severity: normal status: open title: Add integer formatting code for fixed-width signed arithmetic (2's complement) type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 5 08:22:23 2017 From: report at bugs.python.org (Dingo64) Date: Mon, 05 Jun 2017 12:22:23 +0000 Subject: [New-bugs-announce] [issue30572] pip is broken Message-ID: <1496665343.57.0.155751433237.issue30572@psf.upfronthosting.co.za> New submission from Dingo64: C:\Python35>pip install dlib-19.4.0-cp35-cp35m-win_amd64.whl dlib-19.4.0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform. How can it be not supported when I have Python 3.5 on AMD64 Windows machine? C:\Python35>wmic os get osarchitecture OSArchitecture 64-bit C:\Python35>python --version Python 3.5.0 ---------- components: Installation messages: 295180 nosy: Dingo64 priority: normal severity: normal status: open title: pip is broken type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 5 08:30:59 2017 From: report at bugs.python.org (Dingo64) Date: Mon, 05 Jun 2017 12:30:59 +0000 Subject: [New-bugs-announce] [issue30573] How to install cmake? Message-ID: <1496665859.62.0.439611953284.issue30573@psf.upfronthosting.co.za> New submission from Dingo64: When I try to use pip to install something it says it cannot because it doesn't make cmake. When I try to install cmake: C:\Python35>pip3 install cmake Collecting cmake Downloading cmake-0.7.0.tar.gz (29.2MB) 100% |################################| 29.2MB 14kB/s Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 20, in File "C:\Users\7\AppData\Local\Temp\pip-build-kudn0eog\cmake\setup.py", li ne 7, in from skbuild import setup ImportError: No module named 'skbuild' ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in C:\Users\7\AppDat a\Local\Temp\pip-build-kudn0eog\cmake You are using pip version 7.1.2, however version 9.0.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' comm and. C:\Python35>pip3 install skbuild Collecting skbuild Could not find a version that satisfies the requirement skbuild (from versions : ) No matching distribution found for skbuild ---------- messages: 295182 nosy: Dingo64 priority: normal severity: normal status: open title: How to install cmake? type: compile error versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 5 09:47:58 2017 From: report at bugs.python.org (Decorater) Date: Mon, 05 Jun 2017 13:47:58 +0000 Subject: [New-bugs-announce] [issue30574] Document why embedding the interpreter can sometimes crash. Message-ID: <1496670478.12.0.928840980105.issue30574@psf.upfronthosting.co.za> New submission from Decorater: According to this example at https://docs.python.org/3/extending/embedding.html#very-high-level-embedding you can use something similar on embedding the interpreter. However for some reason it can crash on Windows and probably some other platforms no matter what python code you enter in the string. I am currently getting that issue on Windows even with the python DLL's being in the same folder of the embedded executable it seems (when I open the crash dump in VS2010 express) that it tried to access an memory address that it has no permissions to. However I have been thinking as to why that might be. The system should have plenty of memory left for it to allocate and run just fine unless it wants to use an already active python process (why would that be when other applications that embed the interpreter seem to work just fine). I think documenting there on when and iff the compiled code crashes with suggestions on how to fix them would be best to do on the page. it could be that the example actually compiles but does not work anymore too. But why would it be on the page if it would compile but crash on any string put into it? Something makes me think the crash is on the Py_DecodeLocale line with the size_t * param being NULL. ---------- assignee: docs at python components: Documentation, Windows messages: 295187 nosy: Decorater, docs at python, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Document why embedding the interpreter can sometimes crash. versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 5 12:28:08 2017 From: report at bugs.python.org (Yibo Wang) Date: Mon, 05 Jun 2017 16:28:08 +0000 Subject: [New-bugs-announce] [issue30575] Python interpreter crashes on macOS Message-ID: <1496680088.08.0.654208727312.issue30575@psf.upfronthosting.co.za> New submission from Yibo Wang: I am writing python wrapper for rust library, everything goes fine until execution finishes. "Python quit unexpectedly" [1] 25805 segmentation fault python3 To reproduce, download code from GitHub repo provided by this blog(https://kushaldas.in/posts/writing-python-extensions-in-rust.html), then follow the section "Building the Python extension". macOS Sierra 10.12.5 (16F73) Python 3.6.1 via Homebrew rustc 1.17.0 (56124baa9 2017-04-24) (This issue won't appear on Windows 10 and Ubuntu 16.04) ---------- components: macOS messages: 295203 nosy: Yibo Wang, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Python interpreter crashes on macOS type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 5 15:42:04 2017 From: report at bugs.python.org (Pierre Quentel) Date: Mon, 05 Jun 2017 19:42:04 +0000 Subject: [New-bugs-announce] [issue30576] http.server should support HTTP compression (gzip) Message-ID: <1496691724.59.0.955308322691.issue30576@psf.upfronthosting.co.za> New submission from Pierre Quentel: The server in http.server currently doesn't support HTTP compression. I propose to implement it in the method send_head() of SimpleHTTPRequestHandler this way : for each GET request, if the request header "Accept-Encoding" is present and includes "gzip" among the possible compression schemes, and if the Content-Type determined by the file extension is in a list compressed_types, then the server sends the "Content-Encoding" response header to "gzip" and send_head() returns a file object with the gzipped value. compressed_types is an attribute of the SimpleHTTPRequestHandler class and is set by default to ["text/plain", "text/html", "text/css", "text/xml", "text/javascript", "application/javascript", "application/json"]. The implementation is very simple (a few lines of code). I also propose to modify mimetypes to add the mapping of extension ".json" to "application/json". I will make a Pull Request on the CPython Github site with these changes. ---------- components: Library (Lib) messages: 295207 nosy: quentel priority: normal severity: normal status: open title: http.server should support HTTP compression (gzip) versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 5 19:56:16 2017 From: report at bugs.python.org (Fengyang Wang) Date: Mon, 05 Jun 2017 23:56:16 +0000 Subject: [New-bugs-announce] [issue30577] Multidimensional comprehensions cannot access class variables except in the first for Message-ID: <1496706976.92.0.429062921654.issue30577@psf.upfronthosting.co.za> New submission from Fengyang Wang: Reduced reproduction: class X: r = [1, 2, 3] z = [(i, j) for i in [4, 5] for j in r] fails with "NameError: name 'r' is not defined". The expected behavior would be for r to be resolved as the r in the class namespace. Note in contrast that class Y: r = [1, 2, 3] z = [(i, j) for j in r for i in [4, 5]] does not fail. (Version 3.5.2 on Windows) ---------- components: Interpreter Core messages: 295220 nosy: fengyang.wang priority: normal severity: normal status: open title: Multidimensional comprehensions cannot access class variables except in the first for type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 5 22:44:33 2017 From: report at bugs.python.org (Nick Coghlan) Date: Tue, 06 Jun 2017 02:44:33 +0000 Subject: [New-bugs-announce] [issue30578] Misleading example in sys.set_coroutine_wrapper docs Message-ID: <1496717073.05.0.260137843936.issue30578@psf.upfronthosting.co.za> New submission from Nick Coghlan: In issue 24342, the invocation of coroutine wrappers specified via sys.set_coroutine_wrapper was fixed to catch and report the case of infinite recursion, where the wrapper attempts to instantiate a nested coroutine (which would call the wrapper, which would attempt to instantiate the coroutine, etc, etc) The docs for sys.set_coroutine_wrapper include an example of this failure case: https://docs.python.org/3/library/sys.html#sys.set_coroutine_wrapper However, if you're not reading carefully, it looks like an example of how to *use* sys.set_coroutine_wrapper, rather than an example of a case that won't work. It would be better to include an example that either doesn't wrap the coroutine at all, or else uses one of the non-native coroutine emulations to avoid the infinite recursion problem: ``` import asyncio, sys def wrapper(coro): @asyncio.coroutine def wrap(coro): print("Coroutine started") result = yield from coro print("Coroutine finished") return result return wrap(coro) sys.set_coroutine_wrapper(wrapper) async def foo(): print("Coroutine running") return "Coroutine result" import asyncio asyncio.get_event_loop().run_until_complete(foo()) ``` Also related: I discovered in writing this that "sys.set_coroutine_wrapper(None)" doesn't actually turn off coroutine wrapping. Instead, you still get this exception when attempting to recursively define an unwrapped one: RuntimeError: coroutine wrapper attempted to recursively wrap ", line 2>) That error was produced as follows: ``` import sys, contextlib @contextlib.contextmanager def disable_coroutine_wrapping(): wrapper = sys.get_coroutine_wrapper() sys.set_coroutine_wrapper(None) try: yield finally: sys.set_coroutine_wrapper(wrapper) def wrapper(coro): async def wrap(coro): print("Coroutine started") result = await coro print("Coroutine finished") return result with disable_coroutine_wrapping(): return wrap(coro) sys.set_coroutine_wrapper(wrapper) async def foo(): print("Coroutine running") return "Coroutine result" import asyncio asyncio.get_event_loop().run_until_complete(foo()) ``` ---------- assignee: docs at python components: Documentation messages: 295231 nosy: docs at python, giampaolo.rodola, haypo, ncoghlan, yselivanov priority: normal severity: normal stage: needs patch status: open title: Misleading example in sys.set_coroutine_wrapper docs type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 5 23:41:53 2017 From: report at bugs.python.org (Nathaniel Smith) Date: Tue, 06 Jun 2017 03:41:53 +0000 Subject: [New-bugs-announce] [issue30579] Allow traceback objects to be instantiated/mutated/annotated Message-ID: <1496720513.53.0.619437315354.issue30579@psf.upfronthosting.co.za> New submission from Nathaniel Smith: Currently, traceback objects don't expose any public constructor, are immutable, and don't have a __dict__ or allow subclassing, which makes it impossible to add extra annotations them. It would be nice if these limitations were lifted, because there are rare but important cases where code needs to manipulate tracebacks directly, and currently these have to use awful stuff like ctypes. For example: Jinja2: https://github.com/pallets/jinja/blob/bec0065c4e7e89e7d893eda7840ba0219824b23c/jinja2/debug.py#L298-L372 Trio: https://github.com/python-trio/trio/blob/496493afecc22d7d1a17175b6a2748a9c3510066/trio/_core/_multierror.py#L233-L318 (Notice that on PyPy there are no ctypes, but instead they have special extension that's supported for this case only to keep jinja2 working.) For the above cases, what's needed is the ability to instantiate and assign to the fields of traceback objects. In addition, in trio I'd like to be able to annotate traceback objects so that the traceback printing machinery can do things like hide "internal" tracebacks, or highlight places where exceptions jumped between tasks. This would be much easier if there were some way to attach data to tracebacks. Probably it doesn't make sense for traceback objects to have a __dict__ by default for speed/memory reasons, but we could add a dedicated metadata slot that is normally empty but can have arbitrary data assigned, or if they allowed subclassing then I could add a __dict__ in a subclass I'm CC'ing the "import machinery" interest list, because my understanding is that with the new import system there's a similar desire to hide "internal" traceback frames, and while the features requested in this bug report won't solve that problem directly they might (are intended to) provide some useful machinery for it. Feel free to un-CC if I'm wrong :Jinja2: https://github.com/pallets/jinja/blob/bec0065c4e7e89e7d893eda7840ba0219824b23c/jinja2/debug.py#L298-L372 -). I think that this should be very straightforward to implement: it's just that no-one ever implemented setters etc. for tracebacks. ---------- components: Interpreter Core messages: 295235 nosy: brett.cannon, eric.snow, ncoghlan, njs priority: normal severity: normal status: open title: Allow traceback objects to be instantiated/mutated/annotated type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 6 08:34:54 2017 From: report at bugs.python.org (Nils Lindemann) Date: Tue, 06 Jun 2017 12:34:54 +0000 Subject: [New-bugs-announce] [issue30580] WSGI examples raise AttributeError: __exit__ Message-ID: <1496752494.94.0.587385465259.issue30580@psf.upfronthosting.co.za> New submission from Nils Lindemann: All examples on https://docs.python.org/3/library/wsgiref.html raise this exception: Traceback (most recent call last): File "C:\Code\test\server.py", line 110, in with make_server('', 8000, simple_app) as httpd: AttributeError: __exit__ Tested with Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 ---------- messages: 295253 nosy: Nils-Hero priority: normal severity: normal status: open title: WSGI examples raise AttributeError: __exit__ versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 6 08:49:39 2017 From: report at bugs.python.org (robbuckley) Date: Tue, 06 Jun 2017 12:49:39 +0000 Subject: [New-bugs-announce] [issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors Message-ID: <1496753379.54.0.823104830335.issue30581@psf.upfronthosting.co.za> New submission from robbuckley: os.cpu_count() seems to report incorrect values on windows systems with >64 logical processors tried it on 2 similar systems, both running windows 7 / 10 with python 3.6.1 64bit (anaconda): platform1 - 2x Xeon E5-2698v4. 20 cores/CPU = total 80 logical cpus with hyperthreading platform2 - 2x Xeon E5-2697v3. 14 cores/CPU = total 56 logical cpus with hyperthreading os.cpu_count() reports 40 cores on platform1 and 56 on platform2 I would expect 80 and 56 respectively. I suppose this is because the windows api call used is not aware of processor groups, and reports only the number of processors in the current processor group ( eg GetSystemInfo vs GetMaximumProcessorCount ) ---------- components: Windows messages: 295254 nosy: paul.moore, robbuckley, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 6 09:53:30 2017 From: report at bugs.python.org (Tal Kogan) Date: Tue, 06 Jun 2017 13:53:30 +0000 Subject: [New-bugs-announce] [issue30582] Incorrect propagation in logging.wheb creating lighters in a certain order Message-ID: <1496757210.37.0.331930317615.issue30582@psf.upfronthosting.co.za> New submission from Tal Kogan: Creating a logger at level 3 and below and then creating a logger at level 1 will not correctly set the parent logger for the 3rd level logger. import logging log_c = logging.getLogger('a.b.c') log_a = logging.getLogger('a') log_c.error("spam") # Doesn't showa ---------- components: Library (Lib) messages: 295262 nosy: Tal Kogan priority: normal severity: normal status: open title: Incorrect propagation in logging.wheb creating lighters in a certain order type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 6 13:27:29 2017 From: report at bugs.python.org (wim glenn) Date: Tue, 06 Jun 2017 17:27:29 +0000 Subject: [New-bugs-announce] [issue30583] docs mention datetuil presumably it should be dateutil Message-ID: <1496770049.03.0.569012645786.issue30583@psf.upfronthosting.co.za> New submission from wim glenn: Typo from https://github.com/python/cpython/commit/94c8a3f91fbba72845706853d28bd5af8fc11875#diff-5a85d656ffad06e86bee33767ae24f33R1852 went unnoticed and is present in official docs https://docs.python.org/3.6/library/datetime.html#tzinfo-objects https://docs.python.org/3.7/library/datetime.html#tzinfo-objects ---------- messages: 295279 nosy: wim.glenn priority: normal severity: normal status: open title: docs mention datetuil presumably it should be dateutil versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 7 03:39:23 2017 From: report at bugs.python.org (Denis Osipov) Date: Wed, 07 Jun 2017 07:39:23 +0000 Subject: [New-bugs-announce] [issue30584] test_os fails on non-English (Russian) Windows Message-ID: <1496821163.8.0.241148969733.issue30584@psf.upfronthosting.co.za> New submission from Denis Osipov: test_os fails on non-English (Russian) Windows 7 Home Extended 6.1.7601 x64 ====================================================================== ERROR: test_access_denied (test.test_os.StatAttributeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\repos\cpython\lib\test\test_os.py", line 476, in test_access_denied creationflags=DETACHED_PROCESS File "C:\repos\cpython\lib\subprocess.py", line 293, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['icacls.exe', 'C:\\Users\\User\ \AppData\\Local\\Temp\\@test_6804_tmp', '/deny', 'Users:(S)']' returned non-zero exit status 1332. ---------------------------------------------------------------------- Ran 250 tests in 5.120s FAILED (errors=1, skipped=92) test_os failed 1 test failed: test_os Total duration: 5 sec Tests result: FAILURE There is no group BUILTIN\Users on my Windows. There is BUILTIN\???????????? instead. ---------- components: Tests messages: 295315 nosy: denis-osipov priority: normal severity: normal status: open title: test_os fails on non-English (Russian) Windows type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 7 04:36:32 2017 From: report at bugs.python.org (STINNER Victor) Date: Wed, 07 Jun 2017 08:36:32 +0000 Subject: [New-bugs-announce] [issue30585] [security][3.3] Backport smtplib fix for TLS stripping vulnerability, CVE-2016-0772 Message-ID: <1496824592.96.0.351417246075.issue30585@psf.upfronthosting.co.za> New submission from STINNER Victor: Attached pull request backports a fix for this security vulnerability: http://python-security.readthedocs.io/vuln/cve-2016-0772_smtplib_tls_stripping.html "A vulnerability in smtplib allowing MITM attacker to perform a startTLS stripping attack. smtplib does not seem to raise an exception when the remote end (SMTP server) is capable of negotiating starttls but fails to respond with 220 (ok) to an explicit call of SMTP.starttls(). This may allow a malicious MITM to perform a startTLS stripping attack if the client code does not explicitly check the response code for startTLS." Reported by: Tin (Team Oststrom) Python 2.7, 3.4, 3.5 and 3.6 are already safe. ---------- messages: 295319 nosy: georg.brandl, haypo priority: release blocker pull_requests: 2047 severity: normal status: open title: [security][3.3] Backport smtplib fix for TLS stripping vulnerability, CVE-2016-0772 type: security versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 7 07:41:40 2017 From: report at bugs.python.org (Vladimir Filippov) Date: Wed, 07 Jun 2017 11:41:40 +0000 Subject: [New-bugs-announce] [issue30586] Encode to EBCDIC doesn't take into account conversion table irregularities Message-ID: <1496835700.1.0.322760581427.issue30586@psf.upfronthosting.co.za> New submission from Vladimir Filippov: These 4 symbols were encoded incorrectly to EBCDIC (codec cp500): "![]|". Correct table of conversation for these symbols described in https://www.ibm.com/support/knowledgecenter/SSZJPZ_11.3.0/com.ibm.swg.im.iis.ds.parjob.adref.doc/topics/r_deeadvrf_Conversion_Table_Irregularities.html This code: -------------------- ascii = '![]|'; print("ASCII: " + bytes(ascii, 'ascii').hex()) res = ascii.encode('cp500') print ("EBCDIC: " +res.hex()) -------------------- on Python 3.6.1 produce this output: -------------------- ASCII: 215b5d7c EBCDIC: 4f4a5abb -------------------- Expected encoding (from IBM's table): ! - 5A [ - AD ] - BD | - 4F Workaround: use this translation after encoding bytes.maketrans(b'\x4F\x4A\x5A\xBB', b'\x5A\xAD\xBD\x4F') ---------- components: Unicode messages: 295329 nosy: Vladimir Filippov, ezio.melotti, haypo priority: normal severity: normal status: open title: Encode to EBCDIC doesn't take into account conversion table irregularities type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 7 08:04:06 2017 From: report at bugs.python.org (Claudiu Belu) Date: Wed, 07 Jun 2017 12:04:06 +0000 Subject: [New-bugs-announce] [issue30587] Mock with spec object does not ensure method call signatures Message-ID: <1496837046.98.0.920527641247.issue30587@psf.upfronthosting.co.za> New submission from Claudiu Belu: Mock can accept a spec object / class as argument, making sure that accessing attributes that do not exist in the spec will cause an AttributeError to be raised, but there is no guarantee that the spec's methods signatures are respected in any way. This creates the possibility to have faulty code with passing unittests and assertions. Steps to reproduce: >>> import mock >>> >>> class Something(object): ... def foo(self, a, b, c, d): ... pass ... >>> >>> m = mock.Mock(spec=Something) >>> m.foo() >>> # TypeError should be raised, but it isn't. ... >>> m.foo.assert_called_once_with() Expected behaviour: It should have raised a TypeError, since the method signature is: def meth(self, a, b, c, d): Actual behaviour: No error. ---------- components: Library (Lib) messages: 295335 nosy: cbelu priority: normal pull_requests: 2051 severity: normal status: open title: Mock with spec object does not ensure method call signatures type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 7 11:02:55 2017 From: report at bugs.python.org (Matthieu Dartiailh) Date: Wed, 07 Jun 2017 15:02:55 +0000 Subject: [New-bugs-announce] [issue30588] Missing documentation for codecs.escape_decode Message-ID: <1496847775.57.0.842403144977.issue30588@psf.upfronthosting.co.za> New submission from Matthieu Dartiailh: codecs.escape_decode does not appear in the codecs documentation. This function is to my knowledge the only convenient way to process the escaped characters in a literal string (actually found here https://stackoverflow.com/questions/4020539/process-escape-sequences-in-a-string-in-python). It is most useful when implementing a parser for a language extending python semantic while retaining python processing of string (cf https://github.com/MatthieuDartiailh/enaml). Is there a reason for that function not being documented ? ---------- assignee: docs at python components: Documentation messages: 295342 nosy: docs at python, mdartiailh priority: normal severity: normal status: open title: Missing documentation for codecs.escape_decode versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 7 11:21:05 2017 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 07 Jun 2017 15:21:05 +0000 Subject: [New-bugs-announce] [issue30589] With forkserver, Process.exitcode does not get signal number Message-ID: <1496848865.75.0.934922267474.issue30589@psf.upfronthosting.co.za> New submission from Antoine Pitrou: The documentation for multiprocessing.exitcode says: """ The child?s exit code. This will be None if the process has not yet terminated. A negative value -N indicates that the child was terminated by signal N. """ This is true for the "fork" method, but not "forkserver" where a child terminated by a signal will get an exitcode of 255. This is because forkserver relies on the child writing its own exit code in a pipe, which obviously doesn't work if it was killed (255 is simply a fallback value). See forkserver's Popen.poll(): def poll(self, flag=os.WNOHANG): if self.returncode is None: from multiprocessing.connection import wait timeout = 0 if flag == os.WNOHANG else None if not wait([self.sentinel], timeout): return None try: self.returncode = forkserver.read_unsigned(self.sentinel) except (OSError, EOFError): # The process ended abnormally perhaps because of a signal self.returncode = 255 return self.returncode ---------- components: Library (Lib) messages: 295343 nosy: davin, pitrou, sbt priority: normal severity: normal status: open title: With forkserver, Process.exitcode does not get signal number type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 7 12:39:08 2017 From: report at bugs.python.org (Carmen Bianca Bakker) Date: Wed, 07 Jun 2017 16:39:08 +0000 Subject: [New-bugs-announce] [issue30590] str.format no longer accepts unpacked defaultdict for default values Message-ID: <1496853548.43.0.683840894266.issue30590@psf.upfronthosting.co.za> New submission from Carmen Bianca Bakker: As brief as can be, the following script works in Python 3.4 and Python 3.5: from collections import defaultdict mydict = defaultdict(lambda: 'default') print('{foo}'.format(**mydict)) And prints "default". In Python 3.6, you get a KeyError for foo. ---------- components: Library (Lib) messages: 295353 nosy: carmenbianca priority: normal severity: normal status: open title: str.format no longer accepts unpacked defaultdict for default values versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 7 12:40:44 2017 From: report at bugs.python.org (Jonathan Eunice) Date: Wed, 07 Jun 2017 16:40:44 +0000 Subject: [New-bugs-announce] [issue30591] textwrap: placeholder backtracking special case lacks test coverage Message-ID: <1496853644.82.0.945578102989.issue30591@psf.upfronthosting.co.za> New submission from Jonathan Eunice: A rare case in textwrap when max_lines insufficient and textwrap needs to backtrack to a previous line to add the placeholder seems to lack test coverage. This issue added as prereq for suggesting an additional test. PR imminent. Code: Lib/textwrap.py (as is) Test: Lib/test/test_textwrap.py (extended) ---------- components: Tests messages: 295354 nosy: jonathaneunice priority: normal severity: normal status: open title: textwrap: placeholder backtracking special case lacks test coverage type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 7 16:18:16 2017 From: report at bugs.python.org (SylvainDe) Date: Wed, 07 Jun 2017 20:18:16 +0000 Subject: [New-bugs-announce] [issue30592] Bad error message 'bool()() takes no keyword arguments' Message-ID: <1496866696.02.0.805235407001.issue30592@psf.upfronthosting.co.za> New submission from SylvainDe: Very recent "regression". Issue found because of a pet project trying to parse error messages using regexps : more on https://github.com/SylvainDe/DidYouMean-Python/issues/31 . On recent Cron builds on Jenkins, running the following code bool(this_doesnt_exist=2) fails with the following error message 'bool()() takes no keyword arguments' instead of the expected error message 'bool() takes no keyword arguments'. Having a quick look at the recent commits, I suspect with no guarantee whatsoever the issue got introduced with https://github.com/python/cpython/commit/5eb788bf7f54a8e04429e18fc332db858edd64b6 / http://bugs.python.org/issue30534 . I haven't tried to reproduce the issue locally yet and add the findinds if any later on. ---------- messages: 295366 nosy: SylvainDe priority: normal severity: normal status: open title: Bad error message 'bool()() takes no keyword arguments' type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 7 18:26:12 2017 From: report at bugs.python.org (Noah Levitt) Date: Wed, 07 Jun 2017 22:26:12 +0000 Subject: [New-bugs-announce] [issue30593] sqlite3 executescript does not respect isolation_level? Message-ID: <1496874372.71.0.386718396878.issue30593@psf.upfronthosting.co.za> New submission from Noah Levitt: As far as I can tell, sqlite3 executescript() does not respect isolation_level. Is that true? If so, I think it's worth mentioning in the doc. Or maybe it should respect isolation_level, not sure there's any particular reason not to. ---------- components: Library (Lib) messages: 295376 nosy: Noah Levitt priority: normal severity: normal status: open title: sqlite3 executescript does not respect isolation_level? versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 02:13:35 2017 From: report at bugs.python.org (Nathaniel Smith) Date: Thu, 08 Jun 2017 06:13:35 +0000 Subject: [New-bugs-announce] [issue30594] Refcounting mistake in _ssl.c Message-ID: <1496902415.3.0.68832586927.issue30594@psf.upfronthosting.co.za> New submission from Nathaniel Smith: If you pass a server_hostname= that fails IDNA decoding to SSLContext.wrap_socket or SSLContext.wrap_bio, then the SSLContext object has a spurious Py_DECREF called on it, eventually leading to segfaults. Demo attached. ---------- assignee: christian.heimes components: SSL files: demo.py messages: 295380 nosy: alex, christian.heimes, dstufft, janssen, njs priority: normal severity: normal status: open title: Refcounting mistake in _ssl.c type: crash versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46932/demo.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 03:40:26 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 08 Jun 2017 07:40:26 +0000 Subject: [New-bugs-announce] [issue30595] test_queue_feeder_donot_stop_onexc() of test_multiprocessing_spawn fails randomly on x86 Windows7 3.x Message-ID: <1496907626.7.0.367274651848.issue30595@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/712/steps/test/logs/stdio ====================================================================== ERROR: test_queue_feeder_donot_stop_onexc (test.test_multiprocessing_spawn.WithProcessesTestQueue) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\_test_multiprocessing.py", line 767, in test_queue_feeder_donot_stop_onexc self.assertTrue(q.get(timeout=0.1)) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\multiprocessing\queues.py", line 105, in get raise Empty queue.Empty ---------- components: Tests, Windows messages: 295385 nosy: davin, haypo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: test_queue_feeder_donot_stop_onexc() of test_multiprocessing_spawn fails randomly on x86 Windows7 3.x versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 06:25:03 2017 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 08 Jun 2017 10:25:03 +0000 Subject: [New-bugs-announce] [issue30596] Add close() to multiprocessing.Process Message-ID: <1496917503.87.0.727609845407.issue30596@psf.upfronthosting.co.za> New submission from Antoine Pitrou: multiprocessing.Process (actually, the _popen object attached to it) has a GC-based finalizer to release system resources (such as fds). However, it would be nice to be able to release those resources in a timely manner. Adding a close() method would let users do that. What do you think? ---------- components: Library (Lib) messages: 295396 nosy: davin, pitrou priority: normal severity: normal stage: needs patch status: open title: Add close() to multiprocessing.Process type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 06:36:46 2017 From: report at bugs.python.org (Nick Coghlan) Date: Thu, 08 Jun 2017 10:36:46 +0000 Subject: [New-bugs-announce] [issue30597] Show expected input in custom "print" error message Message-ID: <1496918206.6.0.484368054025.issue30597@psf.upfronthosting.co.za> New submission from Nick Coghlan: Back when we added the custom error message for missing parentheses in print calls, I also pre-seeded an explanation of the error on Stack Overflow: https://stackoverflow.com/questions/25445439/what-does-syntaxerror-missing-parentheses-in-call-to-print-mean-in-python/ While that does seem to be having the desired effect of explaining an otherwise cryptic message to people, William Brown pointed out that it could potentially be improved by taking advantage of the fact we have access to the rest of the line when working out the exact error text: ``` >>> print "Hello world!" File "", line 1 print "Hello world!" ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean 'print("Hello world!")'? ``` The rationale for such a change is similar to the rationale for adding the custom error message in the first place: the folks most likely to hit this are either attempting to run a Python 2 script on Py3, or else attempting to follow a Py2 tutorial on Py3, and *telling* them what's wrong isn't as clear as *showing* them (by reprinting the line with the parentheses added) ---------- messages: 295397 nosy: ncoghlan priority: normal severity: normal stage: needs patch status: open title: Show expected input in custom "print" error message type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 06:48:40 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 08 Jun 2017 10:48:40 +0000 Subject: [New-bugs-announce] [issue30598] Py_NewInterpreter() leaks a reference on warnoptions in _PySys_EndInit() Message-ID: <1496918920.92.0.347737718278.issue30598@psf.upfronthosting.co.za> New submission from STINNER Victor: Recently, the Python initialization was reworked to start to implement the PEP 432: - bpo-22257: commits 1abcf6700b4da6207fe859de40c6c1bada6b4fec and 6b4be195cd8868b76eb6fbe166acc39beee8ce36 Now, Py_NewInterpreter() leaks a reference on warnoptions in _PySys_EndInit(). We tried with St?phane Wirtel and Louie Lu to add Py_DECREF(warnoptions), but test_capi does crash with this change. The problem is that warnoptions is stored in a C global variable *and* in sys.warnoptions of each interpreter. The ownership of this variable is unclear. I don't think that it's a good idea to share a list between two interpreters and so I created this issue to propose to redesign this variable. The tricky part is that the C global variable is also accessed by 2 public C functions: PySys_ResetWarnOptions() and PySys_AddWarnOptionUnicode(). ---------- messages: 295399 nosy: eric.snow, haypo, ncoghlan priority: normal severity: normal status: open title: Py_NewInterpreter() leaks a reference on warnoptions in _PySys_EndInit() type: resource usage versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 06:57:39 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 08 Jun 2017 10:57:39 +0000 Subject: [New-bugs-announce] [issue30599] test_threaded_import leaks references Message-ID: <1496919459.6.0.828410445127.issue30599@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/x86%20Gentoo%20Refleaks%203.x/builds/28/steps/test/logs/stdio 1:50:39 load avg: 3.66 [302/405/8] test_threaded_import failed -- running: test_tarfile (80 sec) beginning 6 repetitions 123456 ...... test_threaded_import leaked [355866, 185490, 120912] references, sum=662268 test_threaded_import leaked [119138, 62100, 40480] memory blocks, sum=221718 Might be related to bpo-30598 and bpo-30547. ---------- components: Tests messages: 295403 nosy: haypo priority: normal severity: normal status: open title: test_threaded_import leaks references type: resource usage versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 08:25:37 2017 From: report at bugs.python.org (SylvainDe) Date: Thu, 08 Jun 2017 12:25:37 +0000 Subject: [New-bugs-announce] [issue30600] Error message incorrect when index is called with keyword argument ("[].index(x=2)") Message-ID: <1496924737.3.0.976526614189.issue30600@psf.upfronthosting.co.za> New submission from SylvainDe: Issue found while trying to write tests for https://bugs.python.org/issue30592 . Issue related to http://bugs.python.org/issue30534 . The following code: [].index(x=2) should raise the following error: TypeError: index() takes no keyword arguments but currently raises: TypeError: index() takes at least 1 argument (0 given) This is easily reproduced with the following unit test: # AssertionError: "^index\(\) takes no keyword arguments$" does not match "index() takes at least 1 argument (0 given)" def test_varargs4_kw(self): msg = r"^index\(\) takes no keyword arguments$" self.assertRaisesRegex(TypeError, msg, [].index, x=2) ---------- components: Interpreter Core messages: 295427 nosy: SylvainDe priority: normal severity: normal status: open title: Error message incorrect when index is called with keyword argument ("[].index(x=2)") type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 10:59:13 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 08 Jun 2017 14:59:13 +0000 Subject: [New-bugs-announce] [issue30601] [Windows] test_winconsoleio leaks references Message-ID: <1496933953.73.0.264369120187.issue30601@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%203.x/builds/22/steps/test/logs/stdio 0:00:12 [ 7/405/1] test_winconsoleio failed beginning 6 repetitions 123456 ...... test_winconsoleio leaked [43, 43, 43] references, sum=129 ---------- components: Tests, Windows messages: 295445 nosy: haypo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: [Windows] test_winconsoleio leaks references type: resource usage versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 12:18:47 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 08 Jun 2017 16:18:47 +0000 Subject: [New-bugs-announce] [issue30602] [Windows] os.spawn*() tests of test_os leak references on Windows Message-ID: <1496938727.77.0.570436657393.issue30602@psf.upfronthosting.co.za> New submission from STINNER Victor: The leak can be reproduced with the minimum attached test_os.py: C:\haypo\python>PCbuild\amd64\python_d.exe -m test -R 3:3 test_os Run tests sequentially 0:00:00 [1/1] test_os beginning 6 repetitions 123456 ...... test_os leaked [2, 2, 2] memory blocks, sum=6 test_os failed 1 test failed: test_os Total duration: 172 ms Tests result: FAILURE ---------- components: Tests, Windows files: test_os.py messages: 295451 nosy: haypo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: [Windows] os.spawn*() tests of test_os leak references on Windows type: resource usage versions: Python 3.7 Added file: http://bugs.python.org/file46935/test_os.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 17:12:09 2017 From: report at bugs.python.org (Jonathan Eunice) Date: Thu, 08 Jun 2017 21:12:09 +0000 Subject: [New-bugs-announce] [issue30603] textwrap: declining indent level has no test case Message-ID: <1496956329.36.0.717602777767.issue30603@psf.upfronthosting.co.za> New submission from Jonathan Eunice: The case where textwrap.dedent() handles a declining indent level, requiring it to revise its margin estimate downward, remains untested. This issue is opened in support of an imminent PR that adds an appropriate test. ---------- components: Library (Lib) messages: 295464 nosy: jonathaneunice priority: normal severity: normal status: open title: textwrap: declining indent level has no test case type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 17:37:03 2017 From: report at bugs.python.org (Dino Viehland) Date: Thu, 08 Jun 2017 21:37:03 +0000 Subject: [New-bugs-announce] [issue30604] co_extra_freefuncs is stored thread locally and can lead to crashes Message-ID: <1496957823.48.0.898285168896.issue30604@psf.upfronthosting.co.za> New submission from Dino Viehland: The co_extra_freefuncs are stored in PyThreadState. When calling _PyEval_RequestCodeExtraIndex you are given a thread specific index. The code object can then lose it's last reference on a different thread, and the wrong free function can be called if users of the extra space have made calls to get their index in different orders. This can also lead to crashes if the extra thread hasn't yet requested extra indexes either. ---------- assignee: dino.viehland components: Interpreter Core keywords: patch messages: 295467 nosy: brett.cannon, dino.viehland, yselivanov priority: normal severity: normal stage: patch review status: open title: co_extra_freefuncs is stored thread locally and can lead to crashes type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 20:48:51 2017 From: report at bugs.python.org (Roy Williams) Date: Fri, 09 Jun 2017 00:48:51 +0000 Subject: [New-bugs-announce] [issue30605] re.compile fails when compiling bytes under `-bb` mode Message-ID: <1496969331.1.0.0633360334572.issue30605@psf.upfronthosting.co.za> New submission from Roy Williams: import re re.compile(br'^(.*?)$(?m)') ---------- components: Regular Expressions messages: 295473 nosy: Roy Williams, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: re.compile fails when compiling bytes under `-bb` mode versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 8 23:39:20 2017 From: report at bugs.python.org (Lovelyn) Date: Fri, 09 Jun 2017 03:39:20 +0000 Subject: [New-bugs-announce] [issue30606] The reply's additional 'Re' is ok Message-ID: New submission from Lovelyn: lovecolit13 at gmail.com ---------- messages: 295479 nosy: Love priority: normal severity: normal status: open title: The reply's additional 'Re' is ok _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 00:07:59 2017 From: report at bugs.python.org (Jon Wayne Parrott) Date: Fri, 09 Jun 2017 04:07:59 +0000 Subject: [New-bugs-announce] [issue30607] Extract documentation theme into a separate package Message-ID: <1496981279.71.0.300273355047.issue30607@psf.upfronthosting.co.za> New submission from Jon Wayne Parrott: As part of an effort to align the packaging documentation (packaging.python.org) with the CPython docs, PyPA has extracted the theme used in the CPython documentation into a separate repository and package (https://github.com/python/python-docs-theme). This bug is to track removing the now duplicate theme code from CPython and relying on the externalized version. Context links: 1. https://mail.python.org/pipermail/python-dev/2017-May/148029.html 2. https://github.com/pypa/python-packaging-user-guide/pull/305 ---------- assignee: docs at python components: Documentation messages: 295482 nosy: Jon Wayne Parrott, brett.cannon, docs at python, dstufft, ncoghlan priority: normal severity: normal status: open title: Extract documentation theme into a separate package type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 01:56:43 2017 From: report at bugs.python.org (Vanessa McHale) Date: Fri, 09 Jun 2017 05:56:43 +0000 Subject: [New-bugs-announce] [issue30608] argparse calculates string widths incorrectly Message-ID: <1496987803.38.0.550172497498.issue30608@psf.upfronthosting.co.za> New submission from Vanessa McHale: Currently, python computes string widths based on number of characters. However, this will not work in general because some languages have e.g. vowel markers: '???' for instance is three characters but its width should be two. I have an example repo here: https://github.com/vmchale/argparse-min-example ---------- components: Library (Lib) messages: 295490 nosy: Vanessa McHale priority: normal severity: normal status: open title: argparse calculates string widths incorrectly versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 04:17:45 2017 From: report at bugs.python.org (Richard S. Gordon) Date: Fri, 09 Jun 2017 08:17:45 +0000 Subject: [New-bugs-announce] [issue30609] Python 3.6.1 fails to generate 256 colors on Cygwin based 64-bit Windows 10 Message-ID: <5FB899E3-945E-4B35-831E-804DF53714B8@comcast.net> New submission from Richard S. Gordon: Generated colors appear to be corrupted by overloading text attribute with specified foreground and background colors. This can be demonstrated by running test_tsWxColorPalette.py in Python 3x (developer-sandbox) found in https://github.com/rigordo959/tsWxGTUI_PyVx_Repository. Richard S. Gordon ---------- messages: 295495 nosy: rigordo priority: normal severity: normal status: open title: Python 3.6.1 fails to generate 256 colors on Cygwin based 64-bit Windows 10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 05:07:10 2017 From: report at bugs.python.org (Duy Phan Thanh) Date: Fri, 09 Jun 2017 09:07:10 +0000 Subject: [New-bugs-announce] [issue30610] libexpat vulnerable to CVE-2016-0718 Message-ID: <1496999230.33.0.525014821898.issue30610@psf.upfronthosting.co.za> New submission from Duy Phan Thanh: Python's libexpat library is outdated and vulnerable to CVE-2016-0718 https://sourceforge.net/p/expat/bugs/537/ which can cause remote code execution through malicious xml files. The attached POC crashed both python 2.7 and python 3.5 on my windows machine. ---------- components: XML files: overflow.zip messages: 295502 nosy: Duy Phan Thanh priority: normal severity: normal status: open title: libexpat vulnerable to CVE-2016-0718 type: security Added file: http://bugs.python.org/file46938/overflow.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 05:20:31 2017 From: report at bugs.python.org (Christian Ullrich) Date: Fri, 09 Jun 2017 09:20:31 +0000 Subject: [New-bugs-announce] [issue30611] Windows HTML Help always opens maximized Message-ID: <1497000031.32.0.397781298272.issue30611@psf.upfronthosting.co.za> New submission from Christian Ullrich: The CHM help files on Windows always open maximized. I would prefer they opened in a regular window instead, because the current behavior is annoying. Fix: In Tools/msi/doc/doc.wxs line 34, change 'Show="maximized"' to 'Show="normal"'. ---------- assignee: docs at python components: Documentation, Windows messages: 295503 nosy: Christian.Ullrich, docs at python, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Windows HTML Help always opens maximized type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 05:33:24 2017 From: report at bugs.python.org (Christian Ullrich) Date: Fri, 09 Jun 2017 09:33:24 +0000 Subject: [New-bugs-announce] [issue30612] Unusual Windows registry path syntax Message-ID: <1497000804.0.0.079840477122.issue30612@psf.upfronthosting.co.za> New submission from Christian Ullrich: In 3.6.1, the manual, section 3.1.3, has this to say: "Your administrator will need to activate the ?Enable Win32 long paths? group policy, or set the registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem at LongPathsEnabled to 1." Separating a value name from the key path with an @-sign, which is what the above is doing, is something I have never before seen anywhere. I suggest changing it by either: - replacing the instructions for the manual change with a link to or a more suitable reference (I could not find a KB article when I looked) - rewording it as, e.g., ... in the registry key HKEY_...FileSystem, set the REG_DWORD value LongPathsEnabled to 1 The value type could be left out; the value is predefined on all platforms where it will be effective. ---------- assignee: docs at python components: Documentation messages: 295505 nosy: Christian.Ullrich, docs at python priority: normal severity: normal status: open title: Unusual Windows registry path syntax type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 07:55:25 2017 From: report at bugs.python.org (Kaeptm Blaubaer) Date: Fri, 09 Jun 2017 11:55:25 +0000 Subject: [New-bugs-announce] [issue30613] Distutils register command creates non-standard multipart data Message-ID: <1497009325.99.0.168340984159.issue30613@psf.upfronthosting.co.za> New submission from Kaeptm Blaubaer: It is using b"\n" newline instead of b"\r\n". ---------- components: Distutils messages: 295518 nosy: Kaeptm Blaubaer, dstufft, merwok priority: normal severity: normal status: open title: Distutils register command creates non-standard multipart data versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 11:26:03 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 09 Jun 2017 15:26:03 +0000 Subject: [New-bugs-announce] [issue30614] [EASY][2.7] testInitNonExistentFile() of test_bz2 leaks references Message-ID: <1497021963.08.0.0268094667551.issue30614@psf.upfronthosting.co.za> New submission from STINNER Victor: haypo at selma$ ./python -m test -R 3:3 -m testInitNonExistentFile test_bz2 Run tests sequentially 0:00:00 [1/1] test_bz2 beginning 6 repetitions 123456 ...... test_bz2 leaked [10, 10, 10] references, sum=30 1 test failed: test_bz2 Total duration: 81 ms Tests result: FAILURE [57793 refs] ---------- keywords: easy (C) messages: 295542 nosy: haypo priority: normal severity: normal status: open title: [EASY][2.7] testInitNonExistentFile() of test_bz2 leaks references type: resource usage versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 11:29:04 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 09 Jun 2017 15:29:04 +0000 Subject: [New-bugs-announce] [issue30615] [EASY][2.7] test_recursive_repr() of test_xml_etree_c leaks references Message-ID: <1497022144.89.0.26553812971.issue30615@psf.upfronthosting.co.za> New submission from STINNER Victor: haypo at selma$ ./python -m test -R 3:3 -m test_recursive_repr test_xml_etree_c Run tests sequentially 0:00:00 [1/1] test_xml_etree_c beginning 6 repetitions 123456 ...... test_xml_etree_c leaked [4, 4, 4] references, sum=12 1 test failed: test_xml_etree_c Total duration: 179 ms Tests result: FAILURE [64152 refs] ---------- components: Tests, XML messages: 295543 nosy: haypo priority: normal severity: normal status: open title: [EASY][2.7] test_recursive_repr() of test_xml_etree_c leaks references type: resource usage versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 13:30:17 2017 From: report at bugs.python.org (Gerrit Holl) Date: Fri, 09 Jun 2017 17:30:17 +0000 Subject: [New-bugs-announce] [issue30616] Cannot use functional API to create enum with zero values Message-ID: <1497029417.9.0.731294800985.issue30616@psf.upfronthosting.co.za> New submission from Gerrit Holl: The OO API allows to create empty enums, i.e. without any values. However, the functional API does not, as this will result in an IndexError as shown below: In [1]: import enum In [2]: class X(enum.IntFlag): pass In [3]: Y = enum.IntFlag("Y", []) --------------------------------------------------------------------------- IndexError Traceback (most recent call last) in () ----> 1 Y = enum.IntFlag("Y", []) ~/lib/python3.6/enum.py in __call__(cls, value, names, module, qualname, type, start) 291 return cls.__new__(cls, value) 292 # otherwise, functional API: we're creating a new Enum type --> 293 return cls._create_(value, names, module=module, qualname=qualname, type=type, start=start) 294 295 def __contains__(cls, member): ~/lib/python3.6/enum.py in _create_(cls, class_name, names, module, qualname, type, start) 382 if isinstance(names, str): 383 names = names.replace(',', ' ').split() --> 384 if isinstance(names, (tuple, list)) and isinstance(names[0], str): 385 original_names, names = names, [] 386 last_values = [] IndexError: list index out of range ---------- messages: 295559 nosy: Gerrit.Holl priority: normal severity: normal status: open title: Cannot use functional API to create enum with zero values versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 17:55:30 2017 From: report at bugs.python.org (Cheryl Sabella) Date: Fri, 09 Jun 2017 21:55:30 +0000 Subject: [New-bugs-announce] [issue30617] IDLE: Add docstrings and unittests to outwin.py Message-ID: <1497045330.63.0.173910346607.issue30617@psf.upfronthosting.co.za> Changes by Cheryl Sabella : ---------- assignee: terry.reedy components: IDLE nosy: csabella, terry.reedy priority: normal severity: normal status: open title: IDLE: Add docstrings and unittests to outwin.py type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 19:55:59 2017 From: report at bugs.python.org (smheidrich) Date: Fri, 09 Jun 2017 23:55:59 +0000 Subject: [New-bugs-announce] [issue30618] readlink for pathlib paths Message-ID: <1497052559.7.0.422106710991.issue30618@psf.upfronthosting.co.za> New submission from smheidrich: Is there any reason why there is no equivalent of os.readlink in pathlib.Path? Note that Path.resolve does *not* fit the bill, as it always produces an absolute path, whereas readlink just spits out the symlink target exactly the way it is stored, which may be relative to the symlink itself: >>> import pathlib, os >>> p = pathlib.Path("/lib64/libc.so.6") >>> p.resolve() PosixPath('/lib64/libc-2.24.so') >>> os.readlink(str(p)) 'libc-2.24.so' ---------- components: Library (Lib) messages: 295592 nosy: smheidrich priority: normal severity: normal status: open title: readlink for pathlib paths type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 9 20:38:10 2017 From: report at bugs.python.org (khyox) Date: Sat, 10 Jun 2017 00:38:10 +0000 Subject: [New-bugs-announce] [issue30619] typing.Union doc incoherence in case a class and its subclass are present Message-ID: <1497055090.79.0.980256634301.issue30619@psf.upfronthosting.co.za> New submission from khyox: In https://docs.python.org/3.6/library/typing.html#typing.Union, when giving details for Union and in the case when a class and its subclass are present, the doc states: When a class and its subclass are present, the former is skipped, e.g.: Union[int, object] == object But it is the example (and not the text) which is consistent with PEP 483: Corollary: Union[..., object, ...] returns object So, the proposed correction would be substitute 'former' for 'latter': When a class and its subclass are present, the latter is skipped, e.g.: Union[int, object] == object ---------- assignee: docs at python components: Documentation messages: 295593 nosy: docs at python, khyox priority: normal severity: normal status: open title: typing.Union doc incoherence in case a class and its subclass are present versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 10 00:09:38 2017 From: report at bugs.python.org (Jonathan Eunice) Date: Sat, 10 Jun 2017 04:09:38 +0000 Subject: [New-bugs-announce] [issue30620] textwrap: dedent contains logic that can never execute Message-ID: <1497067778.08.0.694661889778.issue30620@psf.upfronthosting.co.za> New submission from Jonathan Eunice: textwrap.dedent contains a bit of code that appears logical at first blush, but in fact can never execute under any input conditions. Not only are the lines "dead code," they are the only thing (i.e. only non-debugging lines) now standing in the way of textwrap having 100% test coverage. Here is the proof: https://gist.github.com/jonathaneunice/86f6a721e48c89e272a778530e8f758c A PR removing the bogus lines is imminent. ---------- components: Library (Lib) messages: 295606 nosy: jonathaneunice priority: normal severity: normal status: open title: textwrap: dedent contains logic that can never execute type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 10 05:17:03 2017 From: report at bugs.python.org (Masaki Suketa) Date: Sat, 10 Jun 2017 09:17:03 +0000 Subject: [New-bugs-announce] [issue30621] import json before using json module in tutorial Input and Output Message-ID: <1497086223.62.0.997560014368.issue30621@psf.upfronthosting.co.za> New submission from Masaki Suketa: In Input and Output tutorial, use json module without `import json`. ---------- assignee: docs at python components: Documentation messages: 295626 nosy: docs at python, suketa priority: normal pull_requests: 2139 severity: normal status: open title: import json before using json module in tutorial Input and Output type: resource usage versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 10 11:08:14 2017 From: report at bugs.python.org (Melvyn Sopacua) Date: Sat, 10 Jun 2017 15:08:14 +0000 Subject: [New-bugs-announce] [issue30622] Fix NPN guard for OpenSSL 1.1 Message-ID: <1497107294.71.0.653300932954.issue30622@psf.upfronthosting.co.za> New submission from Melvyn Sopacua: Starting OpenSSL 1.1, the variable OPENSSL_NPN_NEGOTIATED is always defined. This makes the NPN detection fail. Related info: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217703 ---------- assignee: christian.heimes components: SSL messages: 295643 nosy: christian.heimes, msopacua priority: normal pull_requests: 2144 severity: normal status: open title: Fix NPN guard for OpenSSL 1.1 versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 10 12:53:42 2017 From: report at bugs.python.org (Arek Bulski) Date: Sat, 10 Jun 2017 16:53:42 +0000 Subject: [New-bugs-announce] [issue30623] python-nightly import numpy fails since recently Message-ID: <1497113622.57.0.629057733429.issue30623@psf.upfronthosting.co.za> New submission from Arek Bulski: About few days ago python-nightly started failing on TravisCI for no reason, and I dont think its due to my code. In fact it fails on importing numpy but fails to get into catch ImportError. This is a recent BUG. Build log: https://travis-ci.org/construct/construct/jobs/241153020 ---------- messages: 295644 nosy: Arek Bulski priority: normal severity: normal status: open title: python-nightly import numpy fails since recently type: crash versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 10 14:11:44 2017 From: report at bugs.python.org (Giampaolo Rodola') Date: Sat, 10 Jun 2017 18:11:44 +0000 Subject: [New-bugs-announce] [issue30624] selectors should use bare except clauses Message-ID: <1497118304.42.0.304897736329.issue30624@psf.upfronthosting.co.za> New submission from Giampaolo Rodola': Right now it uses "except Exception: ...; raise" which does not take KeyboardInterrupt and SystemExit into account, leaving the fd in a bad state (it's not unregister()ed). ---------- components: asyncio messages: 295648 nosy: berker.peksag, giampaolo.rodola, gvanrossum, haypo, neologix, serhiy.storchaka, yselivanov priority: normal severity: normal status: open title: selectors should use bare except clauses versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 10 14:16:12 2017 From: report at bugs.python.org (Gregory Szorc) Date: Sat, 10 Jun 2017 18:16:12 +0000 Subject: [New-bugs-announce] [issue30625] Documentation is unclear how "y*" and "y#" formit units vary Message-ID: <1497118572.05.0.886949691959.issue30625@psf.upfronthosting.co.za> New submission from Gregory Szorc: https://github.com/indygreg/python-zstandard/issues/26 is a bug report against python-zstandard that a C API using the "y#" format unit is unable to accept a memoryview instance constructed from a bytes literal. It fails with "TypeError: argument 1 must be read-only bytes-like object, not memoryview". I understand why the "y*" format unit and the buffer protocol are a superior API. In hindsight, I should have used the buffer protocol from the beginning in python-zstandard. However, this decision was primarily influenced because the docs aren't clear about the apparent limitations of "y#" compared to "y*" and I believed "y#" would get me what I wanted (pointer to read-only memory) without having to be burdened by the complexity of the buffer protocol in my C code. So, docs issue #1 is that the limitations of "y#" compared to "y*" aren't immediately obvious when reading their respective sections in https://docs.python.org/3/c-api/arg.html#strings-and-buffers. To their credit, the docs for "y*" do have a bold recommendation to use it. But what's missing is the critical "why." There is also a paragraph above the format unit list explaining "bytes-like object" but this is detached from the definitions for "y#" and "y*" so it is easy to pass over. Issue #2 (which may be an implementation bug) is why "y#" isn't accepting a memoryview constructed from bytes. The docs for "y#" say it accepts a "read-only bytes-like object," which is defined at https://docs.python.org/3/glossary.html#term-bytes-like-object. And the paragraphs there explicitly state that a memoryview of an immutable bytes is in fact a "read-only bytes-like object." So I have no clue why "y#" is refusing such an object. I'll gladly author a documentation fix. However, I'm not sure what to say because I don't understand why "y#" isn't working in this memoryview(bytes) case and whether that issue applies to other types. ---------- assignee: docs at python components: Documentation messages: 295649 nosy: Gregory.Szorc, docs at python priority: normal severity: normal status: open title: Documentation is unclear how "y*" and "y#" formit units vary type: enhancement versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 10 14:53:58 2017 From: report at bugs.python.org (ppperry) Date: Sat, 10 Jun 2017 18:53:58 +0000 Subject: [New-bugs-announce] [issue30626] "SystemError: SystemError: returned NULL without setting an error Message-ID: <1497120838.83.0.319212252548.issue30626@psf.upfronthosting.co.za> Changes by ppperry : ---------- nosy: ppperry priority: normal severity: normal status: open title: "SystemError: SystemError: returned NULL without setting an error _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 10 19:06:19 2017 From: report at bugs.python.org (SylvainDe) Date: Sat, 10 Jun 2017 23:06:19 +0000 Subject: [New-bugs-announce] [issue30627] Incorrect error message for a few functions called with keywod argument Message-ID: <1497135979.63.0.672123503952.issue30627@psf.upfronthosting.co.za> New submission from SylvainDe: Follow-up for http://bugs.python.org/issue30600 which is itself a follow-up for http://bugs.python.org/issue30534 . Not quite sure what the process is in that situation : creating a new ticket or updating the old one ? After working on http://bugs.python.org/issue30600 , I thought that maybe other functions not generated by the clinic would have the same issue. "git grep _PyArg_NoStackKeywords | grep -v clinic" gave me some place to look for and indeed: Modules/_struct.c: if (!_PyArg_NoStackKeywords("pack", kwnames)) { Modules/_struct.c: if (!_PyArg_NoStackKeywords("pack_into", kwnames)) { Python/bltinmodule.c: if (!_PyArg_NoStackKeywords("getattr", kwnames)) { Python/bltinmodule.c: if (!_PyArg_NoStackKeywords("next", kwnames)) { These four functions have a not-so-good error message when called with keyword arguments (and this is a regression compared to other Python versions) I have a fix ready to be suggested but: - I want to be sure that I had to create a new ticket - I suspect functions defined via the GEN_CONSTRUCTOR macro in Modules/_hashopenssl.c have the same issue but I do not know how to test it. Any help is welcome. ---------- components: Interpreter Core messages: 295676 nosy: SylvainDe priority: normal severity: normal status: open title: Incorrect error message for a few functions called with keywod argument versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 10 19:24:39 2017 From: report at bugs.python.org (Curtis Doty) Date: Sat, 10 Jun 2017 23:24:39 +0000 Subject: [New-bugs-announce] [issue30628] why venv install old pip? Message-ID: <1497137079.52.0.388679459657.issue30628@psf.upfronthosting.co.za> New submission from Curtis Doty: I've already updated system setuptools 36.0.1 with `pip3 install --upgrade pip setuptools wheel` but when I create a new enviro with `python3 -m venv foo` it will have an old/outdated setuptools 28.8.0 from embedded ensurepip. Why? I think it should install the already-updated one! ---------- components: Library (Lib) messages: 295678 nosy: GreenKey priority: normal severity: normal status: open title: why venv install old pip? type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 11 02:36:19 2017 From: report at bugs.python.org (=?utf-8?b?5oiQ54Cs5Z+65qi5?=) Date: Sun, 11 Jun 2017 06:36:19 +0000 Subject: [New-bugs-announce] [issue30629] lower() is called twice Message-ID: <1497162979.35.0.759542344671.issue30629@psf.upfronthosting.co.za> New submission from ????: https://github.com/python/cpython/blob/master/Lib/html/parser.py#L415 elem is already lowercase string but call lower() for handle_endtag(). elem = match.group(1).lower() # script or style if self.cdata_elem is not None: if elem != self.cdata_elem: self.handle_data(rawdata[i:gtpos]) return gtpos self.handle_endtag(elem.lower()) ---------- components: Library (Lib) messages: 295689 nosy: Motoki priority: normal severity: normal status: open title: lower() is called twice versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 11 11:04:41 2017 From: report at bugs.python.org (Mark Airey) Date: Sun, 11 Jun 2017 15:04:41 +0000 Subject: [New-bugs-announce] [issue30630] Missing MSI files Message-ID: <1497193481.58.0.405120031898.issue30630@psf.upfronthosting.co.za> New submission from Mark Airey: I downloaded and installed python 3.0, 3.6.0 and 3.6.1 and they all said that I was missing: "api-ms-win-crt-runtime-|1-1-0.dll" or the msi files as i have read online. I don't know how to get said files and I need this program soon. Can anyone help? ---------- components: Windows messages: 295718 nosy: Mark Airey, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Missing MSI files versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 11 18:14:26 2017 From: report at bugs.python.org (Segev Finer) Date: Sun, 11 Jun 2017 22:14:26 +0000 Subject: [New-bugs-announce] [issue30631] Warnings in VS2015 Update 3 32-Bit Message-ID: <1497219266.57.0.229179857591.issue30631@psf.upfronthosting.co.za> New submission from Segev Finer: I'm hitting the following warnings when building in VS2015 Update 3 in 32-bit: liblzma: warning C4028: formal parameter {} different from declaration warning C4113: 'FARPROC' differs in parameter lists from '{}' warning C4244: 'initializing': conversion from '{}' to '{}', possible loss of data warning C4267: '=': conversion from '{}' to '{}', possible loss of data warning C4996: 'GetVersion': was declared deprecated libeay: warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings socketmodule: warning C4996: '{}': Use {}() or {}() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings (multiple) tix: warning C4090: 'function': different 'const' qualifiers warning C4028: formal parameter {} different from declaration And ValidateUcrtbase in python.vcxproj is failing on first build because it depends on ctypes but runs before it's built when building using the pcbuild.sln ---------- components: Windows messages: 295732 nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Warnings in VS2015 Update 3 32-Bit type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 12 04:30:22 2017 From: report at bugs.python.org (Louie Lu) Date: Mon, 12 Jun 2017 08:30:22 +0000 Subject: [New-bugs-announce] [issue30632] IDLE: add unittest to test_autocomplete Message-ID: <1497256222.98.0.89770351326.issue30632@psf.upfronthosting.co.za> New submission from Louie Lu: Add unittest to test_open_completions, test_fetch_copmletions, and test_get_entity in test_autocomplete ---------- assignee: terry.reedy components: IDLE messages: 295755 nosy: louielu, terry.reedy priority: normal severity: normal status: open title: IDLE: add unittest to test_autocomplete type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 12 04:43:29 2017 From: report at bugs.python.org (Andreas Jung) Date: Mon, 12 Jun 2017 08:43:29 +0000 Subject: [New-bugs-announce] [issue30633] Python 3.6.1 installation issues on OpenSuse 42.1: ModuleNotFoundError: No module named 'encodings' Message-ID: <1497257009.22.0.916205252409.issue30633@psf.upfronthosting.co.za> New submission from Andreas Jung: Installing Python 3.6.1 from the sources on OpenSuse 42.1 gives me: o Python/mystrtoul.o Python/mysnprintf.o Python/peephole.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/random.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o Python/thread.o Python/frozen.o ar rc libpython3.6m.a Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o ar rc libpython3.6m.a Modules/_threadmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/_operator.o Modules/_collectionsmodule.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/signalmodule.o Modules/_stat.o Modules/timemodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/zipimport.o Modules/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o Modules/xxsubtype.o ranlib libpython3.6m.a gcc -pthread -fprofile-generate -Xlinker -export-dynamic -o python Programs/python.o libpython3.6m.a -lpthread -ldl -lutil -lm gcc -pthread -fprofile-generate -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o libpython3.6m.a -lpthread -ldl -lutil -lm ./python -E -S -m sysconfig --generate-posix-vars ;\ if test $? -ne 0 ; then \ echo "generate-posix-vars failed" ; \ rm -f ./pybuilddir.txt ; \ exit 1 ; \ fi Could not find platform independent libraries Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] Fatal Python error: Py_Initialize: Unable to get the locale encoding ModuleNotFoundError: No module named 'encodings' Current thread 0x00007f8a8d4c6680 (most recent call first): /bin/sh: line 5: 31168 Aborted ./python -E -S -m sysconfig --generate-posix-vars generate-posix-vars failed Makefile:595: recipe for target 'pybuilddir.txt' failed make[2]: *** [pybuilddir.txt] Error 1 make[2]: Leaving directory '/data/home/ajung/src/Python-3.6.1' Makefile:511: recipe for target 'build_all_generate_profile' failed make[1]: *** [build_all_generate_profile] Error 2 make[1]: Leaving directory '/data/home/ajung/src/Python-3.6.1' Makefile:492: recipe for target 'profile-opt' failed make: *** [profile-opt] Error 2 Some search on Google reveals some dependency to PYTHONPATH but this variable is not set on my system ---------- components: Installation messages: 295757 nosy: zopyx priority: normal severity: normal status: open title: Python 3.6.1 installation issues on OpenSuse 42.1: ModuleNotFoundError: No module named 'encodings' versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 12 04:56:44 2017 From: report at bugs.python.org (fooofei) Date: Mon, 12 Jun 2017 08:56:44 +0000 Subject: [New-bugs-announce] [issue30634] ctypes.cast(obj, ctypes.c_void_p) invalid return in linux_x64 Message-ID: <1497257804.29.0.586474122887.issue30634@psf.upfronthosting.co.za> New submission from fooofei: module:ctypes pyversion: 2.7.13 python platform : win32, linux_x86_x64 I use ctypes.cast(v,ctypes.c_void_p).value to get address of 'helloworld' and u'helloworld' internal buffer address. the result is both right in win32,but not in linux. 'helloworld' is right, u'helloworld' is invalid. please see https://github.com/fooofei/py_string_address https://github.com/fooofei/py_string_address/blob/master/issue.py ---------- components: ctypes messages: 295758 nosy: fooofei priority: normal severity: normal status: open title: ctypes.cast(obj,ctypes.c_void_p) invalid return in linux_x64 type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 12 04:59:15 2017 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Mon, 12 Jun 2017 08:59:15 +0000 Subject: [New-bugs-announce] [issue30635] Leak in test_c_locale_coercion Message-ID: <1497257955.43.0.488358519623.issue30635@psf.upfronthosting.co.za> New submission from St?phane Wirtel: ./python -m test -R 3:3 test_c_locale_coercion -m test_external_target_locale_configuration Mon 12 Jun 2017 10:57:14 AM CEST Run tests sequentially 0:00:00 load avg: 1.31 [1/1] test_c_locale_coercion beginning 6 repetitions 123456 ...... test_c_locale_coercion leaked [2, 2, 2] references, sum=6 test_c_locale_coercion failed 1 test failed: test_c_locale_coercion Total duration: 4 sec Tests result: FAILURE ---------- messages: 295759 nosy: matrixise priority: normal severity: normal status: open title: Leak in test_c_locale_coercion versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 12 05:55:38 2017 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Mon, 12 Jun 2017 09:55:38 +0000 Subject: [New-bugs-announce] [issue30636] Add PYTHONCOERCECLOCALE to the help of the command line Message-ID: <1497261338.07.0.203172964445.issue30636@psf.upfronthosting.co.za> New submission from St?phane Wirtel: Add the description of PYTHONCOERCECLOCALE in the command line. ---------- messages: 295763 nosy: matrixise, ncoghlan priority: normal severity: normal status: open title: Add PYTHONCOERCECLOCALE to the help of the command line versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 12 08:37:36 2017 From: report at bugs.python.org (=?utf-8?b?SHJ2b2plIE5pa8WhacSH?=) Date: Mon, 12 Jun 2017 12:37:36 +0000 Subject: [New-bugs-announce] [issue30637] Syntax error reported on compile(...), but not on compile(..., ast.PyCF_ONLY_AST) Message-ID: <1497271056.08.0.482498543523.issue30637@psf.upfronthosting.co.za> New submission from Hrvoje Nik?i?: Our application compiles snippets of user-specified code using the compile built-in with ast.PyCF_ONLY_AST flag. At this stage we catch syntax errors and perform some sanity checks on the AST. The AST is then compiled into actual code using compile() and run using further guards. We found that using a bare "return" in the code works with ast.PyCF_ONLY_AST, but raises SyntaxError when compiled without the flag: >>> import ast >>> compile('return', '', 'exec', ast.PyCF_ONLY_AST, True) <_ast.Module object at 0x7f35df872310> >>> compile('return', '', 'exec', 0, True) Traceback (most recent call last): File "", line 1, in File "", line 1 SyntaxError: 'return' outside function Is this intended behavior? It doesn't seem to be documented anywhere. ---------- components: Interpreter Core messages: 295771 nosy: hniksic priority: normal severity: normal status: open title: Syntax error reported on compile(...), but not on compile(..., ast.PyCF_ONLY_AST) versions: Python 2.7, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 12 09:43:01 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Mon, 12 Jun 2017 13:43:01 +0000 Subject: [New-bugs-announce] [issue30638] Additional dependencies and rule for `make regen-all` Message-ID: <1497274981.52.0.670681266709.issue30638@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: `make regen-all` regenerates many generated files. But not all. 1. Argument Clinic files has their own make target, `make clinic`. Perhaps "clinic" should be a dependency for "regen-all". 2. Lib/token.py and Lib/symbols.py are generated from Include/token.h and Include/graminit.h. 3. Lib/keyword.py is generated from graminit.c. 4. Modules/sre_constants.h is generated from Lib/sre_constants.py. 5. Lib/stringprep.py is generated by mkstringprep.py (currently it is slightly outdated). 6. Objects/unicodetype_db.h, Objects/unicodetype_db.h and Modules/unicodename_db.h are generated by makeunicodedata.py (it downloads Unicode data from Internet). Some generating scripts support Python 2.7 and even older versions. Some generating scripts (in particular Argument Clinic) need recent Python version (3.5+ or like). ---------- components: Build messages: 295781 nosy: haypo, ncoghlan, serhiy.storchaka priority: normal severity: normal status: open title: Additional dependencies and rule for `make regen-all` type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 12 09:54:06 2017 From: report at bugs.python.org (Thomas Kluyver) Date: Mon, 12 Jun 2017 13:54:06 +0000 Subject: [New-bugs-announce] [issue30639] inspect.getfile(obj) calls object repr on failure Message-ID: <1497275646.73.0.340946386464.issue30639@psf.upfronthosting.co.za> New submission from Thomas Kluyver: This came up in IPython & Jedi: several functions in inspect end up calling getfile(). If the object is something for which it can't find the source file, it throws an error, the message for which contains the object's repr. This is problematic for us because for some objects the repr may be expensive to calculate (e.g. data tables where the repr forms primary output, not just debugging information). In some cases, it could also throw another error. I plan to make a PR for this, but I'm opening an issue so I've got a bpo number. https://github.com/ipython/ipython/issues/10493 https://github.com/davidhalter/jedi/issues/919 ---------- components: Library (Lib) messages: 295782 nosy: takluyver priority: normal severity: normal status: open title: inspect.getfile(obj) calls object repr on failure type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 12 10:37:59 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Mon, 12 Jun 2017 14:37:59 +0000 Subject: [New-bugs-announce] [issue30640] NULL + 1 Message-ID: <1497278279.18.0.370213389584.issue30640@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: In _PyFunction_FastCallDict() if nk == 0, k is set to NULL. After that k + 1 is passed to _PyEval_EvalCodeWithName(). NULL + 1 is an undefined behavior. ---------- components: Interpreter Core messages: 295786 nosy: haypo, serhiy.storchaka priority: normal severity: normal status: open title: NULL + 1 versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 12 14:49:11 2017 From: report at bugs.python.org (Max Staff) Date: Mon, 12 Jun 2017 18:49:11 +0000 Subject: [New-bugs-announce] [issue30641] No way to specify "File name too long" error in except statement. Message-ID: <1497293351.7.0.144542900904.issue30641@psf.upfronthosting.co.za> New submission from Max Staff: There are different ways to catch exceptions of the type "OSError": By using "except OSError as e:" and then checking the errno or by using "except FileNotFoundError e:" or "except FileExistsError e:" or whatever error one wants to catch. There's no such way for above mentioned error that occurs when a filename is too long for the filesystem/OS. ---------- components: IO messages: 295810 nosy: Max Staff priority: normal severity: normal status: open title: No way to specify "File name too long" error in except statement. type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 01:17:26 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Tue, 13 Jun 2017 05:17:26 +0000 Subject: [New-bugs-announce] [issue30642] Fix leaks in idlelib Message-ID: <1497331046.43.0.660269627815.issue30642@psf.upfronthosting.co.za> New submission from Terry J. Reedy: When Louie Lu posted a link to https://blog.louie.lu/2017/06/12/diagnosing-and-fixing-reference-leaks-in-cpython/ on core-mentorship list, I tested idlelib. python -m test -ugui test_idle # SUCCESS, no extraneous output python -m test -R: test_idle # SUCCESS, no extraneous output python -m test -R: -ugui test_idle # error output, FAILURE [So people who leaktest without a screen see nothing in idlelib.] Error output is about 20 copies of the following: can't invoke "event" command: application has been destroyed while executing "event generate $w <>" (procedure "ttk::ThemeChanged" line 6) invoked from within "ttk::ThemeChanged" At the end: test_idle leaked [471, 471, 471, 471] references, sum=1884 test_idle leaked [209, 211, 211, 211] memory blocks, sum=842 [similar for python 3.6] In a response email, I noted that test_idle gathers tests from idlelib.idle_test.test_* and that something extra is needed to pin leaks to specific test modules. I don't know whether the absence of 'invoke event' error messages when not running -R means that there are also no refleaks, or not. --- import os import subprocess os.chdir('f:/dev/3x/Lib/idlelib/idle_test') testfiles = [name for name in os.listdir() if name.startswith('test_')] for name in testfiles: os.rename(name, 'x'+name) for name in testfiles: os.rename('x'+name, name) try: res = subprocess.run( ['f:/dev/3x/python.bat', '-m', 'test', '-R:', '-ugui', 'test_idle'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) if res.returncode: print(name) print(res.stderr) except Exception as err: print(name, err) os.rename(name, 'x'+name) for name in testfiles: os.rename('x'+name, name) --- reports test_macosx.py b'beginning 9 repetitions\r\n123456789\r\n\r\ntest_idle leaked [31, 31, 31, 31] references, sum=124\r\ntest_idle leaked [19, 21, 21, 21] memory blocks, sum=82\r\n' test_query.py b'beginning 9 repetitions\r\n123456789\r\n\r\ntest_idle leaked [429, 429, 429, 429] references, sum=1716\r\ntest_idle leaked [190, 192, 192, 192] memory blocks, sum=766\r\n' There are no 'invoke event' messages. For further testing within each file, by commenting out code, as suggested in the link above, I replaced 'testfiles' in the middle loop with ['testmacosx.py'] or ['test_query.py']. For test_macosx, the culprit is class SetupTest. For test_query, the culprit is class QueryGuiTest. Adding cls.root.update_idletasks did not solve the problem by itself (as it has in other cases). I plan to continue another time. ---------- assignee: terry.reedy components: IDLE messages: 295846 nosy: louielu, terry.reedy priority: normal severity: normal stage: needs patch status: open title: Fix leaks in idlelib type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 02:46:05 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Jun 2017 06:46:05 +0000 Subject: [New-bugs-announce] [issue30643] test_basic_script_no_suffix() of test_multiprocessing_main_handling timeout after 20 min on Travis CI Message-ID: <1497336365.48.0.895824657257.issue30643@psf.upfronthosting.co.za> New submission from STINNER Victor: https://travis-ci.org/python/cpython/jobs/242108490#L2211 0:22:46 load avg: 62.38 [406/406/1] test_multiprocessing_main_handling crashed (Exit code 1) Timeout (0:20:00)! Thread 0x00002b175d341400 (most recent call first): File "/home/travis/build/python/cpython/Lib/selectors.py", line 415 in select File "/home/travis/build/python/cpython/Lib/subprocess.py", line 1488 in _communicate File "/home/travis/build/python/cpython/Lib/subprocess.py", line 840 in communicate File "/home/travis/build/python/cpython/Lib/test/support/script_helper.py", line 126 in run_python_until_end File "/home/travis/build/python/cpython/Lib/test/support/script_helper.py", line 135 in _assert_python File "/home/travis/build/python/cpython/Lib/test/support/script_helper.py", line 151 in assert_python_ok File "/home/travis/build/python/cpython/Lib/test/test_multiprocessing_main_handling.py", line 157 in _check_script File "/home/travis/build/python/cpython/Lib/test/test_multiprocessing_main_handling.py", line 169 in test_basic_script_no_suffix File "/home/travis/build/python/cpython/Lib/unittest/case.py", line 605 in run File "/home/travis/build/python/cpython/Lib/unittest/case.py", line 653 in __call__ File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 122 in run File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 84 in __call__ File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 122 in run File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 84 in __call__ File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 122 in run File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 84 in __call__ File "/home/travis/build/python/cpython/Lib/unittest/runner.py", line 176 in run File "/home/travis/build/python/cpython/Lib/test/support/__init__.py", line 1896 in _run_suite File "/home/travis/build/python/cpython/Lib/test/support/__init__.py", line 1936 in run_unittest File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest.py", line 164 in test_runner File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest.py", line 165 in runtest_inner File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest.py", line 119 in runtest File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest_mp.py", line 71 in run_tests_slave File "/home/travis/build/python/cpython/Lib/test/libregrtest/main.py", line 481 in _main File "/home/travis/build/python/cpython/Lib/test/libregrtest/main.py", line 474 in main File "/home/travis/build/python/cpython/Lib/test/libregrtest/main.py", line 538 in main File "/home/travis/build/python/cpython/Lib/test/regrtest.py", line 46 in _main File "/home/travis/build/python/cpython/Lib/test/regrtest.py", line 50 in File "/home/travis/build/python/cpython/Lib/runpy.py", line 85 in _run_code File "/home/travis/build/python/cpython/Lib/runpy.py", line 193 in _run_module_as_main ---------- components: Tests messages: 295854 nosy: davin, haypo, pitrou priority: normal severity: normal status: open title: test_basic_script_no_suffix() of test_multiprocessing_main_handling timeout after 20 min on Travis CI versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 03:46:00 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Jun 2017 07:46:00 +0000 Subject: [New-bugs-announce] [issue30644] [EASY][doc] Document that signal.set_wakeup_fd(-1), unregister the previsouly set wakeup FD Message-ID: <1497339960.02.0.417887628785.issue30644@psf.upfronthosting.co.za> Changes by STINNER Victor : ---------- assignee: docs at python components: Documentation keywords: easy nosy: docs at python, haypo priority: normal severity: normal status: open title: [EASY][doc] Document that signal.set_wakeup_fd(-1), unregister the previsouly set wakeup FD versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 04:25:25 2017 From: report at bugs.python.org (Alexandru Ardelean) Date: Tue, 13 Jun 2017 08:25:25 +0000 Subject: [New-bugs-announce] [issue30645] imp.py: load_package: function has a buggy loop with `path = os.path.join(path, '__init__'+extension)` Message-ID: <1497342325.52.0.976101644169.issue30645@psf.upfronthosting.co.za> New submission from Alexandru Ardelean: On OpenWrt, the Python & Python3 are shipped with bytecodes [also, bytecode compiling is disabled by default]. 2 reasons for that: 1) that would fill up flash/RAM 2) bytecodes can be up to 10x faster than Python source code I got a report of an issue with virtualenv on Python3, that had a weird path: the `virtualenv /test` would generate `/test/lib/virtualenv/__init__.py/__init__.pyc` The fix is here in the patch file: https://github.com/openwrt/packages/pull/4475/commits/576c45eb0a5314121aeb2f8d8931644b65e5be99 ---------- components: Library (Lib) messages: 295865 nosy: Alexandru Ardelean priority: normal severity: normal status: open title: imp.py: load_package: function has a buggy loop with `path = os.path.join(path, '__init__'+extension)` versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 04:34:13 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Jun 2017 08:34:13 +0000 Subject: [New-bugs-announce] [issue30646] SQLite: sqlite3_enable_shared_cache() is deprecated Message-ID: <1497342853.76.0.499200677365.issue30646@psf.upfronthosting.co.za> New submission from STINNER Victor: Warning seen on the macOS Travis CI job: "warning: 'sqlite3_enable_shared_cache' is deprecated: first deprecated in OS X 10.7" https://travis-ci.org/python/cpython/jobs/242325662 clang -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I./Include -I. -I/usr/local/opt/openssl/include -I/usr/local/include -I/Users/travis/build/python/cpython/Include -I/Users/travis/build/python/cpython -c /Users/travis/build/python/cpython/Modules/_gdbmmodule.c -o build/temp./Users/travis/build/python/cpython/Modules/_sqlite/module.c:136:10: warning: 'sqlite3_enable_shared_cache' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations] rc = sqlite3_enable_shared_cache(do_enable); ^ /usr/include/sqlite3.h:5170:31: note: 'sqlite3_enable_shared_cache' has been explicitly marked deprecated here SQLITE_API int SQLITE_STDCALLmacosx-10.11-x86_64-3.6-pydebug/Users/travis/build/python/cpython/Modules/_gdbmmodule.o sqlite3_enable_shared_cache(int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_2_0, __IPHONE_5_0); ^ 1 warning generated. ---------- components: Library (Lib), macOS messages: 295867 nosy: haypo, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: SQLite: sqlite3_enable_shared_cache() is deprecated versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 05:01:31 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Jun 2017 09:01:31 +0000 Subject: [New-bugs-announce] [issue30647] CODESET error on AMD64 FreeBSD 10.x Shared 3.x caused by the PEP 538 Message-ID: <1497344491.93.0.313119672521.issue30647@psf.upfronthosting.co.za> New submission from STINNER Victor: Regression caused by the commit 6ea4186de32d65b1f1dc1533b6312b798d300466, bpo-28180: Implementation for PEP 538. http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.x%20Shared%203.x/builds/412/steps/compile/logs/stdio Python detected LC_CTYPE=C: LC_CTYPE coerced to UTF-8 (set another locale or PYTHONCOERCECLOCALE=0 to disable this locale coercion behavior). Fatal Python error: Py_Initialize: Unable to get the locale encoding ValueError: CODESET is not set or empty Current thread 0x0000000802006400 (most recent call first): Abort trap (core dumped) ---------- components: Unicode messages: 295870 nosy: ezio.melotti, haypo priority: normal severity: normal status: open title: CODESET error on AMD64 FreeBSD 10.x Shared 3.x caused by the PEP 538 versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 05:14:50 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Jun 2017 09:14:50 +0000 Subject: [New-bugs-announce] [issue30648] test_logout() of test_imaplib.RemoteIMAP_STARTTLSTest failed randomly on s390x Debian 3.x Message-ID: <1497345290.02.0.962803410389.issue30648@psf.upfronthosting.co.za> New submission from STINNER Victor: The test failed on s390x Debian 3.x but then passed when run again. http://buildbot.python.org/all/builders/s390x%20Debian%203.x/builds/868/steps/test/logs/stdio 0:07:58 load avg: 1.15 [286/406/1] test_imaplib failed -- running: test_multiprocessing_spawn (76 sec) ... test_logincapa (test.test_imaplib.RemoteIMAPTest) ... ok test_logout (test.test_imaplib.RemoteIMAPTest) ... ok test_logincapa (test.test_imaplib.RemoteIMAP_SSLTest) ... ok test_logincapa_with_client_certfile (test.test_imaplib.RemoteIMAP_SSLTest) ... skipped "bpo-30175: FIXME: cyrus.andrew.cmu.edu doesn't accept our randomly generated client x509 certificate anymore" test_logincapa_with_client_ssl_context (test.test_imaplib.RemoteIMAP_SSLTest) ... skipped "bpo-30175: FIXME: cyrus.andrew.cmu.edu doesn't accept our randomly generated client x509 certificate anymore" test_logout (test.test_imaplib.RemoteIMAP_SSLTest) ... ok test_ssl_context_certfile_exclusive (test.test_imaplib.RemoteIMAP_SSLTest) ... ok test_ssl_context_keyfile_exclusive (test.test_imaplib.RemoteIMAP_SSLTest) ... ok test_logincapa (test.test_imaplib.RemoteIMAP_STARTTLSTest) ... ok test_logout (test.test_imaplib.RemoteIMAP_STARTTLSTest) ... FAIL ... ====================================================================== FAIL: test_logout (test.test_imaplib.RemoteIMAP_STARTTLSTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/dje/cpython-buildarea/3.x.edelsohn-debian-z/build/Lib/test/test_imaplib.py", line 916, in test_logout self.assertEqual(rs[0], 'BYE') AssertionError: 'NO' != 'BYE' - NO + BYE (...) Re-running test 'test_imaplib' in verbose mode (...) Ran 95 tests in 15.863s OK (skipped=2) ---------- components: Tests messages: 295874 nosy: haypo priority: normal severity: normal status: open title: test_logout() of test_imaplib.RemoteIMAP_STARTTLSTest failed randomly on s390x Debian 3.x versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 05:29:59 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Jun 2017 09:29:59 +0000 Subject: [New-bugs-announce] [issue30649] test_utime_current_old() of test_os fails randomy on x86 Windows7 3.6 Message-ID: <1497346199.32.0.269414659155.issue30649@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/x86%20Windows7%203.6/builds/416/steps/test/logs/stdio ====================================================================== FAIL: test_utime_current_old (test.test_os.UtimeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\test_os.py", line 644, in test_utime_current_old self._test_utime_current(set_time) File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\test_os.py", line 632, in _test_utime_current delta=delta, msg=msg) AssertionError: 1497323613.108506 != 1497323613.0692456 within 0.02 delta : st_time=1497323613.108506, current=1497323613.0692456, dt=0.0392603874206543 ---------------------------------------------------------------------- Ran 238 tests in 16.382s FAILED (failures=1, skipped=81) test test_os failed And then test_os passed. ---------- components: Tests, Windows keywords: buildbot messages: 295879 nosy: haypo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: test_utime_current_old() of test_os fails randomy on x86 Windows7 3.6 versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 05:42:38 2017 From: report at bugs.python.org (Messi Liao) Date: Tue, 13 Jun 2017 09:42:38 +0000 Subject: [New-bugs-announce] [issue30650] lack of right parentheses Message-ID: <1497346958.97.0.696530489581.issue30650@psf.upfronthosting.co.za> New submission from Messi Liao: lack of right parentheses ---------- components: Cross-Build files: posixmodule_compiler_error.png messages: 295883 nosy: Alex.Willmer, bh_binghu priority: normal pull_requests: 2207 severity: normal status: open title: lack of right parentheses type: compile error versions: Python 3.7 Added file: http://bugs.python.org/file46945/posixmodule_compiler_error.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 06:39:46 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Jun 2017 10:39:46 +0000 Subject: [New-bugs-announce] [issue30651] test_poplib.test_stls_context() access violation on x86 Windows7 3.6 buildbot Message-ID: <1497350386.85.0.94132048112.issue30651@psf.upfronthosting.co.za> New submission from STINNER Victor: test_stls_context() of test_poplib crashed with an access violation (Windows fatal exception) on x86 Windows7 3.6 buildbot. It seems like the crash occurred in OpenSSL. http://buildbot.python.org/all/builders/x86%20Windows7%203.6/builds/417/steps/test/logs/stdio I see 3 threads: * Thread 0x00000a20: asyncore.loop() called from DummyPOP3Server.run(), test_poplib.py:222: def run(self): self.active = True self.__flag.set() while self.active and asyncore.socket_map: self.active_lock.acquire() asyncore.loop(timeout=0.1, count=1) <~~~~ HERE self.active_lock.release() asyncore.close_all(ignore_all=True) * Current thread 0x00000a5c: self._sslobj.do_handshake() <= SSLObject.do_handshake() <= DummyPOP3Handler._do_tls_handshake() <= DummyPOP3Handler.handle_read() * Thread 0x00000360: socket.getaddrinfo() <= socket.create_connection() <= POP3._create_socket() <= POP3.__init__() <= TestPOP3Class.test_stls_context() of test_poplib.py:359 0:47:48 [207/405] test_poplib crashed Windows fatal exception: access violation Thread 0x00000a20 (most recent call first): File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\asyncore.py", line 144 in poll File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\asyncore.py", line 207 in loop File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\test_poplib.py", line 222 in run File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\threading.py", line 916 in _bootstrap_inner File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\threading.py", line 884 in _bootstrap Current thread 0x00000a5c (most recent call first): File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\ssl.py", line 683 in do_handshake File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\ssl.py", line 1061 in do_handshake File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\test_poplib.py", line 172 in _do_tls_handshake File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\test_poplib.py", line 189 in handle_read File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\asyncore.py", line 423 in handle_read_event File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\asyncore.py", line 83 in read File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\asyncore.py", line 150 in poll File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\asyncore.py", line 207 in loop File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\test_poplib.py", line 222 in run File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\threading.py", line 916 in _bootstrap_inner File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\threading.py", line 884 in _bootstrap Thread 0x00000360 (most recent call first): File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\socket.py", line 743 in getaddrinfo File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\socket.py", line 704 in create_connection File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\poplib.py", line 108 in _create_socket File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\poplib.py", line 102 in __init__ File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\test_poplib.py", line 359 in test_stls_context File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\unittest\case.py", line 601 in run File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\unittest\case.py", line 649 in __call__ File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\unittest\suite.py", line 122 in run File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\unittest\suite.py", line 84 in __call__ File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\unittest\suite.py", line 122 in run File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\unittest\suite.py", line 84 in __call__ File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\unittest\runner.py", line 176 in run File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\support\__init__.py", line 1889 in _run_suite File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\support\__init__.py", line 1923 in run_unittest File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\test_poplib.py", line 509 in test_main File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\libregrtest\runtest.py", line 165 in runtest_inner File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\libregrtest\runtest.py", line 119 in runtest File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\libregrtest\runtest_mp.py", line 71 in run_tests_slave File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\libregrtest\main.py", line 475 in _main File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\libregrtest\main.py", line 468 in main File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\libregrtest\main.py", line 532 in main File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\regrtest.py", line 46 in _main File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\test\regrtest.py", line 50 in File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\runpy.py", line 85 in _run_code File "D:\cygwin\home\db3l\buildarea\3.6.bolen-windows7\build\lib\runpy.py", line 193 in _run_module_as_main ... Exception: Child error on test_poplib: Exit code 3221225477 ---------- assignee: christian.heimes components: SSL, Tests, Windows keywords: buildbot messages: 295891 nosy: alex, christian.heimes, dstufft, haypo, janssen, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: test_poplib.test_stls_context() access violation on x86 Windows7 3.6 buildbot versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 07:25:58 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Jun 2017 11:25:58 +0000 Subject: [New-bugs-announce] [issue30652] test_threading_not_handled() hangs randomly on AMD64 FreeBSD 10.x Shared 3.6 Message-ID: <1497353158.56.0.0471147763095.issue30652@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.x%20Shared%203.6/builds/218/steps/test/logs/stdio 0:16:16 [405/405] test_socketserver crashed Timeout (0:15:00)! Thread 0x0000000802006400 (most recent call first): File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/threading.py", line 295 in wait File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/threading.py", line 551 in wait File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/test_socketserver.py", line 369 in wait_done File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/test_socketserver.py", line 341 in __init__ File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/test_socketserver.py", line 362 in __init__ File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/test_socketserver.py", line 312 in test_threading_not_handled File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/case.py", line 601 in run File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/case.py", line 649 in __call__ File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/suite.py", line 122 in run File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/suite.py", line 84 in __call__ File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/suite.py", line 122 in run File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/suite.py", line 84 in __call__ File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/suite.py", line 122 in run File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/suite.py", line 84 in __call__ File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/unittest/runner.py", line 176 in run File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/support/__init__.py", line 1889 in _run_suite File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/support/__init__.py", line 1923 in run_unittest File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/libregrtest/runtest.py", line 164 in test_runner File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/libregrtest/runtest.py", line 165 in runtest_inner File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/libregrtest/runtest.py", line 119 in runtest File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/libregrtest/runtest_mp.py", line 71 in run_tests_slave File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/libregrtest/main.py", line 475 in _main File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/libregrtest/main.py", line 468 in main File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/libregrtest/main.py", line 532 in main File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/regrtest.py", line 46 in _main File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/test/regrtest.py", line 50 in File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/runpy.py", line 85 in _run_code File "/usr/home/buildbot/python/3.6.koobs-freebsd10/build/Lib/runpy.py", line 193 in _run_module_as_main ---------- components: Tests keywords: buildbot messages: 295903 nosy: haypo priority: normal severity: normal status: open title: test_threading_not_handled() hangs randomly on AMD64 FreeBSD 10.x Shared 3.6 versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 07:32:06 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Jun 2017 11:32:06 +0000 Subject: [New-bugs-announce] [issue30653] test_socket hangs in ThreadableTest.tearDown() on AMD64 FreeBSD CURRENT Debug 3.6 Message-ID: <1497353526.11.0.249152453229.issue30653@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Debug%203.6/builds/231/steps/test/logs/stdio 0:28:11 [405/405] test_socket crashed Timeout (0:15:00)! Thread 0x0000000801816000 (most recent call first): File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/threading.py", line 295 in wait File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/threading.py", line 551 in wait File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_socket.py", line 273 in _tearDown File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/unittest/case.py", line 604 in run File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/unittest/case.py", line 649 in __call__ File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/unittest/suite.py", line 122 in run File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/unittest/suite.py", line 84 in __call__ File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/unittest/suite.py", line 122 in run File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/unittest/suite.py", line 84 in __call__ File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/unittest/runner.py", line 176 in run File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/support/__init__.py", line 1889 in _run_suite File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/support/__init__.py", line 1923 in run_unittest File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/test_socket.py", line 5637 in test_main File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/libregrtest/runtest.py", line 165 in runtest_inner File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/libregrtest/runtest.py", line 119 in runtest File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/libregrtest/runtest_mp.py", line 71 in run_tests_slave File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/libregrtest/main.py", line 475 in _main File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/libregrtest/main.py", line 468 in main File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/libregrtest/main.py", line 532 in main File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/regrtest.py", line 46 in _main File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/test/regrtest.py", line 50 in File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/runpy.py", line 85 in _run_code File "/usr/home/buildbot/python/3.6.koobs-freebsd-current/build/Lib/runpy.py", line 193 in _run_module_as_main ---------- components: Tests keywords: buildbot messages: 295906 nosy: haypo priority: normal severity: normal status: open title: test_socket hangs in ThreadableTest.tearDown() on AMD64 FreeBSD CURRENT Debug 3.6 versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 09:06:04 2017 From: report at bugs.python.org (pkerling) Date: Tue, 13 Jun 2017 13:06:04 +0000 Subject: [New-bugs-announce] [issue30654] signal module always overwrites SIGINT on interpreter shutdown Message-ID: <1497359164.84.0.615765342748.issue30654@psf.upfronthosting.co.za> New submission from pkerling: The signal module checks the SIGINT handler on startup. It only registers a new custom handler if the default OS handler is still installed, so that when embedding python in an application the SIGINT handler of that application is not overwritten. But on shutdown in finisignal, it *always* sets SIGINT to SIG_DFL. The reason is that it saves the old handler in old_siginthandler, but *only* if the signal handler is overwritten in init, which only happens when it was SIG_DFL in the first place! If there was already a handler in place in init (-> no overwriting), old_siginthandler will default to the initialization value, which is also SIG_DFL. This means that when an application embeds Python and needs a custom SIGINT handler, it will stop to work as soon as it shuts down Python since it will always be reset to SIG_DFL. ---------- components: Interpreter Core messages: 295915 nosy: pkerling priority: normal severity: normal status: open title: signal module always overwrites SIGINT on interpreter shutdown type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 10:02:56 2017 From: report at bugs.python.org (Agam Shukla) Date: Tue, 13 Jun 2017 14:02:56 +0000 Subject: [New-bugs-announce] [issue30655] speech module Message-ID: <1497362576.62.0.877533379798.issue30655@psf.upfronthosting.co.za> New submission from Agam Shukla: when you will use this module for developing a chatbox you will get error that prompt is missing parenthesis. I HAVE SOLVED THIS ERROR AND UPLOADING NEW MODULE. ---------- files: speech.py messages: 295917 nosy: agamstark7 priority: normal severity: normal status: open title: speech module type: compile error versions: Python 3.6 Added file: http://bugs.python.org/file46947/speech.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 10:40:09 2017 From: report at bugs.python.org (Jan Hnatek) Date: Tue, 13 Jun 2017 14:40:09 +0000 Subject: [New-bugs-announce] [issue30656] typo in PyModule_New documentation Message-ID: <1497364809.31.0.0904265199441.issue30656@psf.upfronthosting.co.za> New submission from Jan Hnatek: The doc for PyModule_New() refers to "PyImport_NewObject()", while it should refer to "PyModule_NewObject()": https://docs.python.org/3.6/c-api/module.html#c.PyModule_New ---------- assignee: docs at python components: Documentation messages: 295922 nosy: docs at python, hnhn priority: normal severity: normal status: open title: typo in PyModule_New documentation versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 11:35:29 2017 From: report at bugs.python.org (Jay Bosamiya) Date: Tue, 13 Jun 2017 15:35:29 +0000 Subject: [New-bugs-announce] [issue30657] Unsafe arithmetic in PyString_DecodeEscape Message-ID: <1497368129.36.0.20181989843.issue30657@psf.upfronthosting.co.za> New submission from Jay Bosamiya: In Python 2.7, there is a possible integer overflow in PyString_DecodeEscape function of the file stringobject.c, which can be abused to gain a heap overflow, possibly leading to arbitrary code execution. The relevant parts of the code are highlighted below: PyObject *PyString_DecodeEscape(const char *s, Py_ssize_t len, const char *errors, Py_ssize_t unicode, const char *recode_encoding) { int c; char *p, *buf; const char *end; PyObject *v; (1) Py_ssize_t newlen = recode_encoding ? 4*len:len; (2) v = PyString_FromStringAndSize((char *)NULL, newlen); if (v == NULL) return NULL; (3) p = buf = PyString_AsString(v); end = s + len; while (s < end) { if (*s != '\\') { non_esc: #ifdef Py_USING_UNICODE [...] #else *p++ = *s++; #endif continue; [...] } } (4) if (p-buf < newlen) _PyString_Resize(&v, p - buf); /* v is cleared on error */ return v; failed: Py_DECREF(v); return NULL; } (1) If recode_encoding is true (i.e., non-null), we have an integer overflow here which can set newlen to be some very small value (2) This allows a small string to be created into v (3) Now p (and buf) use that small string (4) The small string is copied into with a larger string, thereby giving a heap buffer overflow In the highly unlikely but definitely possible situation that we pass it a very large string (in the order of ~1GB on a 32-bit Python install), one can reliably get heap corruption. It is possible to access this function (and condition in line(1)) through function parsestr from ast.c, when the file encoding of an input .py file is something apart from utf-8 and iso-8859-1. This can be trivially done using the following at the start of the file: # -*- coding: us-ascii -*- The attached file (poc-gen.py) produces a poc.py file which satisfies these constraints and shows the vulnerability. Note: To see the vulnerability in action, it is necessary to have an ASAN build of Python, compiled for 32 bit on a 64 bit machine. Additionally, the poc.py file generated can take an extremely long time to load (over a few hours), and finally crash. Instead, if one wishes to see the proof of vulnerability quicker, then it might be better to change the constant 4 in line (1) to 65536 (just for simplicity sake), and change the multiplication_constant in poc-gen.py file to be the same (i.e. 65536). Proposed fix: Confirm that the multiplication will not overflow, before actually performing the multiplication and depending on the result. ---------- components: Interpreter Core files: poc-gen.py messages: 295930 nosy: jaybosamiya priority: normal severity: normal status: open title: Unsafe arithmetic in PyString_DecodeEscape type: security versions: Python 2.7 Added file: http://bugs.python.org/file46950/poc-gen.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 12:16:03 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 13 Jun 2017 16:16:03 +0000 Subject: [New-bugs-announce] [issue30658] Buildbot: don't sent email notification for custom builders Message-ID: <1497370563.44.0.51668775435.issue30658@psf.upfronthosting.co.za> New submission from STINNER Victor: Sadly, our version of buildbot doesn't support branches. Other options: http://docs.buildbot.net/latest/manual/cfg-reporters.html#mailnotifier-arguments ---------- components: Tests messages: 295936 nosy: haypo, zach.ware priority: normal severity: normal status: open title: Buildbot: don't sent email notification for custom builders versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 14:49:23 2017 From: report at bugs.python.org (Ben Hoyt) Date: Tue, 13 Jun 2017 18:49:23 +0000 Subject: [New-bugs-announce] [issue30659] Use ** correctly for "kwargs" in signature of namedtuple._replace() Message-ID: <1497379763.32.0.322552703927.issue30659@psf.upfronthosting.co.za> New submission from Ben Hoyt: The documentation for namedtuple._replace() needs a tweak: currently its signature shows "kwargs" without the ** notation, indicating it's a single, positional argument. It should have the ** to indicate it's actually any number of keyword arguments. See https://docs.python.org/3/library/collections.html#collections.somenamedtuple._replace and compare with the docs for the signature of Logger.debug() for example: https://docs.python.org/3/library/logging.html#logging.Logger.debug ---------- assignee: docs at python components: Documentation messages: 295949 nosy: benhoyt, docs at python, rhettinger priority: normal pull_requests: 2225 severity: normal status: open title: Use ** correctly for "kwargs" in signature of namedtuple._replace() versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 19:11:28 2017 From: report at bugs.python.org (Tiago Filipe Silva) Date: Tue, 13 Jun 2017 23:11:28 +0000 Subject: [New-bugs-announce] [issue30660] Lossless Optimization of PNG files Message-ID: <1497395488.74.0.644428672228.issue30660@psf.upfronthosting.co.za> New submission from Tiago Filipe Silva: I took the liberty to apply tools that optimize the binary weight (without loss of quality) of the 14 PNG files present in the Python 3.7 source tree and then applied a pull request (#2141). Is there anything to be discussed? Thanks. ---------- messages: 295969 nosy: tfs priority: normal pull_requests: 2229 severity: normal status: open title: Lossless Optimization of PNG files type: resource usage versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 13 21:25:39 2017 From: report at bugs.python.org (Nick Coghlan) Date: Wed, 14 Jun 2017 01:25:39 +0000 Subject: [New-bugs-announce] [issue30661] Support tarfile.PAX_FORMAT in shutil.make_archive Message-ID: <1497403539.2.0.760105950979.issue30661@psf.upfronthosting.co.za> New submission from Nick Coghlan: shutil.make_archive currently just uses the default tar format, which is GNU_FORMAT. This format doesn't ensure that all character paths are encoded as UTF-8, and hence may end up embedding platform specific encoding assumptions into the generated tarball. I see a few possible ways of resolving this: 1. Change the default tar format to PAX_FORMAT. It's been 16 years since that was defined, and Python itself has supported it since 2.6 was released in 2008, so perhaps we can rely on other tools supporting it now? (My main open question on that front would be "What happens if you specify "format=GNU_FORMAT" when attempting to read a PAX formatted archive?) 2. Add new shutil level "pax", "gzpax", "bzpax", "xzpax" format definitions to explicitly request PAX_FORMAT 3. Add a mechanism to shutil.make_archive that allows format-dependent settings to be based down to the underlying archive creation functions (e.g. "format=tarfile.PAX_FORMAT"). ---------- messages: 295974 nosy: ncoghlan priority: normal severity: normal stage: needs patch status: open title: Support tarfile.PAX_FORMAT in shutil.make_archive type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 14 00:46:11 2017 From: report at bugs.python.org (Jonathan Eunice) Date: Wed, 14 Jun 2017 04:46:11 +0000 Subject: [New-bugs-announce] [issue30662] fix OrderedDict.__init__ docstring to reflect PEP 468 Message-ID: <1497415571.04.0.452545099566.issue30662@psf.upfronthosting.co.za> New submission from Jonathan Eunice: In Python 3.6 and current repo (pre-3.7), the docstring for collections.OrderedDict.__init__() stats that keyword argument order is arbitrary. That is untrue if I properly understand PEP 468, which as of Python 3.6 makes the order of kwargs stable / identical to the order seen in the source code. Associated PR imminent. ---------- components: Library (Lib) messages: 295982 nosy: jonathaneunice priority: normal severity: normal status: open title: fix OrderedDict.__init__ docstring to reflect PEP 468 versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 14 05:14:41 2017 From: report at bugs.python.org (Louie Lu) Date: Wed, 14 Jun 2017 09:14:41 +0000 Subject: [New-bugs-announce] [issue30663] IDLE: Add lineno sidebar to editor window Message-ID: <1497431681.4.0.503512983326.issue30663@psf.upfronthosting.co.za> New submission from Louie Lu: In #7676, the desired pattern request from Terry is to create a sidebar and show the prompt in the sidebar. To complete the request, this patch add the lineno sidebar in editor window , to prove that the sidebar in IDLE is feasible. The different in pyshell, it that the sidebar will need to deal with indent (to not show the prompt). ---------- assignee: terry.reedy components: IDLE messages: 295995 nosy: louielu, terry.reedy priority: normal severity: normal status: open title: IDLE: Add lineno sidebar to editor window type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 14 08:00:09 2017 From: report at bugs.python.org (Eric V. Smith) Date: Wed, 14 Jun 2017 12:00:09 +0000 Subject: [New-bugs-announce] [issue30664] Change unittest's _SubTest to not sort its params Message-ID: <1497441609.86.0.0434143271813.issue30664@psf.upfronthosting.co.za> New submission from Eric V. Smith: Now that **kwargs are sorted, it would be better if the error given by a unittest subTest (as implemented in uniitest._case._SubTest) didn't sort the parameters when they're printed, but instead printed them out in order. This might be complicated by the ChainMap that's used as part of the implementation, but it should still be doable. For example, I have code that has: with self.subTest(hash=hash, cmp=cmp, frozen=frozen): But when it errors out, it produces: FAIL: test_hash_rules (tst.TestCase) (cmp=True, frozen=True, hash=None) It would be easier to check my code if the order the values was printed was the same as the order in the self.subTest() call. ---------- components: Library (Lib) keywords: easy messages: 295998 nosy: eric.smith priority: normal severity: normal status: open title: Change unittest's _SubTest to not sort its params type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 14 10:27:52 2017 From: report at bugs.python.org (=?utf-8?q?Uwe_Kleine-K=C3=B6nig?=) Date: Wed, 14 Jun 2017 14:27:52 +0000 Subject: [New-bugs-announce] [issue30665] pass big values for arg to fcntl.ioctl Message-ID: <1497450472.17.0.838126084809.issue30665@psf.upfronthosting.co.za> New submission from Uwe Kleine-K?nig: When passing a big integer value to fcntl.ioctl this might result in OverflowError: signed integer is greater than maximum . Traditionally ioctl(3) takes a pointer as third argument. The fcntl module however uses an int (format specifier 'i') which is too small to hold a pointer on 64 bit architectures. The fix is to use 'k' (and an unsigned long) instead of 'i' (and an int). An unsigned long is suitable to hold a pointer value on AFAIK all platforms that matter today. (And it works on all platforms where int is already good enough, so the suggested change doesn't do any harm.) A patch is attached. ---------- files: unsigned-long-arg-for-ioctl.patch keywords: patch messages: 296008 nosy: ukl priority: normal severity: normal status: open title: pass big values for arg to fcntl.ioctl type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file46951/unsigned-long-arg-for-ioctl.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 14 14:15:40 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Wed, 14 Jun 2017 18:15:40 +0000 Subject: [New-bugs-announce] [issue30666] IDLE: add tests for auto-completions Message-ID: <1497464140.48.0.517260109183.issue30666@psf.upfronthosting.co.za> New submission from Terry J. Reedy: 1. Test_autocomplete.AutoCompleteTest has a test_method for each method of autocomplete.AutoComplete. The last 5 test methods are empty ('pass'). Finish them. A couple of the methods might be usefully split into smaller methods. Get_entity is actually a function, as 'self' is ignored. After the first else, fetch_completions is also independent of 'self'. PR 2011 combines the two blocks into a function that can be moved to run.py. These method tests should be supplemented by user action tests with live widgets and simulated key events. Such tests would be black box tests in that they should be independent of the implementation. 2. AutoCompleteWindow, in autocomplete_w, is untested. It was the locus of the bug in #15786. To get the fix into 3.6.2, it was merged after hand-testing, without adding automated tests. They need to be added before further patching. Some of the methods of ACW seem hard to test as they are long and hard to describe succinctly. Perhaps black-box user tests should be emphasized for this class. ---------- messages: 296019 nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE: add tests for auto-completions type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 14 14:25:38 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Wed, 14 Jun 2017 18:25:38 +0000 Subject: [New-bugs-announce] [issue30667] IDLE: revise doc subsections 'Completions' Message-ID: <1497464738.2.0.763247679228.issue30667@psf.upfronthosting.co.za> New submission from Terry J. Reedy: The current subsection omits Expand Word and seems not as clear as it could be. Completions rely on source information. Three possible sources are the text, Shell globals, and filesystem. Open latter two by tab, shortcut, or (in special circumstance) wait. ---------- assignee: terry.reedy components: IDLE messages: 296020 nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE: revise doc subsections 'Completions' type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 14 14:27:06 2017 From: report at bugs.python.org (Cheryl Sabella) Date: Wed, 14 Jun 2017 18:27:06 +0000 Subject: [New-bugs-announce] [issue30668] DOC: missing word in license.rst Message-ID: <1497464826.74.0.48412228971.issue30668@psf.upfronthosting.co.za> New submission from Cheryl Sabella: The 'Select kqueue' section starts with: "The `select` and contains the following notice for the kqueue interface:" And the 'SipHash24' section has: "The file Python/pyhash.c contains Marek Majkowski? implementation of Dan Bernstein?s SipHash24 algorithm. The contains the following note:" It seems like a word is missing on each line. Maybe `module`? ---------- assignee: docs at python components: Documentation messages: 296021 nosy: christian.heimes, csabella, docs at python priority: normal severity: normal status: open title: DOC: missing word in license.rst type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 14 21:38:17 2017 From: report at bugs.python.org (eartheaterrr) Date: Thu, 15 Jun 2017 01:38:17 +0000 Subject: [New-bugs-announce] [issue30669] json.tool does not accept an --indent flag Message-ID: <1497490697.08.0.450188302857.issue30669@psf.upfronthosting.co.za> New submission from eartheaterrr: I have been using the json.tool quite often by running `cat my-file.json | python -m json.tool` or (`:%! python -m json.tool` in vim) to pretty print the json file, but I would like to customize the indentation level to 2 indentation spaces instead of default of 4. Unfortunately, `json.tool` is hard-coded to use 4 spaces for indentation, so I am filing this issue to propose this change. ---------- components: Library (Lib) messages: 296055 nosy: eartheaterrr priority: normal pull_requests: 2251 severity: normal status: open title: json.tool does not accept an --indent flag type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 14 22:15:55 2017 From: report at bugs.python.org (Joseph Shen) Date: Thu, 15 Jun 2017 02:15:55 +0000 Subject: [New-bugs-announce] [issue30670] pprint for dict in sorted order or insert order? Message-ID: <1497492955.33.0.313949068523.issue30670@psf.upfronthosting.co.za> New submission from Joseph Shen: start from 3.6+, dict keys are ordered heir creation order. the builtin print function works as we expected, but for pprint, the keys is sorted. should we using the sorted version or just obey the creation order as builtin print? ---------- components: Library (Lib) messages: 296056 nosy: josephsmeng priority: normal severity: normal status: open title: pprint for dict in sorted order or insert order? type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 03:25:26 2017 From: report at bugs.python.org (Dmitry Rubanovich) Date: Thu, 15 Jun 2017 07:25:26 +0000 Subject: [New-bugs-announce] [issue30671] dict: simplify and improve lookup function Message-ID: <1497511526.4.0.248351219099.issue30671@psf.upfronthosting.co.za> New submission from Dmitry Rubanovich: lookdict_index() (and the rest of the files in dictobject.c) are using unnecessarily complicated perturb mechanism. And, in fact, it's slower than the simpler case. Instead of this: for (size_t perturb = hash;;) { perturb >>= PERTURB_SHIFT; i = mask & ((i << 2) + i + perturb + 1); .... it should do this: for (size_t perturb = hash;;) { i = mask & ((i << 1) + perturb + 1); perturb >>= PERTURB_SHIFT; .... This would not only save an instruction (a minor issue), but it would also reduce collisions. I've attached a file which calculates frequencies of collisions for demonstration purposes. It shows that the calculation, as it stands right now, does not create a 1-1 mapping even on the 1st iteration through the loop. Moving PERTURB_SHIFT to the line before the calculation does reduce the density of the collision space. But using the calculation, which I proposed, eliminates collisions on the 1st iteration completely and reduces it on most subsequent iterations. ---------- components: Interpreter Core messages: 296072 nosy: Dmitry Rubanovich, inada.naoki, rhettinger, serhiy.storchaka, xiang.zhang priority: normal severity: normal status: open title: dict: simplify and improve lookup function type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46953/collisions_count.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 05:23:53 2017 From: report at bugs.python.org (Nick Coghlan) Date: Thu, 15 Jun 2017 09:23:53 +0000 Subject: [New-bugs-announce] [issue30672] PEP 538: Unexpected locale behaviour on Mac OS X Message-ID: <1497518633.36.0.998856107706.issue30672@psf.upfronthosting.co.za> New submission from Nick Coghlan: To get the new PEP 538 tests passing on Mac OS X (see [1,2]), I ended up having to skip the following test scenarios: LANG=UTF-8 (behaves like LANG=C, *not* LC_CTYPE=UTF-8) LANG=POSIX (behaves like a distinct locale is set, not LANG=C) LC_CTYPE=POSIX (behaves like a distinct locale is set, not LANG=C) LC_ALL=POSIX (behaves like a distinct locale is set, not LANG=C) However, I'm not sure whether that should be diagnosed as a pure testing problem, where we change the test's expectations to match the current behaviour, or a bug in the PEP 538 implementation, where we should be updating it to produce the behaviour that the tests were originally expecting. [1] https://github.com/python/cpython/commit/4563099d28e832aed22b85ce7e2a92236df03847 [2] https://github.com/python/cpython/commit/7926516ff95ed9c8345ed4c4c4910f44ffbd5949 ) ---------- components: Tests messages: 296076 nosy: haypo, ncoghlan, ned.deily, ronaldoussoren priority: normal severity: normal stage: test needed status: open title: PEP 538: Unexpected locale behaviour on Mac OS X type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 07:01:54 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 15 Jun 2017 11:01:54 +0000 Subject: [New-bugs-announce] [issue30673] Add -t option (timeout) to Tools/buildbot/test.bat for "AMD64 Windows8.1 Refleaks 3.x" buildbot Message-ID: <1497524514.07.0.657650924197.issue30673@psf.upfronthosting.co.za> New submission from STINNER Victor: I need this option to increase the timeout (currently of 20 min) per test file on the "AMD64 Windows8.1 Refleaks 3.x" buildbot. We already changed the buildbot timeout (timeout x 10 for refleaks tests): https://github.com/python/buildmaster-config/commit/77316bfe4a5428650d1b120c32d9d65fa69e9c8f The test step on this buildbot takes 2h30. On the same buildbot slave server, the "AMD64 Windows8.1 Non-Debug 3.x" buildbot takes less than 20 min for the whole "step" step! For the "x86 Gentoo Refleaks 3.x" buildbot, the buildbot timeout is 12000 seconds and the regrtest timeout is 11700 seconds. But on Windows, we don't support "regrtest timeout" yet, it's currently hardcoded to 20 min. ---------- components: Tests, Windows messages: 296080 nosy: haypo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Add -t option (timeout) to Tools/buildbot/test.bat for "AMD64 Windows8.1 Refleaks 3.x" buildbot versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 08:27:17 2017 From: report at bugs.python.org (Cheryl Sabella) Date: Thu, 15 Jun 2017 12:27:17 +0000 Subject: [New-bugs-announce] [issue30674] IDLE: add docstrings to grep.py Message-ID: <1497529637.46.0.304761889096.issue30674@psf.upfronthosting.co.za> Changes by Cheryl Sabella : ---------- assignee: terry.reedy components: IDLE nosy: csabella, terry.reedy priority: normal severity: normal status: open title: IDLE: add docstrings to grep.py type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 09:17:07 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 15 Jun 2017 13:17:07 +0000 Subject: [New-bugs-announce] [issue30675] test_zipfile leaks references on Python 3.5 on the wo Refleaks buildbots (Gentoo, Windows) Message-ID: <1497532627.0.0.192797490267.issue30675@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%203.5/builds/27/steps/test/logs/stdio [336/398/5] test_zipfile beginning 6 repetitions 123456 ...... test_zipfile leaked [3, 9, 8] references, sum=20 test_zipfile leaked [3, 9, 8] memory blocks, sum=20 (...) Re-running test 'test_zipfile' in verbose mode (...) OK (skipped=1) http://buildbot.python.org/all/builders/x86%20Gentoo%20Refleaks%203.5/builds/30/steps/test/logs/stdio [135/398/3] test_zipfile beginning 6 repetitions 123456 ...... test_zipfile leaked [6, 6, 9] references, sum=21 test_zipfile leaked [6, 8, 11] memory blocks, sum=25 (...) Re-running test 'test_zipfile' in verbose mode (...) OK (skipped=1) ---------- components: Tests keywords: buildbot messages: 296084 nosy: haypo priority: normal severity: normal status: open title: test_zipfile leaks references on Python 3.5 on the wo Refleaks buildbots (Gentoo, Windows) type: resource usage versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 09:34:17 2017 From: report at bugs.python.org (Stephan R.A. Deibel) Date: Thu, 15 Jun 2017 13:34:17 +0000 Subject: [New-bugs-announce] [issue30676] Potential for GIL deadlock on Windows in threadmodule acquire_lock Message-ID: <1497533657.78.0.0164938560567.issue30676@psf.upfronthosting.co.za> New submission from Stephan R.A. Deibel: In acquire_timed in _threadmodule.c (used to implement threading lock acquire()) there is an optimization from https://github.com/python/cpython/commit/e75ff35af2b6c85d48c68b95f295aeac7396b162 that says it first tries non-blocking lock w/o releasing the GIL. However, it seems that this call can block on Windows. The call to PyThread_acquire_lock_timed(lock, 0, 0) (w/o releasing GIL) on Windows calls EnterNonRecursiveMutex which in turn, in the _PY_USE_CV_LOCKS impl, immediately calls PyMUTEX_LOCK as if it's not going to block. However, various implementations of this seem like they can block. Specifically, the impls of PyMUTEX_LOCK that end up using AcquireSRWLockExclusive and EnterCriticalSection both block. The only case that is correct (does not block) is when !_PY_USE_CV_LOCKS where EnterNonRecursiveMutex() instead calls WaitForSingleObjectEx() with the zero timeout. This seems like an incorrect potential for GIL deadlock, because the thread blocks without releasing GIL. Shouldn't it ultimately be using TryAcquireSRWLockExclusive and TryEnterCriticalSection in these two cases? This seems like an issue on Windows only. The pthreads implementations look like they correctly handle timeout of 0 sent to PyThread_acquire_lock_timed(). ---------- components: Library (Lib), Windows messages: 296088 nosy: paul.moore, sdeibel, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Potential for GIL deadlock on Windows in threadmodule acquire_lock type: behavior versions: Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 10:08:58 2017 From: report at bugs.python.org (Enrico Bianchi) Date: Thu, 15 Jun 2017 14:08:58 +0000 Subject: [New-bugs-announce] [issue30677] Enhance documentation of os.mkdir() Message-ID: <1497535738.66.0.994856278172.issue30677@psf.upfronthosting.co.za> New submission from Enrico Bianchi: Currently, documentation for os.mkdir() (see https://docs.python.org/3.6/library/os.html#os.mkdir ) reports only FileExistsError exception if directory exists. Please, add other exceptions (e.g. FileNotFoundError if directory is created in a non existent path) or report OSError as superclass of exceptions returned from this method ---------- assignee: docs at python components: Documentation messages: 296097 nosy: docs at python, ebianchi priority: normal severity: normal status: open title: Enhance documentation of os.mkdir() type: enhancement versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 10:37:56 2017 From: report at bugs.python.org (Javier Dehesa) Date: Thu, 15 Jun 2017 14:37:56 +0000 Subject: [New-bugs-announce] [issue30678] Widget variable binding does not work if mainloop is called from a different function Message-ID: <1497537476.52.0.54900558235.issue30678@psf.upfronthosting.co.za> New submission from Javier Dehesa: When you build a Tkinter interface with variables, if tkinter.Tk.mainloop is called from a different function that the one creating the variable objects, then in some cases the widgets associated with the variables will not be set to the right value. I have not been able to find a consistent pattern, but I have some examples. The following script works correctly: ``` import tkinter as tk from tkinter import ttk def make_var_cb(root): v = tk.BooleanVar(root, True) cb = ttk.Checkbutton(root, text='Checkbutton', variable=v) cb.pack() root.mainloop() if __name__ == '__main__': root = tk.Tk() make_var_cb(root) ``` But the following does not (the result is shown in the attached image): ``` import tkinter as tk from tkinter import ttk def make_var_cb(root): v = tk.BooleanVar(root, True) cb = ttk.Checkbutton(root, text='Checkbutton', variable=v) cb.pack() if __name__ == '__main__': root = tk.Tk() make_var_cb(root) root.mainloop() ``` However, the following _does_ work again: ``` def make_var(root): return tk.BooleanVar(root, True) def make_cb(root, v): return ttk.Checkbutton(root, text='Checkbutton', variable=v) if __name__ == '__main__': root = tk.Tk() v = make_var(root) cb = make_cb(root, v) cb.pack() root.mainloop() ``` ---------- components: Tkinter, Windows files: checkbutton_bad.png messages: 296100 nosy: Javier Dehesa, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Widget variable binding does not work if mainloop is called from a different function type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file46954/checkbutton_bad.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 11:27:28 2017 From: report at bugs.python.org (Arthur Darcet) Date: Thu, 15 Jun 2017 15:27:28 +0000 Subject: [New-bugs-announce] [issue30679] __aexit__ not called when `run_until_complete` is interrupted by SIGINT Message-ID: <1497540448.31.0.823018030843.issue30679@psf.upfronthosting.co.za> New submission from Arthur Darcet: Here is the example code I am running: ``` import asyncio class it: async def __aenter__(self): return self async def __aexit__(self, *_): print('EXIT') async def main(): async with it(): await asyncio.sleep(100) asyncio.get_event_loop().run_until_complete(main()) ``` When this gets interrupted by a SIGINT, I would expect this code to display `EXIT` before the `KeyboardInterrupt` stacktrace. But instead the `__aexit__` function is simply not called. ---------- components: asyncio messages: 296106 nosy: rthr, yselivanov priority: normal pull_requests: 2264 severity: normal status: open title: __aexit__ not called when `run_until_complete` is interrupted by SIGINT versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 15:09:00 2017 From: report at bugs.python.org (Jonathan Eunice) Date: Thu, 15 Jun 2017 19:09:00 +0000 Subject: [New-bugs-announce] [issue30680] textwrap should treat Unicode em-dash like ASCII em-dash Message-ID: <1497553740.26.0.99906894046.issue30680@psf.upfronthosting.co.za> New submission from Jonathan Eunice: The textwrap module goes to great lengths to "do the right thing" when it finds the ASCII simulation of an em-dash (two or more consecutive hyphens), but it does nothing to recognize and similarly treat true (Unicode) em-dashes (aka '\N{EM DASH}', '\u2014', or U+2014). Real em-dashes should get at least as good a treatment as simulated em-dashes. ---------- components: Library (Lib) messages: 296124 nosy: jonathaneunice priority: normal severity: normal status: open title: textwrap should treat Unicode em-dash like ASCII em-dash type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 15 19:12:43 2017 From: report at bugs.python.org (Tim Bell) Date: Thu, 15 Jun 2017 23:12:43 +0000 Subject: [New-bugs-announce] [issue30681] email.utils.parsedate_to_datetime() should return None when date cannot be parsed Message-ID: <1497568363.46.0.596536376967.issue30681@psf.upfronthosting.co.za> New submission from Tim Bell: Python 3.6 documentation for email.utils.parsedate_to_datetime() says "Performs the same function as parsedate(), but on success returns a datetime." The docs for parsedate() say "If it succeeds in parsing the date...; otherwise None will be returned." By implication, parsedate_to_datetime() should return None when the date can't be parsed. There are two different failure modes for parsedate_to_datetime(): 1. When _parsedate_tz() fails to parse the date and returns None: >>> from email.utils import parsedate_to_datetime >>> parsedate_to_datetime('0') Traceback (most recent call last): File "", line 1, in 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 2. When _parsedate_tz() succeeds, but conversion to datetime.datetime fails: >>> parsedate_to_datetime('Tue, 06 Jun 2017 27:39:33 +0600') Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.6/email/utils.py", line 214, in parsedate_to_datetime tzinfo=datetime.timezone(datetime.timedelta(seconds=tz))) ValueError: hour must be in 0..23 Note that this second case is the one that led me to this issue. I am using the email package to parse spam emails for subsequent analysis, and a certain group of spam emails contain invalid hour fields in their Date header. I don't require the invalid Date header to be converted to a datetime.datetime, but accessing email_message['date'] to access the header value as a string triggers the ValueError exception. I can work around this with a custom email policy, but the observed behaviour does seem to contradict the documented behaviour. Also, in relation to https://bugs.python.org/issue15925, r.david.murray commented "Oh, and I'm purposely allowing parsedate_to_datetime throw exceptions. I suppose that should be documented, but that's a separate issue." However, no argument for why parsedate_to_datetime throwing exceptions is desired was given. ---------- components: email messages: 296137 nosy: barry, r.david.murray, timb07 priority: normal severity: normal status: open title: email.utils.parsedate_to_datetime() should return None when date cannot be parsed type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 16 05:13:47 2017 From: report at bugs.python.org (Eric V. Smith) Date: Fri, 16 Jun 2017 09:13:47 +0000 Subject: [New-bugs-announce] [issue30682] f-string assert is too restrictive Message-ID: <1497604427.55.0.696154643754.issue30682@psf.upfronthosting.co.za> New submission from Eric V. Smith: >>> eval("f'\\\n'") python: Python/ast.c:4906: FstringParser_ConcatFstring: Assertion `!state->last_str || PyUnicode_GET_LENGTH(state->last_str) != 0' failed. [2] 12810 abort (core dumped) ./python The problem is that some literal strings are zero length. The assert can be deleted. ---------- assignee: eric.smith components: Interpreter Core messages: 296166 nosy: eric.smith, ned.deily, serhiy.storchaka priority: normal severity: normal status: open title: f-string assert is too restrictive versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 16 07:40:34 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 16 Jun 2017 11:40:34 +0000 Subject: [New-bugs-announce] [issue30683] Enhance doctest support in regrtest --list-cases Message-ID: <1497613234.61.0.125565868386.issue30683@psf.upfronthosting.co.za> New submission from STINNER Victor: bpo-30523 added a new --list-cases command to regrtest to list test methods. It is able to list doctest tests in test_builtins, but not in test_extcall. test_builtin doctest tests: haypo at selma$ ./python -m test test_builtin --list-cases|grep ^builtins builtins.bin builtins.float.as_integer_ratio ... test_builtins works because it uses: def load_tests(loader, tests, pattern): from doctest import DocTestSuite tests.addTest(DocTestSuite(builtins)) return tests Listing test methods of test_extcall doesn't work, the following command has no output (but succeed): ./python -m test test_extcall --list-cases test_extcall uses: def test_main(): support.run_doctest(sys.modules[__name__], True) I see two options: * Replace support.run_doctest() with doctest.DocTestSuite() in all tests * Enhance --list-cases to discover doctests. support.run_doctest() calls doctest.testmod(), but doctest.testmod() has no API to list tests. testmod() lists tests and directly runs them. Maybe --list-cases can reuse doctest.DocTestSuite(), I don't know. ---------- components: Tests messages: 296179 nosy: haypo priority: normal severity: normal status: open title: Enhance doctest support in regrtest --list-cases type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 16 08:55:21 2017 From: report at bugs.python.org (Christoph Reiter) Date: Fri, 16 Jun 2017 12:55:21 +0000 Subject: [New-bugs-announce] [issue30684] datetime.fromtimestamp raises OSError on first day after epoch on Windows Message-ID: <1497617721.62.0.607742264893.issue30684@psf.upfronthosting.co.za> New submission from Christoph Reiter: I'm not sure this is a bug since the docs says raising OSError is allowed, but it looks weird to me. On Windows. Using Python 3.4: >>> datetime.datetime.fromtimestamp(0) datetime.datetime(1970, 1, 1, 1, 0) Using Python 3.6.1: >>> datetime.datetime.fromtimestamp(0) OSError: [Errno 22] Invalid argument The first time stamp which works with 3.6 is 86400, so exactly the next day. ---------- messages: 296191 nosy: lazka priority: normal severity: normal status: open title: datetime.fromtimestamp raises OSError on first day after epoch on Windows versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 16 12:12:46 2017 From: report at bugs.python.org (Max Ehrlich) Date: Fri, 16 Jun 2017 16:12:46 +0000 Subject: [New-bugs-announce] [issue30685] Multiprocessing Send to Manager Fails for Large Payload Message-ID: <1497629566.56.0.527992929641.issue30685@psf.upfronthosting.co.za> New submission from Max Ehrlich: On line 393 of multiprocessing/connection.py, the size of the payload to be sent is serialized as an integer. This fails for sending large payloads. It should probably be serialized as a long or better yet a long long. ---------- components: Library (Lib) messages: 296210 nosy: maxehr priority: normal severity: normal status: open title: Multiprocessing Send to Manager Fails for Large Payload versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 16 14:38:56 2017 From: report at bugs.python.org (INADA Naoki) Date: Fri, 16 Jun 2017 18:38:56 +0000 Subject: [New-bugs-announce] [issue30686] make `make install` faster Message-ID: <1497638336.46.0.297230638217.issue30686@psf.upfronthosting.co.za> New submission from INADA Naoki: Currently, `make install` doesn't use -jN option of compileall.py My idea is: * Use os.cpu_count() for -j0. * Use the option in Makefile ---------- components: Build messages: 296216 nosy: inada.naoki priority: normal severity: normal status: open title: make `make install` faster versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 16 18:03:49 2017 From: report at bugs.python.org (Steve Dower) Date: Fri, 16 Jun 2017 22:03:49 +0000 Subject: [New-bugs-announce] [issue30687] build.bat should locate msbuild.exe rather than vcvarsall.bat Message-ID: <1497650629.64.0.20299274819.issue30687@psf.upfronthosting.co.za> New submission from Steve Dower: Due to how installation of Visual Studio 2017 has changed, it's very possible to end up with a valid install of the build tools without vcvarsall.bat being valid. We only require MSBuild.exe to build, so we should find that tool and invoke it, rather than trying to configure the entire environment. ---------- assignee: steve.dower components: Build, Windows messages: 296218 nosy: paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: patch review status: open title: build.bat should locate msbuild.exe rather than vcvarsall.bat type: compile error versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 17 03:38:56 2017 From: report at bugs.python.org (Jonathan Eunice) Date: Sat, 17 Jun 2017 07:38:56 +0000 Subject: [New-bugs-announce] [issue30688] support named Unicode escapes (\N{name}) in re Message-ID: <1497685136.94.0.225619820407.issue30688@psf.upfronthosting.co.za> New submission from Jonathan Eunice: The re module specially handles Unicode escapes (\uXXXX and \UXXXXXXXX) so that even raw strings (r'...') have symbolic Unicode characters. But it has not supported named Unicode escapes such as r'\N{EM DASH}', making the escapes for string literals and the escapes for regular expressions asymmetric ---------- components: Library (Lib) messages: 296234 nosy: jonathaneunice priority: normal severity: normal status: open title: support named Unicode escapes (\N{name}) in re type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 17 08:31:43 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 17 Jun 2017 12:31:43 +0000 Subject: [New-bugs-announce] [issue30689] len() and iter() of ChainMap don't work with unhashable keys Message-ID: <1497702703.77.0.955908214036.issue30689@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: As documented ChainMap supports not just dicts, but mappings. A mapping can be implemented not only as a hash table, and mapping keys can be not hashable. But ChainMap.__len__ and ChainMap.__iter__ work only with hashable keys. This may be considered just as a documentation issue. But I think it would be nice to add the support of unhashable keys in 3.7. ---------- assignee: rhettinger components: Library (Lib) messages: 296236 nosy: rhettinger, serhiy.storchaka priority: normal severity: normal status: open title: len() and iter() of ChainMap don't work with unhashable keys type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 17 08:37:08 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 17 Jun 2017 12:37:08 +0000 Subject: [New-bugs-announce] [issue30690] ChainMap doesn't preserve the order of ordered mappings Message-ID: <1497703028.62.0.270739488522.issue30690@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Iterating ChainMap emits keys in mixed order even if all underlying mappings are ordered dicts (OrderedDict). Would be nice to keep the order more predictable. This would solve issue30664. See also issue30689. ---------- components: Library (Lib) messages: 296237 nosy: eric.smith, rhettinger, serhiy.storchaka priority: normal severity: normal status: open title: ChainMap doesn't preserve the order of ordered mappings type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 17 14:54:10 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 17 Jun 2017 18:54:10 +0000 Subject: [New-bugs-announce] [issue30691] WeakSet is not pickleable Message-ID: <1497725650.32.0.990416022712.issue30691@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: WeakSet contains the __reduce__ method, but it isn't pickleable (and never was), because the pickle state contains the value of the __dict__ dict attribute which contains a reference to unpickleable local function _remove(). >>> pickle.dumps(weakref.WeakSet()) Traceback (most recent call last): File "", line 1, in AttributeError: Can't pickle local object 'WeakSet.__init__.._remove' I wondering whether WeakSet should be made pickleable or the __reduce__ method should be removed. __reduce__() can be used also for copying, but there are no tests for this feature. ---------- components: Library (Lib) messages: 296243 nosy: georg.brandl, pitrou, rhettinger, serhiy.storchaka, twouters priority: normal severity: normal status: open title: WeakSet is not pickleable _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 17 15:29:40 2017 From: report at bugs.python.org (Ranger Harke) Date: Sat, 17 Jun 2017 19:29:40 +0000 Subject: [New-bugs-announce] [issue30692] Automatic upcast does not occur for custom classes Message-ID: <1497727780.34.0.684924119981.issue30692@psf.upfronthosting.co.za> New submission from Ranger Harke: I have noticed that the automatic upcast mechanism which works for standard ctypes types does not appear to work for custom types with _as_parameter_ defined. Consider the following example (written for Mac OS X but just change the LoadLibrary call to test on a different OS): # -- begin -- from ctypes import * libc = cdll.LoadLibrary('/usr/lib/libc.dylib') class Base(Structure): pass class Derived(Base): pass class Wrapper(object): pass printf = libc.printf printf.argtypes = [ c_char_p, POINTER(Base) ] printf.restype = c_int derived = Derived() derived_ptr = pointer(derived) derived_ptr_wrapper = Wrapper() derived_ptr_wrapper._as_parameter_ = pointer(derived) # Case 1 WORKS: Derived* is automatically upcast to Base* and passed to # printf printf(b'%p\n', derived_ptr) # Case 2 WORKS: The Wrapper can be explicitly upcast to a Base* and # passed to printf printf(b'%p\n', cast(derived_ptr_wrapper, POINTER(Base))) # Case 3 FAILS: Automatic upcast does NOT happen with the value in the # Wrapper: 'expected LP_Base instance instead of # LP_Derived' printf(b'%p\n', derived_ptr_wrapper) # -- end -- Here we have two types, Base which is a ctypes Structure, and Derived which derives from Base. A pointer to Derived can be passed to a function that expects a pointer to Base, and it will automatically be upcast. However, once the Wrapper type is introduced, which simply holds a pointer to Derived in its _as_parameter_ attribute, the automatic upcast no longer occurs. A manual upcast works, though. I believe this may be related to #27803, but that is talking about byref() whereas this is related to cast(). Perhaps the internal mechanism is the same; certainly it sounds like a similar problem. I've tested this in Python 2.7 and 3.6, and the result is the same. Not sure if this is a bug or an enhancement request- filing it as "behavior" for now since to me, this is something that I expected to implicitly work. Thanks! - Ranger Harke. ---------- components: ctypes messages: 296245 nosy: rharke priority: normal severity: normal status: open title: Automatic upcast does not occur for custom classes type: behavior versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 17 22:03:30 2017 From: report at bugs.python.org (Bernhard M. Wiedemann) Date: Sun, 18 Jun 2017 02:03:30 +0000 Subject: [New-bugs-announce] [issue30693] tarfile add uses random order Message-ID: <1497751410.94.0.779622739852.issue30693@psf.upfronthosting.co.za> New submission from Bernhard M. Wiedemann: Filesystems do not give any guarantees about ordering of files returned in directory listings, thus tarfile.add adds files in random order, when using os.listdir in recursion. See also https://reproducible-builds.org/docs/stable-inputs/ on that topic. ---------- components: Library (Lib) messages: 296251 nosy: bmwiedemann priority: normal severity: normal status: open title: tarfile add uses random order type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 17 23:01:27 2017 From: report at bugs.python.org (Ned Deily) Date: Sun, 18 Jun 2017 03:01:27 +0000 Subject: [New-bugs-announce] [issue30694] Update embedded copy of expat to 2.2.1 Message-ID: <1497754887.58.0.724129384272.issue30694@psf.upfronthosting.co.za> New submission from Ned Deily: >From the announcement: Expat 2.2.1 has been released. The change log has more details [2] than this mail, including commit SHA1s. For a quick overview of the security fixes and CVEs, we have: CVE-2017-9233 External entity infinite loop DoS [1] (CVE-2016-9063) Integer overflow (re-fix) n/a More integer overflow fixes (CVE-2016-0718) Fix regression bugs from 2.2.0's fix to CVE-2016-0718 (CVE-2016-5300) Use os-specific entropy sources like getrandom n/a No longer leak parser pointer information n/a Prevent use of uninitialised variables n/a Add missing API parameter validation (NULL, len<0) (CVE-2012-0876) Counter hash flooding with SipHash https://github.com/libexpat/libexpat/blob/R_2_2_1/expat/Changes https://libexpat.github.io/doc/cve-2017-9233/ ---------- components: Library (Lib) messages: 296254 nosy: haypo, ned.deily priority: deferred blocker severity: normal stage: needs patch status: open title: Update embedded copy of expat to 2.2.1 versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 18 06:21:11 2017 From: report at bugs.python.org (Xavier de Gaye) Date: Sun, 18 Jun 2017 10:21:11 +0000 Subject: [New-bugs-announce] [issue30695] add a nomemory_allocator to the _testcapi module Message-ID: <1497781271.4.0.00244472655339.issue30695@psf.upfronthosting.co.za> New submission from Xavier de Gaye: Add the set_nomemory_allocator() function to _testcapi that sets a no memory allocator. ---------- components: Tests files: nomemory_allocator.patch keywords: patch messages: 296266 nosy: haypo, xdegaye priority: normal severity: normal status: open title: add a nomemory_allocator to the _testcapi module type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46958/nomemory_allocator.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 18 06:33:04 2017 From: report at bugs.python.org (Xavier de Gaye) Date: Sun, 18 Jun 2017 10:33:04 +0000 Subject: [New-bugs-announce] [issue30696] infinite loop in PyRun_InteractiveLoopFlags() Message-ID: <1497781984.85.0.996199395593.issue30696@psf.upfronthosting.co.za> New submission from Xavier de Gaye: To reproduce the problem, apply the nomemory_allocator.patch from issue 30695 and run the following two statements that must be interrupted with ^C: $ ./python -q >>> import _testcapi >>> _testcapi.set_nomemory_allocator() sys.excepthook is missing ^Cpython: Objects/call.c:785: PyEval_CallObjectWithKeywords: Assertion `!PyErr_Occurred()' failed. Aborted (core dumped) The attached patch fixes this problem. No PR for the moment: this patch and nomemory_allocator.patch are needed to demonstrate other issues. ---------- components: Interpreter Core files: infinite_loop.patch keywords: patch messages: 296267 nosy: haypo, xdegaye priority: normal severity: normal status: open title: infinite loop in PyRun_InteractiveLoopFlags() type: behavior versions: Python 3.7 Added file: http://bugs.python.org/file46959/infinite_loop.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 18 09:29:41 2017 From: report at bugs.python.org (Xavier de Gaye) Date: Sun, 18 Jun 2017 13:29:41 +0000 Subject: [New-bugs-announce] [issue30697] segfault in PyErr_NormalizeException() after memory exhaustion Message-ID: <1497792581.23.0.578886308028.issue30697@psf.upfronthosting.co.za> New submission from Xavier de Gaye: Nosying reviewers of PR 1981 of issue 22898. The memerr.py script segfaults with the following gdb backtrace: #0 0x0000000000550268 in PyErr_NormalizeException (exc=exc at entry=0x7fffffffdee8, val=val at entry=0x7fffffffdef0, tb=tb at entry=0x7fffffffdef8) at Python/errors.c:315 #1 0x000000000055045f in PyErr_NormalizeException (exc=exc at entry=0x7fffffffdee8, val=val at entry=0x7fffffffdef0, tb=tb at entry=0x7fffffffdef8) at Python/errors.c:319 #2 0x000000000055045f in PyErr_NormalizeException (exc=exc at entry=0x7fffffffdee8, val=val at entry=0x7fffffffdef0, tb=tb at entry=0x7fffffffdef8) at Python/errors.c:319 #3 0x000000000055045f in PyErr_NormalizeException (exc=exc at entry=0x7fffffffdee8, val=val at entry=0x7fffffffdef0, tb=tb at entry=0x7fffffffdef8) at Python/errors.c:319 ... To be able to run this patch, one needs to apply the nomemory_allocator.patch from issue 30695 and the infinite_loop.patch from issue 30696. This raises two different problems: a) The segfault itself that occurs upon setting the PyExc_RecursionErrorInst singleton. Oh! That had already been pointed out in msg231933 in issue 22898 at case 4). b) When the size of the Python frames stack is greater than the size of the list of preallocated MemoryError instances, this list becomes exhausted and PyErr_NormalizeException() enters an infinite recursion which is stopped: * by the PyExc_RecursionErrorInst singleton when a) is fixed * by a Fatal Error (abort) when applying PR 1981 in its current state (there is no stack overflow as expected even in the absence of any guard before the recursive call to PyErr_NormalizeException()) The user is presented in both cases with an error hinting at a recursion problem instead of a problem with memory exhaustion. This is bug b). ---------- components: Interpreter Core files: memerr.py messages: 296272 nosy: brett.cannon, haypo, pitrou, serhiy.storchaka, xdegaye priority: normal severity: normal status: open title: segfault in PyErr_NormalizeException() after memory exhaustion type: crash versions: Python 3.7 Added file: http://bugs.python.org/file46960/memerr.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 18 18:08:35 2017 From: report at bugs.python.org (Grzegorz Grzywacz) Date: Sun, 18 Jun 2017 22:08:35 +0000 Subject: [New-bugs-announce] [issue30698] asyncio sslproto do not shutdown ssl layer cleanly Message-ID: <1497823715.09.0.154341862456.issue30698@psf.upfronthosting.co.za> New submission from Grzegorz Grzywacz: Asyncio on shutdown do not send shutdown confirmation to the other side. _SSLPipe after doing unwrap is calling shutdown callback where transport is closed and quit ssldata wont be sent. ---------- components: asyncio messages: 296295 nosy: grzgrzgrz3, yselivanov priority: normal severity: normal status: open title: asyncio sslproto do not shutdown ssl layer cleanly type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 18 18:15:56 2017 From: report at bugs.python.org (Robert Tasarz) Date: Sun, 18 Jun 2017 22:15:56 +0000 Subject: [New-bugs-announce] [issue30699] Misleading class names in datetime.tzinfo usage examples Message-ID: <1497824156.09.0.152108719585.issue30699@psf.upfronthosting.co.za> New submission from Robert Tasarz: https://docs.python.org/3/library/datetime.html#datetime-objects gives in an example two classes named GMT1 and GMT2 subclassing tzinfo, defined with dst(?) methods returning one hour timedelta for summer periods. This is in conflict with naming, as GMT timezone is not defined with any daylight saving time, so any timezone offsetted from it shouldn't be as well. I would suggest renaming them to something like BrusselsTZ and HelsinkiTZ (with a comment that this is simplified implementation, that doesn't account for exact hour when dst switch is made, and maybe mentioning pytz) and tzname(?) to return ('CET', 'CEST')[bool(self.dst(dt))] and ('EET', 'EEST')[bool(self.dst(dt))] accordingly. Also https://docs.python.org/3/library/datetime.html#time-objects has an example with GMT1 class, though this time dst(?) unconditionally returns offset 0 properly, tzname(?) gives 'Europe/Prague' ? region that uses dst. IMHO returning any of: "CET", "GMT+1", "Africa/Tunis" would be better here. ---------- assignee: docs at python components: Documentation messages: 296296 nosy: Robert.Tasarz, docs at python priority: normal severity: normal status: open title: Misleading class names in datetime.tzinfo usage examples type: enhancement versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 19 00:14:47 2017 From: report at bugs.python.org (switchnode) Date: Mon, 19 Jun 2017 04:14:47 +0000 Subject: [New-bugs-announce] [issue30700] fileinput inplace clobbers file without leaving backup on decode errors Message-ID: <1497845687.86.0.210018987991.issue30700@psf.upfronthosting.co.za> New submission from switchnode: Consider the script: $ cat nop.py #!/usr/bin/env python import fileinput srt = fileinput.input(inplace=True) print(srt.readline(), end='') for line in srt: print(line, end='') Called on text files, it will do nothing. $ ls -alh test.* -rw-r--r-- 1 501 utmp 1.3G Jun 18 22:17 test.mp4 -rw-r--r-- 1 501 utmp 71K Jun 18 2017 test.srt $ ./nop.py test.srt $ ls -alh test.* -rw-r--r-- 1 501 utmp 1.3G Jun 18 22:17 test.mp4 -rw-r--r-- 1 501 utmp 71K Jun 18 2017 test.srt However, if the user accidentally supplies the filename of a video instead of the associated srt... $ ./nop.py test.mp4 Traceback (most recent call last): File "./nop.py", line 4, in print(srt.readline(), end='') File "/usr/lib/python3.6/fileinput.py", line 299, in readline line = self._readline() File "/usr/lib/python3.6/fileinput.py", line 364, in _readline return self._readline() File "/usr/lib/python3.6/codecs.py", line 321, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position 43: invalid start byte $ ls -alh test.* -rw-r--r-- 1 501 utmp 0 Jun 18 2017 test.mp4 -rw-r--r-- 1 501 utmp 71K Jun 18 2017 test.srt $ ls -alh * | grep 'bak' $ Oops! It is gone. I'm not sure why this happens. (Without the context-manager syntax, I would expect the program to end by excepting, fail to close the FileInput, and leave the backup file behind?certainly that would be the merciful option.) ---------- messages: 296304 nosy: switchnode priority: normal severity: normal status: open title: fileinput inplace clobbers file without leaving backup on decode errors type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 19 05:25:47 2017 From: report at bugs.python.org (Tim Bell) Date: Mon, 19 Jun 2017 09:25:47 +0000 Subject: [New-bugs-announce] [issue30701] Exception parsing certain invalid email address headers Message-ID: <1497864347.44.0.160991763633.issue30701@psf.upfronthosting.co.za> New submission from Tim Bell: According to RFC 5322, an email address like this isn't valid: user at example.com (The display-name "user at example.com" contains "@", which isn't in the set of atext characters used to form an atom.) How it's handled by the email package varies by policy: >>> import email >>> from email.policy import default >>> email.message_from_bytes(b'To: user at example.com ')['to'] 'user at example.com ' >>> email.message_from_bytes(b'To: user at example.com ', policy=default)['to'] 'user at example.com' >>> email.message_from_bytes(b'To: user at example.com ', policy=default).defects [] The difference between the behaviour under the compat32 vs "default" policy may or may not be significant. However, if coupled with a further invalid feature, namely a space after the ">", here's what happens: >>> email.message_from_bytes(b'To: user at example.com ')['to'] 'user at example.com ' >>> email.message_from_bytes(b'To: user at example.com ', policy=default)['to'] Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/message.py", line 391, in __getitem__ return self.get(name) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/message.py", line 471, in get return self.policy.header_fetch_parse(k, v) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/policy.py", line 162, in header_fetch_parse return self.header_factory(name, value) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/headerregistry.py", line 586, in __call__ return self[name](name, value) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/headerregistry.py", line 197, in __new__ cls.parse(value, kwds) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/headerregistry.py", line 337, in parse kwds['parse_tree'] = address_list = cls.value_parser(value) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/headerregistry.py", line 328, in value_parser address_list, value = parser.get_address_list(value) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/_header_value_parser.py", line 2368, in get_address_list token, value = get_invalid_mailbox(value, ',') File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/_header_value_parser.py", line 2166, in get_invalid_mailbox token, value = get_phrase(value) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/_header_value_parser.py", line 1770, in get_phrase token, value = get_word(value) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/_header_value_parser.py", line 1745, in get_word if value[0]=='"': IndexError: string index out of range >>> email.message_from_bytes(b'To: user at example.com ', policy=default).defects [] I believe that the preferred behaviour would be to add a defect to the message object during parsing instead of throwing an exception when the invalid header value is accessed. ---------- components: email messages: 296309 nosy: barry, r.david.murray, timb07 priority: normal severity: normal status: open title: Exception parsing certain invalid email address headers type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 19 09:49:40 2017 From: report at bugs.python.org (Dan Snider) Date: Mon, 19 Jun 2017 13:49:40 +0000 Subject: [New-bugs-announce] [issue30702] pickle uses getattr(obj, '__reduce__') instead of getattr(type(obj), '__reduce__') Message-ID: <1497880180.73.0.160578831769.issue30702@psf.upfronthosting.co.za> New submission from Dan Snider: That is inconsistent with every other object.__dunder_method__ which still work even if the instance gets an attribute with the same name. ---------- components: Library (Lib) messages: 296337 nosy: assume_away priority: normal severity: normal status: open title: pickle uses getattr(obj, '__reduce__') instead of getattr(type(obj), '__reduce__') type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 19 11:20:57 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 19 Jun 2017 15:20:57 +0000 Subject: [New-bugs-announce] [issue30703] test_multiprocessing_forkserver hangs on x86-64 Sierra 3.x. buildbot Message-ID: <1497885657.03.0.477288552654.issue30703@psf.upfronthosting.co.za> New submission from STINNER Victor: regrtest hangs while running test_multiprocessing_forkserver in a worker process on the "x86-64 Sierra 3.x" buildbot. Bug seen twice: build 343 and 337. http://buildbot.python.org/all/builders/x86-64%20Sierra%203.x/builds/337/steps/test/logs/stdio Run tests in parallel using 2 child processes ... 0:29:36 load avg: 5.24 [402/406] test_deque passed -- running: test_multiprocessing_forkserver (1346 sec) 0:29:37 load avg: 5.24 [403/406] test_descrtut passed -- running: test_multiprocessing_forkserver (1346 sec) 0:29:37 load avg: 4.90 [404/406] test_weakset passed -- running: test_multiprocessing_forkserver (1347 sec) 0:29:40 load avg: 4.90 [405/406] test_distutils passed -- running: test_multiprocessing_forkserver (1350 sec) command timed out: 1200 seconds without output running ['make', 'buildbottest', 'TESTOPTS=-j2', 'TESTPYTHONOPTS=', 'TESTTIMEOUT=900'], attempting to kill process killed by signal 9 program finished with exit code -1 elapsedTime=2983.908679 ---------- components: Tests keywords: buildbot messages: 296348 nosy: haypo priority: normal severity: normal status: open title: test_multiprocessing_forkserver hangs on x86-64 Sierra 3.x. buildbot versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 19 11:28:11 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 19 Jun 2017 15:28:11 +0000 Subject: [New-bugs-announce] [issue30704] test_free_different_thread() of test_code leaks references on Python 3.6 Message-ID: <1497886091.03.0.481986477889.issue30704@psf.upfronthosting.co.za> New submission from STINNER Victor: haypo at selma$ ./python -m test -m test.test_code.CoExtra.test_free_different_thread -R 3:3 test_code Run tests sequentially test_code leaked [2, 1, 1] memory blocks, sum=4 The regression was introduced by the bpo-30604: commit 2997fec01ee7300c6d5940e6c55e4ccf9f56f1b5. ---------- messages: 296350 nosy: dino.viehland, haypo, ned.deily, yselivanov priority: normal severity: normal status: open title: test_free_different_thread() of test_code leaks references on Python 3.6 type: resource usage versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 19 12:11:26 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 19 Jun 2017 16:11:26 +0000 Subject: [New-bugs-announce] [issue30705] python2.7 -m test -R 3:3 hangs on Refleaks 2.7 buildbots Message-ID: <1497888686.38.0.385833732648.issue30705@psf.upfronthosting.co.za> New submission from STINNER Victor: The Refleaks 2.7 job hangs on "AMD64 Windows8.1 Refleaks 2.7" and "x86 Gentoo Refleaks 2.7" buildbots. (1) Gentoo http://buildbot.python.org/all/builders/x86%20Gentoo%20Refleaks%202.7/builds/21 StartSat Jun 3 00:00:00 2017 Elapsed328 hrs, 17 mins, 37 secs http://buildbot.python.org/all/builders/x86%20Gentoo%20Refleaks%202.7/builds/21/steps/test/logs/stdio ... running: test_io (1177378 sec) running: test_io (1177408 sec) running: test_io (1177438 sec) running: test_io (1177468 sec) (2) Windows http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%202.7/builds/27 Elasped: 88 hrs, 11 mins, 5 secs http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%202.7/builds/27/steps/test/logs/stdio ... running: test_regrtest (304919 sec) running: test_regrtest (304949 sec) running: test_regrtest (304979 sec) running: test_regrtest (305009 sec) running: test_regrtest (305039 sec) running: test_regrtest (305069 sec) ---------- components: Tests messages: 296353 nosy: haypo, zach.ware priority: normal severity: normal status: open title: python2.7 -m test -R 3:3 hangs on Refleaks 2.7 buildbots versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 19 17:19:46 2017 From: report at bugs.python.org (Michael Salsone) Date: Mon, 19 Jun 2017 21:19:46 +0000 Subject: [New-bugs-announce] [issue30706] EmailMessage Object Creation Message-ID: <1497907186.78.0.0626439777359.issue30706@psf.upfronthosting.co.za> New submission from Michael Salsone: I am looking to use the get_body() method from email.message.EmailMessage, but I am unable to create an object of this type. I am attempting to create an object of this from message_from_string (as well as some of the other email.parser methods). But it won't allow me to change the class to email.message.EmailMessage. I've read through the source for some this code, but I don't see where you thread the needle here, is it even possible? Example: from email.message import EmailMessage email.message_from_string(self.original_message, _class=EmailMessage) ---------- components: email messages: 296378 nosy: Michael Salsone, barry, r.david.murray priority: normal severity: normal status: open title: EmailMessage Object Creation type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 00:34:20 2017 From: report at bugs.python.org (Damien George) Date: Tue, 20 Jun 2017 04:34:20 +0000 Subject: [New-bugs-announce] [issue30707] Incorrect description of "async with" in PEP492 and documentation Message-ID: <1497933260.82.0.652248701782.issue30707@psf.upfronthosting.co.za> Changes by Damien George : ---------- assignee: docs at python components: Documentation nosy: Damien George, docs at python priority: normal severity: normal status: open title: Incorrect description of "async with" in PEP492 and documentation type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 00:38:10 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 20 Jun 2017 04:38:10 +0000 Subject: [New-bugs-announce] [issue30708] Ensure that the result of PyUnicode_AsWideCharString() doesn't contain null characters if size is not returned Message-ID: <1497933490.61.0.851016867821.issue30708@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The second parameter of the PyUnicode_AsWideCharString() function wchar_t* PyUnicode_AsWideCharString(PyObject *unicode, Py_ssize_t *size) is a pointer to Py_ssize_t. The size of created wchar_t array is saved on this pointer if it is not NULL. If NULL is passed as the second argument, the only way to determine the size of the wchar_t string is using wcslen(). But if the string contains the null characters, it looks truncated for wcslen() and other C API functions. Reliable code should always pass the non-NULL second argument and check that wcslen() is equal to the returned string size. See for example the code in Modules/_io/winconsoleio.c. Passing NULL as the second argument is unsafe. But most code doesn't do such check (see all other usages of PyUnicode_AsWideCharString(..., NULL)). And this check complicates the callers code. I propose to make the check for null characters inside of PyUnicode_AsWideCharString() if NULL is passes as the second argument. This will fix all unsafe usages of PyUnicode_AsWideCharString() and allow to simplify the reliable code. This issue fixes the part of issue13617. ---------- components: Interpreter Core, Unicode messages: 296401 nosy: ezio.melotti, haypo, serhiy.storchaka, steve.dower priority: normal severity: normal stage: patch review status: open title: Ensure that the result of PyUnicode_AsWideCharString() doesn't contain null characters if size is not returned type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 07:13:18 2017 From: report at bugs.python.org (AnqurVanillapy) Date: Tue, 20 Jun 2017 11:13:18 +0000 Subject: [New-bugs-announce] [issue30709] Bad getter from Descriptor#Properties example Message-ID: <1497957198.83.0.108909072277.issue30709@psf.upfronthosting.co.za> New submission from AnqurVanillapy: - The purpose of `obj` in the example is implicit - As an argument the `obj` will cause errors when using Cell('b10').value because it expects more arguments, but 1 given ---------- assignee: docs at python components: Documentation messages: 296412 nosy: anqur, docs at python priority: normal pull_requests: 2336 severity: normal status: open title: Bad getter from Descriptor#Properties example type: enhancement versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 09:19:55 2017 From: report at bugs.python.org (Radek Smejkal) Date: Tue, 20 Jun 2017 13:19:55 +0000 Subject: [New-bugs-announce] [issue30710] getaddrinfo raises OverflowError Message-ID: <1497964795.93.0.432091390159.issue30710@psf.upfronthosting.co.za> New submission from Radek Smejkal: If the port argument is a number, getaddrinfo attempts to convert it to a C long, that raises OverflowError if the conversion fails. Instead, getaddrinfo should convert the port to a string (bytes) directly and rely on the underlying getaddrinfo to return EAI_SERVICE. This is also consistent with the case when a numeric port is passed as a string. ---------- components: Library (Lib) messages: 296421 nosy: smejkar priority: normal severity: normal status: open title: getaddrinfo raises OverflowError type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 09:26:15 2017 From: report at bugs.python.org (Radek Smejkal) Date: Tue, 20 Jun 2017 13:26:15 +0000 Subject: [New-bugs-announce] [issue30711] getaddrinfo invalid port number Message-ID: <1497965175.62.0.214450987603.issue30711@psf.upfronthosting.co.za> New submission from Radek Smejkal: Some getaddrinfo implementations do not detect invalid numeric services and blindly pass the port number to htons(). For example, service "960179" is returned as port 42675. glibc https://sourceware.org/bugzilla/show_bug.cgi?id=16208 https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/posix/getaddrinfo.c;h=a8bdd9a1829409bd797637b2c4fca4d67a11012d;hb=HEAD#l435 https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/posix/getaddrinfo.c;h=a8bdd9a1829409bd797637b2c4fca4d67a11012d;hb=HEAD#l2313 AIX 7.1 libc Broken Modules/getaddrinfo https://github.com/python/cpython/blob/master/Modules/getaddrinfo.c#L342 On the other hand, for example, OpenBSD and musl check the port range https://github.com/openbsd/src/blob/master/lib/libc/asr/getaddrinfo_async.c#L477 https://git.musl-libc.org/cgit/musl/tree/src/network/lookup_serv.c#n53 Modules/getaddrinfo should be fixed. The configure script should detect whether the system getaddrinfo is broken. If so, a wrapper that checks numeric services, and returns EAI_SERVICE or calls the system getaddrinfo should be used in place of the system getaddrinfo. ---------- components: Library (Lib) messages: 296423 nosy: smejkar priority: normal severity: normal status: open title: getaddrinfo invalid port number type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 09:32:47 2017 From: report at bugs.python.org (knzsys) Date: Tue, 20 Jun 2017 13:32:47 +0000 Subject: [New-bugs-announce] [issue30712] struct.unpack generates wrong error in certain conditions Message-ID: <1497965567.61.0.972062046856.issue30712@psf.upfronthosting.co.za> New submission from knzsys: #Working code: from struct import * rawdata = 'A'*196 laserdata = list(unpack('2s2s29H',rawdata[14:76])) laserdata += list(unpack('26f3L4s',rawdata[76:196])) #This code generates error: from struct import * rawdata = 'A'*196 laserdata = list(unpack('2s2s29H26f3L4s',rawdata[14:196])) # Does not work due to python bug: unpack calculates wrong size 184 (should be 182) from format string and generates error: #struct.error: unpack requires a string argument of length 184 ---------- components: Interpreter Core messages: 296425 nosy: knzsys priority: normal severity: normal status: open title: struct.unpack generates wrong error in certain conditions type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 11:20:33 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 20 Jun 2017 15:20:33 +0000 Subject: [New-bugs-announce] [issue30713] Reject newline character (U+000A) in URLs in urllib.parse Message-ID: <1497972033.13.0.439611221466.issue30713@psf.upfronthosting.co.za> New submission from STINNER Victor: Spin-off of the bpo-30500: modify the urllib.parse module to reject the newline character (U+000A) in URLS. Modify 3 functions: * splittype() * splithost() * splitport() ---------- messages: 296453 nosy: haypo priority: normal severity: normal status: open title: Reject newline character (U+000A) in URLs in urllib.parse type: security versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 11:26:41 2017 From: report at bugs.python.org (Charalampos Stratakis) Date: Tue, 20 Jun 2017 15:26:41 +0000 Subject: [New-bugs-announce] [issue30714] test_ssl fails with openssl 1.1.0f Message-ID: <1497972401.5.0.807136343886.issue30714@psf.upfronthosting.co.za> New submission from Charalampos Stratakis: After updating openssl in Fedora 26 from 1.1.0e to 1.1.0f the test_alpn_protocols from test_ssl started failing: ====================================================================== FAIL: test_alpn_protocols (test.test_ssl.ThreadedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/Python-3.6.1/Lib/test/test_ssl.py", line 3261, in test_alpn_protocols self.assertIsInstance(stats, ssl.SSLError) AssertionError: {'compression': None, 'cipher': ('ECDHE-RSA-AES256-GCM-SHA384', 'TLSv1.2', 256), 'peercert': {}, 'client_alpn_protocol': None, 'client_npn_protocol': None, 'version': 'TLSv1.2', 'session_reused': False, 'session': <_ssl.Session object at 0x7f846ed97740>, 'server_alpn_protocols': [None], 'server_npn_protocols': [None], 'server_shared_ciphers': [[('ECDHE-ECDSA-AES256-GCM-SHA384', 'TLSv1.2', 256), ('ECDHE-RSA-AES256-GCM-SHA384', 'TLSv1.2', 256), ('ECDHE-ECDSA-AES128-GCM-SHA256', 'TLSv1.2', 128), ('ECDHE-RSA-AES128-GCM-SHA256', 'TLSv1.2', 128), ('ECDHE-ECDSA-CHACHA20-POLY1305', 'TLSv1.2', 256), ('ECDHE-RSA-CHACHA20-POLY1305', 'TLSv1.2', 256), ('DHE-DSS-AES256-GCM-SHA384', 'TLSv1.2', 256), ('DHE-RSA-AES256-GCM-SHA384', 'TLSv1.2', 256), ('DHE-DSS-AES128-GCM-SHA256', 'TLSv1.2', 128), ('DHE-RSA-AES128-GCM-SHA256', 'TLSv1.2', 128), ('DHE-RSA-CHACHA20-POLY1305', 'TLSv1.2', 256), ('ECDHE-ECDSA-AES256-CCM8', 'TLSv1.2', 256), ('ECDHE-ECDSA-AES256-CCM', 'TLSv1.2', 256), ('ECDHE-ECDSA-AES256-SHA384', 'TLSv1.2', 256), ('ECDHE-RSA-AES256-SHA384', 'TLSv1.2', 256), ('ECDHE-ECDSA-AES256-SHA', 'TLSv1.0', 256), ('ECDHE-RSA-AES256-SHA', 'TLSv1.0', 256), ('DHE-RSA-AES256-CCM8', 'TLSv1.2', 256), ('DHE-RSA-AES256-CCM', 'TLSv1.2', 256), ('DHE-RSA-AES256-SHA256', 'TLSv1.2', 256), ('DHE-DSS-AES256-SHA256', 'TLSv1.2', 256), ('DHE-RSA-AES256-SHA', 'SSLv3', 256), ('DHE-DSS-AES256-SHA', 'SSLv3', 256), ('ECDHE-ECDSA-AES128-CCM8', 'TLSv1.2', 128), ('ECDHE-ECDSA-AES128-CCM', 'TLSv1.2', 128), ('ECDHE-ECDSA-AES128-SHA256', 'TLSv1.2', 128), ('ECDHE-RSA-AES128-SHA256', 'TLSv1.2', 128), ('ECDHE-ECDSA-AES128-SHA', 'TLSv1.0', 128), ('ECDHE-RSA-AES128-SHA', 'TLSv1.0', 128), ('DHE-RSA-AES128-CCM8', 'TLSv1.2', 128), ('DHE-RSA-AES128-CCM', 'TLSv1.2', 128), ('DHE-RSA-AES128-SHA256', 'TLSv1.2', 128), ('DHE-DSS-AES128-SHA256', 'TLSv1.2', 128), ('DHE-RSA-AES128-SHA', 'SSLv3', 128), ('DHE-DSS-AES128-SHA', 'SSLv3', 128), ('ECDHE-ECDSA-CAMELLIA256-SHA384', 'TLSv1.2', 256), ('ECDHE-RSA-CAMELLIA256-SHA384', 'TLSv1.2', 256), ('ECDHE-ECDSA-CAMELLIA128-SHA256', 'TLSv1.2', 128), ('ECDHE-RSA-CAMELLIA128-SHA256', 'TLSv1.2', 128), ('DHE-RSA-CAMELLIA256-SHA256', 'TLSv1.2', 256), ('DHE-DSS-CAMELLIA256-SHA256', 'TLSv1.2', 256), ('DHE-RSA-CAMELLIA128-SHA256', 'TLSv1.2', 128), ('DHE-DSS-CAMELLIA128-SHA256', 'TLSv1.2', 128), ('DHE-RSA-CAMELLIA256-SHA', 'SSLv3', 256), ('DHE-DSS-CAMELLIA256-SHA', 'SSLv3', 256), ('DHE-RSA-CAMELLIA128-SHA', 'SSLv3', 128), ('DHE-DSS-CAMELLIA128-SHA', 'SSLv3', 128), ('AES256-GCM-SHA384', 'TLSv1.2', 256), ('AES128-GCM-SHA256', 'TLSv1.2', 128), ('AES256-CCM8', 'TLSv1.2', 256), ('AES256-CCM', 'TLSv1.2', 256), ('AES128-CCM8', 'TLSv1.2', 128), ('AES128-CCM', 'TLSv1.2', 128), ('AES256-SHA256', 'TLSv1.2', 256), ('AES128-SHA256', 'TLSv1.2', 128), ('AES256-SHA', 'SSLv3', 256), ('AES128-SHA', 'SSLv3', 128), ('CAMELLIA256-SHA256', 'TLSv1.2', 256), ('CAMELLIA128-SHA256', 'TLSv1.2', 128), ('CAMELLIA256-SHA', 'SSLv3', 256), ('CAMELLIA128-SHA', 'SSLv3', 128)]]} is not an instance of Full build log attached ---------- files: build.log messages: 296456 nosy: cstratak priority: normal severity: normal status: open title: test_ssl fails with openssl 1.1.0f Added file: http://bugs.python.org/file46963/build.log _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 13:14:27 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Tue, 20 Jun 2017 17:14:27 +0000 Subject: [New-bugs-announce] [issue30715] Test_winreg, test_dynamic_key hangs on my Win 10 Message-ID: <1497978867.14.0.417332837919.issue30715@psf.upfronthosting.co.za> New submission from Terry J. Reedy: On my Win10-64 machine, test_winreg hangs, impervious to ^C. I have to close Command Prompt. (With IDLE I can run just test_winreg and then Restart Shell.) This happened with repository builds last Friday and today, and with installed 3.6.2rc1. But I believe I ran the entire test suite (to successful completion) not too many days before. The culprit is def test_dynamic_key(self): # Issue2810, when the value is dynamically generated, these # raise "WindowsError: More data is available" in 2.6 and 3.1 try: EnumValue(HKEY_PERFORMANCE_DATA, 0) except OSError as e: if e.errno in (errno.EPERM, errno.EACCES): self.skipTest("access denied to registry key " "(are you running in a non-interactive session?)") raise QueryValueEx(HKEY_PERFORMANCE_DATA, "") Commenting out the whole function or both the EnumValue and QueryValueEx calls (replacing the former with pass) is required to allow the test to run (and pass). I have no idea why behavior on my machine is different from buildbots. If the problem is with my registry, could the test be more robust? Having to kill my console session, and lose history, after running the test suite, is unpleasant. ---------- components: Tests messages: 296474 nosy: ned.deily, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware priority: release blocker severity: normal status: open title: Test_winreg, test_dynamic_key hangs on my Win 10 type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 14:55:28 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Tue, 20 Jun 2017 18:55:28 +0000 Subject: [New-bugs-announce] [issue30716] Failing tests with installed 3.6.2rc1 on Win 10-64 Message-ID: <1497984928.25.0.777622060627.issue30716@psf.upfronthosting.co.za> New submission from Terry J. Reedy: 3.6.2rc1, 64 bit version, installed on my Win10 machine, has 5 failures not present in my 32-bit debug repository builds. Auto Windows updates is on. Results same after uninstall and re-install. F:\dev\3x>py -3 -c "import sys; print(sys.version)" 3.6.2rc1 (heads/3.6:268e1fb, Jun 17 2017, 19:01:44) [MSC v.1900 64 bit (AMD64)] test_codecencodings_iso2022 multiple failures test_random multiple failures test_sax multiple failures test_regrtest failed in test_pcbuild_rt, FileNotFoundError in subprocess test_tools 2to3 it seems Are the failures unique to my machine? At least some of the failures below don't seem that they should be. How is the installer tested? ----------------------- FAil test_incrementaldecoder test.test_codecencodings_iso2022.Test_ISO2022_KR) has 4 failures like the following, where b'\n' and b'\r\n' are switched (both ways) between expected and actual. AssertionError: b'\xe[334 chars]\x80\n\xed\x9a\xa8\xec\x9c\xa8\xec\xa0\x81\xec[1668 chars]4.\n' != b'\xe[334 chars]\x80\r\n\xed\x9a\xa8\xec\x9c\xa8\xec\xa0\x81\x[1682 chars]\r\n' b"\x1[143 chars]\x0f\r\n\x0eH?@2@{@N\x0f \x0e0m\n\r\npy -3 -m test -v test_tools == CPython 3.6.2rc1 (heads/3.6:268e1fb, Jun 17 2017, 19:01:44) [MSC v.1900 64 bit (AMD64)] == Windows-10-10.0.14393-SP0 little-endian == hash algorithm: siphash24 64bit == cwd: C:\Users\Terry\AppData\Local\Temp\test_python_14224 == CPU count: 12 == encodings: locale=cp1252, FS=utf-8 Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0) Run tests sequentially 0:00:00 [1/1] test_tools test_alter_comments (test.test_tools.test_fixcid.Test) ... ok test_directory (test.test_tools.test_fixcid.Test) ... ok test_parse_strings (test.test_tools.test_fixcid.Test) ... ok test_gprof (test.test_tools.test_gprof2html.Gprof2htmlTests) ... ok test_POT_Creation_Date (test.test_tools.test_i18n.Test_pygettext) Match the date format from xgettext for POT-Creation-Date ... ok test_header (test.test_tools.test_i18n.Test_pygettext) Make sure the required fields are in the header, according to: ... ok test_checksum_fodder (test.test_tools.test_md5sum.MD5SumTests) ... ok test_dash_l (test.test_tools.test_md5sum.MD5SumTests) ... ok test_dash_s (test.test_tools.test_md5sum.MD5SumTests) ... ok test_dash_t (test.test_tools.test_md5sum.MD5SumTests) ... ok test_multiple_files (test.test_tools.test_md5sum.MD5SumTests) ... ok test_noargs (test.test_tools.test_md5sum.MD5SumTests) ... ok test_usage (test.test_tools.test_md5sum.MD5SumTests) ... ok test_inverse_attribute_error (test.test_tools.test_pdeps.PdepsTests) ... ok test_process_errors (test.test_tools.test_pdeps.PdepsTests) ... ok test_empty_line (test.test_tools.test_pindent.PindentTests) ... ok test_escaped_newline (test.test_tools.test_pindent.PindentTests) ... ok test_multilevel (test.test_tools.test_pindent.PindentTests) ... ok test_oneline (test.test_tools.test_pindent.PindentTests) ... ok test_preserve_indents (test.test_tools.test_pindent.PindentTests) ... ok test_selftest (test.test_tools.test_pindent.PindentTests) ... ok test_statements (test.test_tools.test_pindent.PindentTests) ... ok test_help (test.test_tools.test_reindent.ReindentTests) ... ok test_noargs (test.test_tools.test_reindent.ReindentTests) ... ok test_reindent_file_with_bad_encoding (test.test_tools.test_reindent.ReindentTests) ... ok test_analyze_dxp_import (test.test_tools.test_sundry.TestSundryScripts) ... ok test_sundry (test.test_tools.test_sundry.TestSundryScripts) ... RefactoringTool: Adding transformation: apply RefactoringTool: Adding transformation: asserts RefactoringTool: Adding transformation: basestring RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Adding transformation: dict RefactoringTool: Adding transformation: except RefactoringTool: Adding transformation: exec RefactoringTool: Adding transformation: execfile RefactoringTool: Adding transformation: exitfunc RefactoringTool: Adding transformation: filter RefactoringTool: Adding transformation: funcattrs RefactoringTool: Adding transformation: future RefactoringTool: Adding transformation: getcwdu RefactoringTool: Adding transformation: has_key RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Adding transformation: import RefactoringTool: Adding transformation: imports RefactoringTool: Adding transformation: imports2 RefactoringTool: Adding transformation: input RefactoringTool: Adding transformation: intern RefactoringTool: Adding transformation: isinstance RefactoringTool: Adding transformation: itertools RefactoringTool: Adding transformation: itertools_imports RefactoringTool: Adding transformation: long RefactoringTool: Adding transformation: map RefactoringTool: Adding transformation: metaclass RefactoringTool: Adding transformation: methodattrs RefactoringTool: Adding transformation: ne RefactoringTool: Adding transformation: next RefactoringTool: Adding transformation: nonzero RefactoringTool: Adding transformation: numliterals RefactoringTool: Adding transformation: operator RefactoringTool: Adding transformation: paren RefactoringTool: Adding transformation: print RefactoringTool: Adding transformation: raise RefactoringTool: Adding transformation: raw_input RefactoringTool: Adding transformation: reduce RefactoringTool: Adding transformation: reload RefactoringTool: Adding transformation: renames RefactoringTool: Adding transformation: repr RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Adding transformation: standarderror RefactoringTool: Adding transformation: sys_exc RefactoringTool: Adding transformation: throw RefactoringTool: Adding transformation: tuple_params RefactoringTool: Adding transformation: types RefactoringTool: Adding transformation: unicode RefactoringTool: Adding transformation: urllib RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Adding transformation: xrange RefactoringTool: Adding transformation: xreadlines RefactoringTool: Adding transformation: zip RefactoringTool: Can't open test_tools: [Errno 2] No such file or directory: 'test_tools' RefactoringTool: No files need to be modified. RefactoringTool: There was 1 error: RefactoringTool: Can't open test_tools: [Errno 2] No such file or directory: 'test_tools' ERROR test_sundry_windows (test.test_tools.test_sundry.TestSundryScripts) ... ok test_files (test.test_tools.test_unparse.DirectoryTestCase) ... Testing C:\Programs\Python36\Lib\test\test_super.py Testing C:\Programs\Python36\Lib\subprocess.py Testing C:\Programs\Python36\Lib\string.py Testing C:\Programs\Python36\Lib\mimetypes.py Testing C:\Programs\Python36\Lib\test\test_dictcomps.py Testing C:\Programs\Python36\Lib\site.py Testing C:\Programs\Python36\Lib\test\pydoc_mod.py Testing C:\Programs\Python36\Lib\stringprep.py Testing C:\Programs\Python36\Lib\test\test_cgi.py Testing C:\Programs\Python36\Lib\struct.py ok test_annotations (test.test_tools.test_unparse.UnparseTestCase) ... ok test_bytes (test.test_tools.test_unparse.UnparseTestCase) ... ok test_chained_comparisons (test.test_tools.test_unparse.UnparseTestCase) ... ok test_class_decorators (test.test_tools.test_unparse.UnparseTestCase) ... ok test_class_definition (test.test_tools.test_unparse.UnparseTestCase) ... ok test_del_statement (test.test_tools.test_unparse.UnparseTestCase) ... ok test_dict_comprehension (test.test_tools.test_unparse.UnparseTestCase) ... ok test_dict_unpacking_in_dict (test.test_tools.test_unparse.UnparseTestCase) ... ok test_elifs (test.test_tools.test_unparse.UnparseTestCase) ... ok test_for_else (test.test_tools.test_unparse.UnparseTestCase) ... ok test_fstrings (test.test_tools.test_unparse.UnparseTestCase) ... ok test_function_arguments (test.test_tools.test_unparse.UnparseTestCase) ... ok test_huge_float (test.test_tools.test_unparse.UnparseTestCase) ... ok test_imaginary_literals (test.test_tools.test_unparse.UnparseTestCase) ... ok test_integer_parens (test.test_tools.test_unparse.UnparseTestCase) ... ok test_lambda_parentheses (test.test_tools.test_unparse.UnparseTestCase) ... ok test_min_int (test.test_tools.test_unparse.UnparseTestCase) ... ok test_nonlocal (test.test_tools.test_unparse.UnparseTestCase) ... ok test_raise_from (test.test_tools.test_unparse.UnparseTestCase) ... ok test_relative_import (test.test_tools.test_unparse.UnparseTestCase) ... ok test_set_comprehension (test.test_tools.test_unparse.UnparseTestCase) ... ok test_set_literal (test.test_tools.test_unparse.UnparseTestCase) ... ok test_shifts (test.test_tools.test_unparse.UnparseTestCase) ... ok test_starred_assignment (test.test_tools.test_unparse.UnparseTestCase) ... ok test_try_except_finally (test.test_tools.test_unparse.UnparseTestCase) ... ok test_unary_parens (test.test_tools.test_unparse.UnparseTestCase) ... ok test_while_else (test.test_tools.test_unparse.UnparseTestCase) ... ok test_with_as (test.test_tools.test_unparse.UnparseTestCase) ... ok test_with_simple (test.test_tools.test_unparse.UnparseTestCase) ... ok test_with_two_items (test.test_tools.test_unparse.UnparseTestCase) ... ok ====================================================================== ERROR: test_sundry (test.test_tools.test_sundry.TestSundryScripts) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Programs\Python36\lib\test\test_tools\test_sundry.py", line 36, in test_sundry import_tool(name) File "C:\Programs\Python36\lib\test\test_tools\__init__.py", line 21, in import_tool return importlib.import_module(toolname) File "C:\Programs\Python36\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 978, in _gcd_import File "", line 961, in _find_and_load File "", line 950, in _find_and_load_unlocked File "", line 655, in _load_unlocked File "", line 678, in exec_module File "", line 205, in _call_with_frames_removed File "C:\Programs\Python36\Tools\scripts\2to3.py", line 5, in sys.exit(main("lib2to3.fixes")) SystemExit: 1 ---------------------------------------------------------------------- Ran 59 tests in 3.481s FAILED (errors=1) Warning -- logging._handlerList was modified by test_tools Before: (2752582445576, [, ], []) After: (2752582445576, [, ], [, ]) test test_tools failed ---------- messages: 296477 nosy: ned.deily, terry.reedy priority: release blocker severity: normal status: open title: Failing tests with installed 3.6.2rc1 on Win 10-64 type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 15:15:22 2017 From: report at bugs.python.org (Guillaume Sanchez) Date: Tue, 20 Jun 2017 19:15:22 +0000 Subject: [New-bugs-announce] [issue30717] str.center() is not unicode aware Message-ID: <1497986122.28.0.540580196076.issue30717@psf.upfronthosting.co.za> New submission from Guillaume Sanchez: "a?".center(width=5, fillchar=".") produces '..a?.' instead of '..a?..' The reason is that "a?" is composed of two code points (2 UCS4 chars), one 'a' and one combining code point "above arrow". str.center() counts the size of the string and fills it both sides with `fillchar` until the size reaches `width`. However, this size is certainly intended to be the number of characters and not the number of code points. The correct way to count characters is to use the grapheme clustering algorithm from UAX TR29. Turns out I implemented this myself already, and might do the PR if asked so, with a little help to make the C <-> Python glue. Thanks for your time. ---------- components: Library (Lib) messages: 296478 nosy: Guillaume Sanchez priority: normal severity: normal status: open title: str.center() is not unicode aware versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 16:18:49 2017 From: report at bugs.python.org (Mansoor Ahmed) Date: Tue, 20 Jun 2017 20:18:49 +0000 Subject: [New-bugs-announce] [issue30718] open builtin function: specifying the size of buffer has no effect for text files Message-ID: <1497989929.05.0.713607879185.issue30718@psf.upfronthosting.co.za> New submission from Mansoor Ahmed: *This behavior was tested on a Linux system with Python 3.5 and 3.6 Passing the buffer size for the builtin function `open` has no effect for files opened in text mode: >>> sys.version '3.5.3 (default, Jan 19 2017, 14:11:04) \n[GCC 6.3.0 20170118]' >>> f = open("/home/user/Desktop/data.txt", "r+", buffering=30) >>> f.write("A" * 40) 40 My assumption is that, `f` is a text buffer and f.buffer is the binary buffer. Therefore, the buffering argument to `open` sets the buffering size to the binary buffer f.buffer. Confusingly, f.write("A" * 40) didn't fill the buffer although the 40 ASCII chars=40 bytes have been written to `f` which exceeds its buffer size (30 bytes) nothing was flushed by Python and (instead) the data set in `f` object. The problem is that, it seems that `f` acts as a text buffer with its own buffer size and its own flushing behavior which obstructs many concepts. Here are the main points: A) Despite passing the buffer size to open, `f` object acts as a text buffer and its size is set to f._CHUNK_SIZE. B) The default buffer size set to `f` by default renders the `buffering` argument to `open` virtually useless, this is because the programmer might think that Python flushes the data according to the binary buffer size passed to `open`. That is, when the programmer codes something like: f = open("/home/user/Desktop/data.txt", "r+", buffering=30) f.write("A" * 40) for a file opened by `open`, the programmer's assumption would most likely be that Python flushes the buffer when it's greater than 30 bytes in size for text files. But it really has another buffer on top of the binary buffer and the buffering argument sets the buffer size of the binary buffer `f.buffer` *not* `f`, the text buffer and `f` relies on the buffer size as set by default that can be seen through f._CHUNK_SIZE or from io.DEFAULT_BUFFER_SIZE. C) Calling f.flush flushes both buffers (f and f.buffer) all the way to f.buffer.raw and this further validates the point that given the buffering argument for text files, would technically be useless. >From Python Documentation for `open`: "buffering is an optional integer used to set the buffering policy. Pass 0 to switch buffering off (only allowed in binary mode), 1 to select line buffering (only usable in text mode), and an integer > 1 to indicate the size in bytes of a fixed-size chunk buffer. When no buffering argument is given, the default buffering policy works as follows: ..." "and an integer > 1 to indicate the size in bytes of a fixed-size chunk buffer." if this behavior was intentional in the implementation of Python, then I think the documentation should say something like this: and an integer > 1 sets the the default buffer size. ---------- components: IO, Interpreter Core messages: 296482 nosy: direprobs priority: normal severity: normal status: open title: open builtin function: specifying the size of buffer has no effect for text files type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 19:35:40 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Tue, 20 Jun 2017 23:35:40 +0000 Subject: [New-bugs-announce] [issue30719] IDLE: Make PyShell visible upon error. Message-ID: <1498001740.77.0.0953898655235.issue30719@psf.upfronthosting.co.za> New submission from Terry J. Reedy: Spinoff from #10079. "PseudoStderrFile" in PyShell.py brings the shell forward if an error occurs. It should be possible to extract G. Polo's patch for that class from the megapatch. A possible issue is that PseudoStdoutFile and PseudoStderrFile have been combined as PseudoOutputFile. That and PseudoInputfile are used in both the IDLE and user processes. ---------- assignee: terry.reedy components: IDLE messages: 296500 nosy: terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE: Make PyShell visible upon error. type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 20 22:38:32 2017 From: report at bugs.python.org (William Budd) Date: Wed, 21 Jun 2017 02:38:32 +0000 Subject: [New-bugs-announce] [issue30720] re.sub substitution match group contains wrong value after unmatched pattern was processed Message-ID: <1498012712.75.0.088701596169.issue30720@psf.upfronthosting.co.za> New submission from William Budd: pattern = re.compile('
(

.*?

)
', flags=re.DOTALL) ---------------------------------------------------------------- # This works as expected in the following case: print(re.sub(pattern, '\\1', '

foo

\n' '

bar

123456789
\n')) # which outputs:

foo

bar

123456789
---------------------------------------------------------------- # However, it does NOT work as I expect in this case: print(re.sub(pattern, '\\1', '

foo

123456789
\n' '

bar

\n')) # actual output:

foo

123456789

bar

# expected output:

foo

123456789

bar

---------------------------------------------------------------- It seems that pattern matching/substitution iterations only go haywire once the matching iteration immediately prior to it turned out not to be a match. Maybe some internal variable is not cleaned up properly in an edge(?) case triggered by the example above? ---------- components: Regular Expressions messages: 296506 nosy: William Budd, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: re.sub substitution match group contains wrong value after unmatched pattern was processed versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 21 01:13:56 2017 From: report at bugs.python.org (Sanyam Khurana) Date: Wed, 21 Jun 2017 05:13:56 +0000 Subject: [New-bugs-announce] [issue30721] Show expected input for right shift operator usage in custom "print" error message Message-ID: <1498022036.95.0.527028755561.issue30721@psf.upfronthosting.co.za> New submission from Sanyam Khurana: While working on issue: http://bugs.python.org/issue30597 to enhance the custom error message by showing expected output in Python3 syntax when someone uses Python2 syntax, a PR was raised: https://github.com/python/cpython/pull/2009, where we just handled the case for print with soft-space and excessive white-space. In the implementation discussion, an issue was raised to handle the case with right shift operator by Nick as in here: http://bugs.python.org/issue30597#msg295484 Nick suggested here about the possible patch: https://github.com/python/cpython/pull/2009#issuecomment-307539241 ---------- messages: 296518 nosy: CuriousLearner, ncoghlan priority: normal severity: normal status: open title: Show expected input for right shift operator usage in custom "print" error message type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 21 04:57:43 2017 From: report at bugs.python.org (Christoph Sarnowski) Date: Wed, 21 Jun 2017 08:57:43 +0000 Subject: [New-bugs-announce] [issue30722] Tools/demo/redemo.py broken Message-ID: <1498035463.93.0.0897725262949.issue30722@psf.upfronthosting.co.za> New submission from Christoph Sarnowski: In Python 3.6, the flags in the "re" module became members of an enum.IntFlag, whereas before they were just ints. This breaks the regex demo in Tools/demo/redemo.py. To fix this, in line 86 of redemo.py, getattr(re, name) has to be replaced by getattr(re, name).value Also, the checkbox for "LOCALE" can be removed (or fixed), as re.LOCALE is invalid for str patterns. ---------- components: Regular Expressions messages: 296530 nosy: Christoph Sarnowski2, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: Tools/demo/redemo.py broken type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 21 09:23:10 2017 From: report at bugs.python.org (Charles Wohlganger) Date: Wed, 21 Jun 2017 13:23:10 +0000 Subject: [New-bugs-announce] [issue30723] IDLE parenmatch - left and right highlighting, independent flash-delay Message-ID: <1498051390.64.0.726208179666.issue30723@psf.upfronthosting.co.za> New submission from Charles Wohlganger: Sorry, I'm new to this, and I've done it out of order. Commit #2306 covers the following: In IDLE, parenmatch extension: Add highlighting left and right parens to styles. Make flash-delay setting independent of parens highlighting style. Currently, the flash-delay option only affects one of the two styles, but there is no good reason for it not to affect both. ---------- assignee: terry.reedy components: IDLE messages: 296554 nosy: terry.reedy, wohlganger priority: normal severity: normal status: open title: IDLE parenmatch - left and right highlighting, independent flash-delay type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 21 12:06:47 2017 From: report at bugs.python.org (Kit Yan Choi) Date: Wed, 21 Jun 2017 16:06:47 +0000 Subject: [New-bugs-announce] [issue30724] ZipFile.open treats directory path as empty file Message-ID: <1498061207.73.0.213493352126.issue30724@psf.upfronthosting.co.za> New submission from Kit Yan Choi: Given a zipfile with the following content: subdir/ file1.txt subdir/file2.txt >>> archive = ZipFile(file_path, "r") >>> f = archive.open("subdir/", "r") >>>f.read() b'' It is quite odd that the subdirectory can be opened as if it was an empty file. One would expect it to raise. One use case is that the archive is created using shutil.make_archive, which includes the subdirectory paths in the namelist. Upon looping ZipFile.namelist(), you end up opening a subdirectory and getting the empty content, which should have led to error and prompted the developers to filter the namelist first. ---------- messages: 296564 nosy: Kit Yan Choi priority: normal severity: normal status: open title: ZipFile.open treats directory path as empty file type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 21 13:59:07 2017 From: report at bugs.python.org (Kevin Keating) Date: Wed, 21 Jun 2017 17:59:07 +0000 Subject: [New-bugs-announce] [issue30725] Windows installer for 2.7.13 doesn't install pip when installing to C:\Program Files Message-ID: <1498067947.84.0.203482425844.issue30725@psf.upfronthosting.co.za> New submission from Kevin Keating: If I use the Python 64-bit 2.7.13 Windows installer and install to C:\Program Files\Python27, then the Scripts folder doesn't get created and pip doesn't get installed. If I uninstall Python and reinstall it to C:\Python27, C:\Programs\Python27, or "C:\Path with spaces\Python27", then the Scripts folder is created and pip works correctly. If I install Python 2.7.12 using https://www.python.org/ftp/python/2.7.12/python-2.7.12.amd64.msi or Python 3.6.1 using https://www.python.org/ftp/python/3.6.1/python-3.6.1-amd64.exe, then I don't experience this issue. This issue does happen if I install to C:\PROGRA~1\Python27, which is the 8.3 filename equivalent of C:\Program Files\Python27. I've seen this on a handful of Windows 10 computers so far. I haven't tried other versions of Windows or the 32-bit installers. Steps to reproduce: - Download the Python installer from https://www.python.org/ftp/python/2.7.13/python-2.7.13.amd64.msi and run it. - Select "Install for all users" and click Next. - Enter C:\Program Files\Python27 as the installation folder and click Next. - Click on "Register Extensions" and select "Entire feature will be unavailable". (I don't know if this step is required, but it's what I've been doing to test.) Click Next. - Click Yes at the UAC prompt. - Wait for installation to finish. Expected results: The "C:\Program Files\Python27\Scripts" and "C:\Program Files\Python27\Lib\site-packages\pip" folders should get created during the installation. Actual results: Neither of the folders exist. ---------- components: Installation, Windows messages: 296571 nosy: KevKeating, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Windows installer for 2.7.13 doesn't install pip when installing to C:\Program Files versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 21 18:18:03 2017 From: report at bugs.python.org (Segev Finer) Date: Wed, 21 Jun 2017 22:18:03 +0000 Subject: [New-bugs-announce] [issue30726] [Windows] Warnings in elementtree due to new expat Message-ID: <1498083483.53.0.88013526442.issue30726@psf.upfronthosting.co.za> New submission from Segev Finer: We are getting: Warning C4005 'HAVE_MEMMOVE': macro redefinition _elementtree c:\users\segev\prj\python\cpython\modules\expat\winconfig.h 34 Warning C4267 '=': conversion from 'size_t' to 'unsigned char', possible loss of data _elementtree c:\users\segev\prj\python\cpython\modules\expat\siphash.h 316 Warning C4996 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. _elementtree C:\Users\Segev\prj\python\cpython\Modules\expat\xmlparse.c 796 Warning C4005 'HAVE_MEMMOVE': macro redefinition _elementtree c:\users\segev\prj\python\cpython\modules\expat\winconfig.h 34 Warning C4005 'HAVE_MEMMOVE': macro redefinition _elementtree c:\users\segev\prj\python\cpython\modules\expat\winconfig.h 34 And in 64-bit: c:\users\segev\prj\python\cpython\modules\expat\siphash.h(201): warning C4244: 'initializing': conversion from '__int64' to 'char', possible loss of data I'm not sure how many Python versions this affects. ---------- components: Extension Modules, Windows messages: 296590 nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: [Windows] Warnings in elementtree due to new expat versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 21 18:20:05 2017 From: report at bugs.python.org (STINNER Victor) Date: Wed, 21 Jun 2017 22:20:05 +0000 Subject: [New-bugs-announce] [issue30727] [2.7] test_threading.ConditionTests.test_notify() hangs randomly on FreeBSD on Python 2.7 Message-ID: <1498083605.56.0.378803721046.issue30727@psf.upfronthosting.co.za> New submission from STINNER Victor: Example where the test hangs after at the 48th run: ---- [haypo at freebsd ~/prog/python/2.7]$ ./python -m test -F -m test.test_threading.ConditionTests.test_notify -v test_threading (...) 0:00:10 [ 47] test_threading test_notify (test.test_threading.ConditionTests) ... ok (...) 0:00:10 [ 48] test_threading test_notify (test.test_threading.ConditionTests) ... ---- It looks like a timing issue / race condition since the likehood of the bug seems to depend on the system load. Traceback using my watchdog: https://github.com/python/cpython/pull/2317 --- 0:00:57 [285] test_threading test_notify (test.test_threading.ConditionTests) ... *** STACKTRACE - START *** # ThreadID: 34391913984 File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 37, in task f() File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 360, in f cond.wait() File: "/usr/home/haypo/prog/python/2.7/Lib/threading.py", line 340, in wait waiter.acquire() # ThreadID: 34392086528 File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 37, in task f() File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 360, in f cond.wait() File: "/usr/home/haypo/prog/python/2.7/Lib/threading.py", line 340, in wait waiter.acquire() # ThreadID: 34384994304 File: "/usr/home/haypo/prog/python/2.7/Lib/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File: "/usr/home/haypo/prog/python/2.7/Lib/runpy.py", line 72, in _run_code exec code in run_globals File: "/usr/home/haypo/prog/python/2.7/Lib/test/__main__.py", line 3, in regrtest.main_in_temp_cwd() File: "/usr/home/haypo/prog/python/2.7/Lib/test/regrtest.py", line 2030, in main_in_temp_cwd main() File: "/usr/home/haypo/prog/python/2.7/Lib/test/regrtest.py", line 812, in main result = local_runtest() File: "/usr/home/haypo/prog/python/2.7/Lib/test/regrtest.py", line 798, in local_runtest testdir=testdir) File: "/usr/home/haypo/prog/python/2.7/Lib/test/regrtest.py", line 1007, in runtest return runtest_inner(test, verbose, quiet, huntrleaks, pgo, testdir) File: "/usr/home/haypo/prog/python/2.7/Lib/test/regrtest.py", line 1196, in runtest_inner indirect_test() File: "/usr/home/haypo/prog/python/2.7/Lib/test/test_threading.py", line 929, in test_main ThreadingExceptionTests, File: "/usr/home/haypo/prog/python/2.7/Lib/test/support/__init__.py", line 1571, in run_unittest _run_suite(suite) File: "/usr/home/haypo/prog/python/2.7/Lib/test/support/__init__.py", line 1530, in _run_suite result = runner.run(suite) File: "/usr/home/haypo/prog/python/2.7/Lib/unittest/runner.py", line 151, in run test(result) File: "/usr/home/haypo/prog/python/2.7/Lib/unittest/suite.py", line 70, in __call__ return self.run(*args, **kwds) File: "/usr/home/haypo/prog/python/2.7/Lib/unittest/suite.py", line 108, in run test(result) File: "/usr/home/haypo/prog/python/2.7/Lib/unittest/suite.py", line 70, in __call__ return self.run(*args, **kwds) File: "/usr/home/haypo/prog/python/2.7/Lib/unittest/suite.py", line 108, in run test(result) File: "/usr/home/haypo/prog/python/2.7/Lib/unittest/case.py", line 393, in __call__ return self.run(*args, **kwds) File: "/usr/home/haypo/prog/python/2.7/Lib/unittest/case.py", line 329, in run testMethod() File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 401, in test_notify self._check_notify(cond) File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 384, in _check_notify _wait() File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 16, in _wait time.sleep(0.01) # ThreadID: 34384996864 File: "/usr/home/haypo/prog/python/2.7/Lib/threading.py", line 774, in __bootstrap self.__bootstrap_inner() File: "/usr/home/haypo/prog/python/2.7/Lib/threading.py", line 801, in __bootstrap_inner self.run() File: "/usr/home/haypo/prog/python/2.7/Lib/test/regrtest.py", line 1971, in run self.dump_threads() File: "/usr/home/haypo/prog/python/2.7/Lib/test/regrtest.py", line 1997, in dump_threads self.dump_thread(stack) # ThreadID: 34392083968 File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 37, in task f() File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 360, in f cond.wait() File: "/usr/home/haypo/prog/python/2.7/Lib/threading.py", line 340, in wait waiter.acquire() # ThreadID: 34392080128 File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 37, in task f() File: "/usr/home/haypo/prog/python/2.7/Lib/test/lock_tests.py", line 360, in f cond.wait() File: "/usr/home/haypo/prog/python/2.7/Lib/threading.py", line 340, in wait waiter.acquire() *** STACKTRACE - END *** --- ---------- components: Tests messages: 296591 nosy: haypo priority: normal severity: normal status: open title: [2.7] test_threading.ConditionTests.test_notify() hangs randomly on FreeBSD on Python 2.7 versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 21 19:36:55 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Wed, 21 Jun 2017 23:36:55 +0000 Subject: [New-bugs-announce] [issue30728] IDLE: Modernize configdialog code. Message-ID: <1498088215.04.0.812004436002.issue30728@psf.upfronthosting.co.za> New submission from Terry J. Reedy: Depending on the file, modernizing includes: * Add docstrings. * Change non-class names with caps to PEP8 no-caps names; this often means, for example, changing embedded 'A' to '_a'. * Make most comments be sentences, like this sentence. * Review and possibly change overly cryptic existing PEP8 names. * Switch to ttk widgets and revise imports; 'from tkinter import *' becomes 'from tkinter(.ttk) import item1, item2, ...'; use (...\n...) for multiple lines. * Split a toplevel class into a window class and a frame class. * Use modern code idioms and features up to current maintenance version. * Add tests, which are essential for checking correctness of above. For a large file like configdialog.py, I would like a separate PR or even issue for each item above. Of necessity, name changes must be done in test_configdialog.py, and it should be included in most patches for this issue. For some files, other consumers will also need patching. I don't think that modules other than test_configdialog access much of anything beside ConfigDialog, which name we are not presently changing. Cheryl's original patch for this issue combined conversion to pep8 names, revision of pep8 names (including existing #28523 'colour' to 'color'), and tkk and import conversion (and an unrelated typo correction in another file). Louie suggested adding comment revisions. At this point, I decided that this would be too much for one patch and that I would prefer more numerous patches that would be easier to review and test. (Louie's comments should be the basis for a separate PR.) Issue 28523 can be made a dependency of this issue and expanded to other name revisions. The order of changes is somewhat arbitrary, except that docstrings and comments do not need tests, and can be helpful for writing tests. Tests of some type are otherwise needed for the other steps. This presents a problem when code changes are needed to write tests. What is true is that each patch needs to apply to the current file, and once applied, should be backported immediately. (Out of order backports can 'work' but produce a wrong result. This happened already.) The problem of multiple patches to the same file possibly breaking each other includes exist patches on the tracker. When we changed textview, there were no outstanding patches that I know of. For help_about, there is an existing patch, but I did not want to apply it completely as is. Pieces of it will have to be adapted as needed. For config_key, there are at least 2 patches that may be ready-to-go or close to it. So I want to test those before writing additional patches to modernize config_key. I will review current config-dialog issues to see which have patches and which might be quick to apply. ---------- messages: 296603 nosy: csabella, louielu, terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE: Modernize configdialog code. type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 22 01:38:50 2017 From: report at bugs.python.org (Hang Liao) Date: Thu, 22 Jun 2017 05:38:50 +0000 Subject: [New-bugs-announce] [issue30729] Swap doesn't work in some circumstances Message-ID: <1498109930.97.0.653863984763.issue30729@psf.upfronthosting.co.za> New submission from Hang Liao: Suppose I have two lists L1 = [1,3,2,4], L2 = [1,3,2,4] L1[1], L1[2] = L1[2], L1[1] This gives me L1 = [1,2,3,4] However, if I write L2[1], L2[L2[1] - 1] = L2[L2[1] - 1], L2[1] This gives me back the same L2 = [1,3,2,4] I am not sure if this is a mistake ... If it is what it intended to do please tell me. ---------- components: macOS messages: 296614 nosy: Ikaros, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Swap doesn't work in some circumstances type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 22 04:07:00 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 22 Jun 2017 08:07:00 +0000 Subject: [New-bugs-announce] [issue30730] Injecting environment variable in subprocess on Windows Message-ID: <1498118820.13.0.596038385019.issue30730@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: It is possible to inject an environment variable in subprocess on Windows if a user data is passed to a subprocess via environment variable. Provided PR fixes this vulnerability. It also adds other checks for invalid environment (variable names containing '=') and command arguments (containing '\0'). This was a part of issue13617, but extracted to a separate issue due to increased severity. ---------- components: Extension Modules messages: 296618 nosy: paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: patch review status: open title: Injecting environment variable in subprocess on Windows type: security versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 22 05:33:42 2017 From: report at bugs.python.org (tumagonx) Date: Thu, 22 Jun 2017 09:33:42 +0000 Subject: [New-bugs-announce] [issue30731] Use correct executable manifest for windows Message-ID: <1498124022.5.0.932969179032.issue30731@psf.upfronthosting.co.za> New submission from tumagonx: I think there is typo in python default manifest (applies to exe dll and pyd) in official installation. currently written as: ... should be: ... notice the lowercase "i" in incorrect manifest ---------- messages: 296619 nosy: tumagonx priority: normal severity: normal status: open title: Use correct executable manifest for windows type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 22 05:38:57 2017 From: report at bugs.python.org (Krzysztof Nazarewski) Date: Thu, 22 Jun 2017 09:38:57 +0000 Subject: [New-bugs-announce] [issue30732] json.dumps() lack of information about RecursionError when using default function Message-ID: <1498124337.07.0.93184881583.issue30732@psf.upfronthosting.co.za> New submission from Krzysztof Nazarewski: RecursionErrors related to json.dumps' default argument give no information whatsoever about the underlying issue. Example: $ /usr/bin/python3 -c "import json;from decimal import Decimal;json.dumps(Decimal(),default=lambda v:round(v, 8))" Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.6/json/__init__.py", line 238, in dumps **kw).encode(obj) File "/usr/lib/python3.6/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "", line 1, in File "/usr/lib/python3.6/_pydecimal.py", line 1919, in __round__ return self.quantize(exp) File "/usr/lib/python3.6/_pydecimal.py", line 2603, in quantize return ans._fix(context) File "/usr/lib/python3.6/_pydecimal.py", line 1720, in _fix if not self: File "/usr/lib/python3.6/_pydecimal.py", line 852, in __bool__ return self._is_special or self._int != '0' RecursionError: maximum recursion depth exceeded in comparison Details: I have encountered issue when porting my code from Python 2 to 3. Traceback shows depth of 6, but says recursion was already reached. My first idea was that recursion counter was messed up, but it was not the case. Recursion limit was indeed reached because round() in Python 3 is returning Decimal and then applies default infinitely. The part of recursing code was inside C so it was not displayed in the traceback. Summing up it took me over 2 hours to determine what was wrong with the code. Fix ideas: - do not call default more than once on the same root object (might be problematic to implement) - raise an error if new object is equal to the previous (partially resolving issue since custom objects might not implement equality operator) - add a flag to raise an error when new object's class is equal to the previous (might give false positives hence the flag) ---------- components: Library (Lib) messages: 296620 nosy: Krzysztof Nazarewski priority: normal severity: normal status: open title: json.dumps() lack of information about RecursionError when using default function type: enhancement versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 22 08:34:09 2017 From: report at bugs.python.org (Jonathon Vandezande) Date: Thu, 22 Jun 2017 12:34:09 +0000 Subject: [New-bugs-announce] [issue30733] Typo in Document What's New: Calendar Message-ID: <1498134849.55.0.432143845642.issue30733@psf.upfronthosting.co.za> New submission from Jonathon Vandezande: Says: The HTMLCalendar has added new class attribute which ease the customisation the CSS classes in the produced HTML calendar. (Contributed by Oz Tiram in bpo-30095.) Should say: The HTMLCalendar has added new class attributes which ease the customisation of the CSS classes in the produced HTML calendar. (Contributed by Oz Tiram in bpo-30095.) Summary of changes: 'attribute' should be plural Missing an 'of' in front of 'the CSS classes', could also substitute 'of' for 'the' ---------- assignee: docs at python components: Documentation messages: 296625 nosy: Jonathon Vandezande, docs at python priority: normal severity: normal status: open title: Typo in Document What's New: Calendar type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 22 08:43:13 2017 From: report at bugs.python.org (George Shuklin) Date: Thu, 22 Jun 2017 12:43:13 +0000 Subject: [New-bugs-announce] [issue30734] 200000 indexes crashes eval and python (without eval) Message-ID: <1498135393.79.0.831850849211.issue30734@psf.upfronthosting.co.za> New submission from George Shuklin: If there is too many indexes python crashes: a[0][0][0][0].... segfault at 7ffd25fe6ff8 ip 0000564528c8cfe6 sp 00007ffd25fe7000 error 6 in python2.7[564528b6a000+324000] code to generate code: >>> i="[0]"*200000 >>> file('/tmp/bad_python.py','w').write('a=[]\na.append(a)\nprint(type(a'+i+'))\n') python2 /tmp/bad_python.py Segmentation fault (core dumped) python3 /tmp/bad_python.py RecursionError: maximum recursion depth exceeded during compilation Just in case I upload generated code. This bug affects both eval() function and python interpreter. ---------- components: Interpreter Core files: bad_python.py.gz messages: 296626 nosy: george-shuklin priority: normal severity: normal status: open title: 200000 indexes crashes eval and python (without eval) type: crash versions: Python 2.7 Added file: http://bugs.python.org/file46968/bad_python.py.gz _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 22 09:45:02 2017 From: report at bugs.python.org (Peter) Date: Thu, 22 Jun 2017 13:45:02 +0000 Subject: [New-bugs-announce] [issue30735] Python 3.6.1 test_asyncio fails on Solaris 11 Message-ID: <1498139102.26.0.319354129691.issue30735@psf.upfronthosting.co.za> New submission from Peter: I was building all the latest Python (2.7.13, 3.4.6, 3.5.3 and 3.6.1) on Solaris 11 using gcc 4.9.2 and found that Python 3.6.1 test_asyncio consistently fails while the other versions don't. Details: $ ./python -W default -bb -E -W error::BytesWarning -m test -r -w -j 0 test_asyncio Using random seed 44984 Run tests in parallel using 10 child processes 0:00:28 [1/1/1] test_asyncio failed Executing took 0.178 seconds test test_asyncio failed -- Traceback (most recent call last): File "/usr/local/src/Python-3.6.1/Lib/unittest/mock.py", line 1179, in patched return func(*args, **keywargs) File "/usr/local/src/Python-3.6.1/Lib/test/test_asyncio/test_base_events.py", line 1232, in test_create_connection_service_name t, p = self.loop.run_until_complete(coro) File "/usr/local/src/Python-3.6.1/Lib/asyncio/base_events.py", line 466, in run_until_complete return future.result() File "/usr/local/src/Python-3.6.1/Lib/asyncio/base_events.py", line 732, in create_connection infos = f1.result() File "/usr/local/src/Python-3.6.1/Lib/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/src/Python-3.6.1/Lib/socket.py", line 743, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 9] service name not available for the specified socket type 1 test failed: test_asyncio Re-running failed tests in verbose mode Re-running test 'test_asyncio' in verbose mode ... snipped ... ====================================================================== ERROR: test_create_connection_service_name (test.test_asyncio.test_base_events.BaseEventLoopWithSelectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/src/Python-3.6.1/Lib/unittest/mock.py", line 1179, in patched return func(*args, **keywargs) File "/usr/local/src/Python-3.6.1/Lib/test/test_asyncio/test_base_events.py", line 1232, in test_create_connection_service_name t, p = self.loop.run_until_complete(coro) File "/usr/local/src/Python-3.6.1/Lib/asyncio/base_events.py", line 466, in run_until_complete return future.result() File "/usr/local/src/Python-3.6.1/Lib/asyncio/base_events.py", line 732, in create_connection infos = f1.result() File "/usr/local/src/Python-3.6.1/Lib/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/src/Python-3.6.1/Lib/socket.py", line 743, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 9] service name not available for the specified socket type ====================================================================== ERROR: test_server_close (test.test_asyncio.test_events.PollEventLoopTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/src/Python-3.6.1/Lib/test/test_asyncio/test_events.py", line 1340, in test_server_close ConnectionRefusedError, client.connect, ('127.0.0.1', port)) File "/usr/local/src/Python-3.6.1/Lib/unittest/case.py", line 728, in assertRaises return context.handle('assertRaises', args, kwargs) File "/usr/local/src/Python-3.6.1/Lib/unittest/case.py", line 177, in handle callable_obj(*args, **kwargs) TimeoutError: [Errno 145] Connection timed out ====================================================================== ERROR: test_sock_client_fail (test.test_asyncio.test_events.PollEventLoopTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/src/Python-3.6.1/Lib/test/test_asyncio/test_events.py", line 471, in test_sock_client_fail self.loop.sock_connect(sock, address)) File "/usr/local/src/Python-3.6.1/Lib/asyncio/base_events.py", line 466, in run_until_complete return future.result() File "/usr/local/src/Python-3.6.1/Lib/asyncio/selector_events.py", line 451, in sock_connect return (yield from fut) File "/usr/local/src/Python-3.6.1/Lib/asyncio/selector_events.py", line 481, in _sock_connect_cb raise OSError(err, 'Connect call failed %s' % (address,)) TimeoutError: [Errno 145] Connect call failed ('127.0.0.1', 56937) ====================================================================== ERROR: test_server_close (test.test_asyncio.test_events.SelectEventLoopTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/src/Python-3.6.1/Lib/test/test_asyncio/test_events.py", line 1340, in test_server_close ConnectionRefusedError, client.connect, ('127.0.0.1', port)) File "/usr/local/src/Python-3.6.1/Lib/unittest/case.py", line 728, in assertRaises return context.handle('assertRaises', args, kwargs) File "/usr/local/src/Python-3.6.1/Lib/unittest/case.py", line 177, in handle callable_obj(*args, **kwargs) TimeoutError: [Errno 145] Connection timed out ====================================================================== ERROR: test_sock_client_fail (test.test_asyncio.test_events.SelectEventLoopTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/src/Python-3.6.1/Lib/test/test_asyncio/test_events.py", line 471, in test_sock_client_fail self.loop.sock_connect(sock, address)) File "/usr/local/src/Python-3.6.1/Lib/asyncio/base_events.py", line 466, in run_until_complete return future.result() File "/usr/local/src/Python-3.6.1/Lib/asyncio/selector_events.py", line 451, in sock_connect return (yield from fut) File "/usr/local/src/Python-3.6.1/Lib/asyncio/selector_events.py", line 481, in _sock_connect_cb raise OSError(err, 'Connect call failed %s' % (address,)) TimeoutError: [Errno 145] Connect call failed ('127.0.0.1', 43072) ---------------------------------------------------------------------- Ran 1402 tests in 785.313s FAILED (errors=5, skipped=4) test test_asyncio failed 1 test failed again: test_asyncio Total duration: 13 min 34 sec Tests result: FAILURE $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/sparc-sun-solaris2.11/4.9.2/lto-wrapper Target: sparc-sun-solaris2.11 Configured with: ../gcc-4.9.2/configure --prefix=/usr/local --enable-languages=c,c++ --disable-nls --with-gnu-as --with-gnu-ld --target=sparc-sun-solaris2.11 Thread model: posix gcc version 4.9.2 (GCC) ---------- components: asyncio messages: 296629 nosy: petriborg, yselivanov priority: normal severity: normal status: open title: Python 3.6.1 test_asyncio fails on Solaris 11 versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 22 09:46:00 2017 From: report at bugs.python.org (Steven D'Aprano) Date: Thu, 22 Jun 2017 13:46:00 +0000 Subject: [New-bugs-announce] [issue30736] Support Unicode 10.0 Message-ID: <1498139160.83.0.103732716798.issue30736@psf.upfronthosting.co.za> New submission from Steven D'Aprano: Unicode 10.0 is now finalized: http://blog.unicode.org/2017/06/announcing-unicode-standard-version-100.html It would be good if Python 3.7 would support it. (I think that Python currently supports Unicode 8?) ---------- messages: 296630 nosy: steven.daprano priority: normal severity: normal status: open title: Support Unicode 10.0 type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 22 13:05:47 2017 From: report at bugs.python.org (Mariatta Wijaya) Date: Thu, 22 Jun 2017 17:05:47 +0000 Subject: [New-bugs-announce] [issue30737] Update devguide link to the new URL Message-ID: <1498151147.34.0.638989883605.issue30737@psf.upfronthosting.co.za> New submission from Mariatta Wijaya: The Devguide has a new URL: https://devguide.python.org I believe there are a few references to the devguide from CPython documentation. Those links should be updated to the new url. ---------- assignee: Mariatta components: Documentation messages: 296644 nosy: Mariatta priority: normal severity: normal stage: needs patch status: open title: Update devguide link to the new URL versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 22 13:19:12 2017 From: report at bugs.python.org (Hiba) Date: Thu, 22 Jun 2017 17:19:12 +0000 Subject: [New-bugs-announce] [issue30738] __next__() method in iterators 9.9 Message-ID: <1498151952.1.0.340362281065.issue30738@psf.upfronthosting.co.za> New submission from Hiba: class Reverse: """Iterator for looping over a sequence backwards.""" def __init__(self, data): self.data = data self.index = len(data) def __iter__(self): return self def next(self): if self.index == 0: raise StopIteration self.index = self.index - 1 return self.data[self.index] ********************************************* The next() method in the above code snippet(from 9.9 Iterators section in Tutorial is not correctly overridden. It's missing the underscores. ---------- assignee: docs at python components: Documentation messages: 296646 nosy: docs at python, hiba priority: normal severity: normal status: open title: __next__() method in iterators 9.9 versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 23 09:07:06 2017 From: report at bugs.python.org (Luc Zimmermann) Date: Fri, 23 Jun 2017 13:07:06 +0000 Subject: [New-bugs-announce] [issue30739] pypi ssl errors [CERTIFICATE_VERIFY_FAILED] Message-ID: <1498223226.69.0.666030277766.issue30739@psf.upfronthosting.co.za> New submission from Luc Zimmermann: Hi Guys, I've a strange behavior. We use python for configure our new boxes with openWRT and coovaChilli. But since yesterday, when i ask to pip to dowload PyJWT, json-cfg and speedtest-cli, some boxes can download these packages, and some can't. root at OpenWrt:~# cat /root/.pip/pip.log ------------------------------------------------------------ /usr/bin/pip run on Thu Apr 13 18:46:19 2017 Downloading/unpacking PyJWT Getting page https://pypi.python.org/simple/PyJWT/ Could not fetch URL https://pypi.python.org/simple/PyJWT/: connection error: [SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c) Will skip URL https://pypi.python.org/simple/PyJWT/ when looking for download links for PyJWT Getting page https://pypi.python.org/simple/ Could not fetch URL https://pypi.python.org/simple/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max r) Will skip URL https://pypi.python.org/simple/ when looking for download links for PyJWT Cannot fetch index base URL https://pypi.python.org/simple/ URLs to search for versions for PyJWT: * https://pypi.python.org/simple/PyJWT/ Getting page https://pypi.python.org/simple/PyJWT/ Could not fetch URL https://pypi.python.org/simple/PyJWT/: connection error: [SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c) Will skip URL https://pypi.python.org/simple/PyJWT/ when looking for download links for PyJWT Could not find any downloads that satisfy the requirement PyJWT Cleaning up... Removing temporary dir /tmp/pip_build_root... No distributions at all found for PyJWT Exception information: Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 278, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1177, in prepare_files url = finder.find_requirement(req_to_install, upgrade=self.upgrade) File "/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/index.py", line 277, in find_requirement raise DistributionNotFound('No distributions at all found for %s' % req) DistributionNotFound: No distributions at all found for PyJWT ---------- messages: 296708 nosy: Luc Zimmermann priority: normal severity: normal status: open title: pypi ssl errors [CERTIFICATE_VERIFY_FAILED] type: resource usage versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 23 10:08:45 2017 From: report at bugs.python.org (Mark Haase) Date: Fri, 23 Jun 2017 14:08:45 +0000 Subject: [New-bugs-announce] [issue30740] SSLError when cancelling an SSL connection Message-ID: <1498226925.91.0.0585632472873.issue30740@psf.upfronthosting.co.za> New submission from Mark Haase: If a task is cancelled while it waiting for SSL negotiation, then an SSLError is raised, but there is no way (as far as I can tell) for the caller to catch it. (The example below is pretty contrived, but in an application I'm working on, the user can cancel downloads at any time.) Here's an example: import asyncio, random, ssl async def download(host): ssl_context = ssl.create_default_context() reader, writer = await asyncio.open_connection(host, 443, ssl=ssl_context) request = f'HEAD / HTTP/1.1\r\nHost: {host}\r\n\r\n' writer.write(request.encode('ascii')) lines = list() while True: newdata = await reader.readline() if newdata == b'\r\n': break else: lines.append(newdata.decode('utf8').rstrip('\r\n')) return lines[0] async def main(): while True: task = asyncio.Task(download('www.python.org')) await asyncio.sleep(random.uniform(0.0, 0.5)) task.cancel() try: response = await task print(response) except asyncio.CancelledError: print('request cancelled!') except ssl.SSLError: print('caught SSL error') await asyncio.sleep(1) loop = asyncio.get_event_loop() loop.run_until_complete(main()) loop.close() Running this script yields the following output: HTTP/1.1 200 OK request cancelled! HTTP/1.1 200 OK HTTP/1.1 200 OK : SSL handshake failed Traceback (most recent call last): File "/usr/lib/python3.6/asyncio/base_events.py", line 803, in _create_connection_transport yield from waiter File "/usr/lib/python3.6/asyncio/tasks.py", line 304, in _wakeup future.result() concurrent.futures._base.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/asyncio/sslproto.py", line 577, in _on_handshake_complete raise handshake_exc File "/usr/lib/python3.6/asyncio/sslproto.py", line 638, in _process_write_backlog ssldata = self._sslpipe.shutdown(self._finalize) File "/usr/lib/python3.6/asyncio/sslproto.py", line 155, in shutdown ssldata, appdata = self.feed_ssldata(b'') File "/usr/lib/python3.6/asyncio/sslproto.py", line 219, in feed_ssldata self._sslobj.unwrap() File "/usr/lib/python3.6/ssl.py", line 692, in unwrap return self._sslobj.shutdown() ssl.SSLError: [SSL] shutdown while in init (_ssl.c:2299) I posted this on async-sig, and Nathaniel replied: > SSLObject.unwrap has the contract that if it finishes successfully, then the SSL connection has been cleanly shut down and both sides remain in sync, and can continue to use the socket in unencrypted mode. When asyncio calls unwrap before the handshake has completed, then this contract is impossible to fulfill, and raising an error is the right thing to do. So imo the ssl module is correct here, and this is a (minor) bug in asyncio. The unwrap() call that throws is already wrapped in `try ... except SSLError` but the exception handler checks for specific SSL error codes and re-throws this particular SSL error. except (ssl.SSLError, ssl.CertificateError) as exc: if getattr(exc, 'errno', None) not in ( ssl.SSL_ERROR_WANT_READ, ssl.SSL_ERROR_WANT_WRITE, ssl.SSL_ERROR_SYSCALL): if self._state == _DO_HANDSHAKE and self._handshake_cb: self._handshake_cb(exc) raise self._need_ssldata = (exc.errno == ssl.SSL_ERROR_WANT_READ) I think this could be fixed checking for SSL_R_SHUTDOWN_WHILE_IN_INIT in this exception handler, but that constant doesn't exist in _ssl.c. As an alternative, maybe a new state _ABORT_HANDSHAKE could be introduced (the existing states are _DO_HANDSHAKE, _WRAPPED, _SHUTDOWN, and _UNWRAP). I'm happy to try my hand at either one of these approaches if somebody can point me in the right direction. ---------- components: asyncio messages: 296720 nosy: mehaase, yselivanov priority: normal severity: normal status: open title: SSLError when cancelling an SSL connection versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 23 10:24:00 2017 From: report at bugs.python.org (Luc Zimmermann) Date: Fri, 23 Jun 2017 14:24:00 +0000 Subject: [New-bugs-announce] [issue30741] https://www.pypi-mirrors.org/ error 503 Message-ID: <1498227840.1.0.346905721798.issue30741@psf.upfronthosting.co.za> New submission from Luc Zimmermann: is that linked with the certificate error on pypi ? you redirect http request to https, but you still listen 80 and not 443 ? ---------- messages: 296721 nosy: Luc Zimmermann priority: normal severity: normal status: open title: https://www.pypi-mirrors.org/ error 503 type: security _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 23 17:27:58 2017 From: report at bugs.python.org (=?utf-8?b?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 23 Jun 2017 21:27:58 +0000 Subject: [New-bugs-announce] [issue30742] VS2015 support for 2.7 branch Message-ID: <1498253278.08.0.871118250294.issue30742@psf.upfronthosting.co.za> New submission from D?enan Zuki?: In VS2015 timezone and friends have been replace by _timezone (related issue24643). The second problem is missing _PyVerify_fd during linking phase. ---------- components: Library (Lib) messages: 296738 nosy: D?enan Zuki? priority: normal severity: normal status: open title: VS2015 support for 2.7 branch versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 23 17:57:36 2017 From: report at bugs.python.org (Alessandro Piccione) Date: Fri, 23 Jun 2017 21:57:36 +0000 Subject: [New-bugs-announce] [issue30743] unittest discover does not mention module file must be named with "test_" prefix Message-ID: <1498255056.87.0.611217256865.issue30743@psf.upfronthosting.co.za> New submission from Alessandro Piccione: 1. execute "python -m unittest" 2. Result: 0 test found 3. Change file name from "aaaTest.py" to "test_aaa.py" 4. execute "python -m unittest" 3. Result: Ran 1 tests in 000.0s Module file MUST be named using the prefiux "test_". The page "https://docs.python.org/3/library/unittest.html" does not mention this MANDATORY rule. I went to this conclusion because I readed the documentation without find any point about the naming convention of modules and than looking for this specific rule searching "test_" and "test_ " without any result. Regards, Alessandro ---------- assignee: docs at python components: Documentation messages: 296740 nosy: alex.75, docs at python priority: normal severity: normal status: open title: unittest discover does not mention module file must be named with "test_" prefix versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 24 00:05:29 2017 From: report at bugs.python.org (Nathaniel Smith) Date: Sat, 24 Jun 2017 04:05:29 +0000 Subject: [New-bugs-announce] [issue30744] Local variable assignment is broken when combined with threads + tracing + closures Message-ID: <1498277129.07.0.940069687434.issue30744@psf.upfronthosting.co.za> New submission from Nathaniel Smith: The attached script looks innocent, but gives wildly incorrect results on all versions of CPython I've tested. It does two things: - spawns a thread which just loops, doing nothing - in the main thread, repeatedly increments a variable 'x' And most of the increments of the variable are lost! This requires two key things I haven't mentioned, but that you wouldn't expect to change anything. First, the thread function closes over the local variable 'x' (though it doesn't touch this variable in any way). And second, the thread function has a Python-level trace function registered (but this trace function is a no-op). Here's what's going on: When you use sys.settrace() to install a Python-level trace function, it installs the C-level trace function "call_trampoline". And then whenever a trace event happens, call_trampoline calls PyFrame_FastToLocalsWithError, then calls the Python-level trace function, then calls PyFrame_LocalsToFast (see: https://github.com/python/cpython/blob/master/Python/sysmodule.c#L384-L395). This save/call/restore sequence is safe if all the variables being saved/restored are only visible to the current thread, which used to be true back in the days when local variables were really local. But it turns out nowadays (since, uh... python 2.1), local variables can be closed over, and thus can visible from multiple threads simultaneously. Which means we get the following sequence of events: - In thread A, a trace event occurs (e.g., executing a line of code) - In thread A, call_trampoline does PyFrame_FastToLocalsWithError, which saves a snapshot of the current value of 'x' - In thread A, call_trampoline then starts calling the trace function - In thread B, we increment 'x' - In thread A, the trace function returns - In thread A, call_trampoline then does PyFrame_LocalsToFast, which restores the old value of 'x', overwriting thread B's modifications This means that merely installing a Python-level trace function ? for example, by running with 'python -m trace' or under pdb ? can cause otherwise correct code to give wrong answers, in an incredibly obscure fashion. In real life, I originally ran into this in a substantially more complicated situation involving PyPy and coverage.py and a nonlocal variable that was protected by a mutex, which you can read about here: https://bitbucket.org/pypy/pypy/issues/2591/ It turns out that since this only affects *Python*-level trace functions, merely recording coverage information using coverage.py doesn't normally trigger it, since on CPython coverage.py tries to install an accelerator module that uses a *C*-level trace function. Which is lucky for my particular case. But probably it should be fixed anyway :-). CC'ing belopolsky as the interest area for the trace module, Mark Shannon because he seems to enjoy really pathological low-level bugs, and Benjamin and Yury as the "bytecode" interest area. I'm surprised that there's apparently no interest area for, like, "variables should retain the values they are assigned" -- apologies if I've CC'ed anyone incorrectly. ---------- components: Interpreter Core files: thread-closure-bug-demo.py messages: 296751 nosy: Mark.Shannon, belopolsky, benjamin.peterson, njs, yselivanov priority: normal severity: normal status: open title: Local variable assignment is broken when combined with threads + tracing + closures versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46971/thread-closure-bug-demo.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 24 06:13:59 2017 From: report at bugs.python.org (Segev Finer) Date: Sat, 24 Jun 2017 10:13:59 +0000 Subject: [New-bugs-announce] [issue30745] Warnings in Modules/_winapi.c Message-ID: <1498299239.67.0.774522890033.issue30745@psf.upfronthosting.co.za> New submission from Segev Finer: ..\Modules\_winapi.c(886): warning C4090: 'function': different 'const' qualifiers ..\Modules\_winapi.c(848): warning C4101: 'wenvironment_size': unreferenced local variable Added in d174d24a5d37d1516b885dc7c82f71ecd5930700 ---------- components: Windows messages: 296761 nosy: Segev Finer, paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Warnings in Modules/_winapi.c type: compile error versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 24 15:05:15 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 24 Jun 2017 19:05:15 +0000 Subject: [New-bugs-announce] [issue30746] Reject environment variable names containing '=' Message-ID: <1498331115.22.0.815724101624.issue30746@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Environment variable names shouldn't contain the '=' character, because it often is used as a separator between a name and a value. There is an exception -- starting '=' on Windows is used for defining "hidden" environment variables. Using names containing '=' in environment dict in subprocess is prohibited in issue30730. Proposed PR prohibits names containing '=' in two other cases: in os.putenv() and os.spawn*(). It fixes the part of issue4926. ---------- components: Extension Modules messages: 296781 nosy: larry, loewis, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Reject environment variable names containing '=' type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 24 15:35:59 2017 From: report at bugs.python.org (=?utf-8?b?UMOkciBCasO2cmtsdW5k?=) Date: Sat, 24 Jun 2017 19:35:59 +0000 Subject: [New-bugs-announce] [issue30747] _Py_atomic_* not actually atomic on Windows with MSVC Message-ID: <1498332959.93.0.572211672441.issue30747@psf.upfronthosting.co.za> New submission from P?r Bj?rklund: _Py_atomic_store and _Py_atomic_load are not implemented as atomic operations on Windows when using Visual Studio to build. This might cause hard to troubleshoot behaviour, especially in third party hosting applications.. ---------- components: Interpreter Core messages: 296786 nosy: Paxxi priority: normal severity: normal status: open title: _Py_atomic_* not actually atomic on Windows with MSVC type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 24 18:33:37 2017 From: report at bugs.python.org (Ben Lewis) Date: Sat, 24 Jun 2017 22:33:37 +0000 Subject: [New-bugs-announce] [issue30748] Upgrade tuples in socket to named tuple like Message-ID: <1498343617.76.0.0345167407647.issue30748@psf.upfronthosting.co.za> New submission from Ben Lewis: Within the socket module, there are various tuples that are used for different representations of a socket address. There are also other tuples returned by other functions in the socket module. As suggested on Python-ideas(https://mail.python.org/pipermail/python-ideas/2017-June/046028.html) and supported by Guido(https://mail.python.org/pipermail/python-ideas/2017-June/046086.html) these tuples should be made into named-tuple like sequences akin to the time tuple in the datetime module. I am willing to help contribute to make this happen. ---------- components: IO messages: 296792 nosy: Ben Lewis priority: normal severity: normal status: open title: Upgrade tuples in socket to named tuple like type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 24 18:59:56 2017 From: report at bugs.python.org (Alex Groce) Date: Sat, 24 Jun 2017 22:59:56 +0000 Subject: [New-bugs-announce] [issue30749] Non-atomic and unusual (wrong) rename behavior under OS X, Python 2.7.13 Message-ID: <1498345196.68.0.88210579685.issue30749@psf.upfronthosting.co.za> New submission from Alex Groce: Attached file causes a failed rename, which is fine. However, after the failed rename, the directory structure has changed (and the error reported is not very helpful). Behavior does not match Linux or Windows behavior. Discovered using random testing to check pyfakefs for conformance with os module, using TSTL tool. ---------- components: macOS files: renameatomic.py messages: 296794 nosy: Alex Groce, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Non-atomic and unusual (wrong) rename behavior under OS X, Python 2.7.13 type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file46973/renameatomic.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 24 19:45:59 2017 From: report at bugs.python.org (Brett Cannon) Date: Sat, 24 Jun 2017 23:45:59 +0000 Subject: [New-bugs-announce] [issue30750] Update `make patchcheck` to understand Misc/NEWS.d Message-ID: <1498347959.85.0.344853864513.issue30750@psf.upfronthosting.co.za> New submission from Brett Cannon: Title says it all. ---------- messages: 296797 nosy: brett.cannon, pitrou priority: normal severity: normal status: open title: Update `make patchcheck` to understand Misc/NEWS.d _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 25 01:50:20 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Sun, 25 Jun 2017 05:50:20 +0000 Subject: [New-bugs-announce] [issue30751] IDLE: Display entry errors for key sequence entry in entry box Message-ID: <1498369820.44.0.770357079807.issue30751@psf.upfronthosting.co.za> New submission from Terry J. Reedy: One of the features of query.Query boxes is that error messages are displayed in the box (in red) rather than in a separate tkinter.messagebox error box (showerror). This issue is about copying the idea and implementation to config_key.GetKeysDialog. To make testing of patched methods easier, #6739 is adding a trivial showerror method (= tkinter.messagebox.showerror). This issue will replace it with Query.showerror def showerror(self, message, widget=None): #self.bell(displayof=self) (widget or self.entry_error)['text'] = 'ERROR: ' + message and add something like self.entry_error = Label(frame, text=' ', foreground='red', font=self.error_font) just above the exit buttons. This issue should probably add subtests for the ValidationTests. Message test and line break when needed will be adjusted by visual checks. ---------- assignee: terry.reedy components: IDLE messages: 296804 nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE: Display entry errors for key sequence entry in entry box type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 25 05:14:37 2017 From: report at bugs.python.org (=?utf-8?q?Ren=C3=A9_Podlogar?=) Date: Sun, 25 Jun 2017 09:14:37 +0000 Subject: [New-bugs-announce] [issue30752] Basic subtraction is wrong ( 1.83 - 1.52 == 0.31000000000000005) Message-ID: <1498382077.7.0.583083821643.issue30752@psf.upfronthosting.co.za> New submission from Ren? Podlogar: My Python-Installations Python 2.7.12, Python 3.4.5 @linux64 and the CLI on the python.org-Website (interactive shell) affected: Python 3.6.0 (default, Jan 13 2017, 00:00:00) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 1.83 - 1.52 0.31000000000000005 >>> Expected= 0.31 Verified in irc-channel #python.de ---------- messages: 296817 nosy: Ren? Podlogar priority: normal severity: normal status: open title: Basic subtraction is wrong ( 1.83 - 1.52 == 0.31000000000000005) versions: Python 2.7, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 25 07:11:27 2017 From: report at bugs.python.org (Vishal Devgn) Date: Sun, 25 Jun 2017 11:11:27 +0000 Subject: [New-bugs-announce] [issue30753] not able to execute print command on page 16 of documentation Message-ID: <1498389087.09.0.895603326933.issue30753@psf.upfronthosting.co.za> New submission from Vishal Devgn: >>> a, b = 0, 1 >>> while b < 1000: ... print(b, end=',') ... a, b = b, a+b in 3.6 as soon as i write print command, it displays an indentation error. ---------- files: 1.png messages: 296821 nosy: Vishal Devgn priority: normal severity: normal status: open title: not able to execute print command on page 16 of documentation type: compile error versions: Python 3.6 Added file: http://bugs.python.org/file46974/1.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 25 11:25:24 2017 From: report at bugs.python.org (Julian Berman) Date: Sun, 25 Jun 2017 15:25:24 +0000 Subject: [New-bugs-announce] [issue30754] textwrap.dedent mishandles empty lines Message-ID: <1498404324.65.0.525714137023.issue30754@psf.upfronthosting.co.za> New submission from Julian Berman: ? python2 -c 'from textwrap import dedent; print repr(dedent(" " * 2 + "\n" + " " * 4 + "\n"))' '\n\n' instead of the presumed '\n \n' The same appears to be the case for py3.6. (At first glance, this seems unrelated to http://bugs.python.org/issue19479 although that issue seems to have an unreviewed patch that changes the implementation, so it might also "accidentally" fix the issue). ---------- components: Library (Lib) messages: 296825 nosy: Julian, georg.brandl, terry.reedy priority: normal severity: normal status: open title: textwrap.dedent mishandles empty lines type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 25 12:58:59 2017 From: report at bugs.python.org (Matthew Woodcraft) Date: Sun, 25 Jun 2017 16:58:59 +0000 Subject: [New-bugs-announce] [issue30755] locale.normalize() and getdefaultlocale() convert C.UTF-8 to en_US.UTF-8 Message-ID: <1498409939.21.0.261757462715.issue30755@psf.upfronthosting.co.za> New submission from Matthew Woodcraft: I have a system where the default locale is C.UTF-8, and en_US.UTF-8 is not installed. But locale.normalize() unhelpfully converts "C.UTF-8" to "en_US.UTF-8". So the following crashes for me: python3.6 -c "import locale;locale.setlocale(locale.LC_ALL, ('C', 'UTF-8'))" Similarly getdefaultlocale() returns ('en_US', 'UTF-8'), so this crashes too: export LANG=C.UTF-8 unset LC_CTYPE unset LC_ALL unset LANGUAGE python3.6 -c "import locale;locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())" This behaviour is caused by a locale_alias entry in Lib/locale.py . https://bugs.python.org/issue20076 documents its addition but doesn't provide a rationale. I can see that it might be helpful to provide such a conversion if C.UTF-8 doesn't exist and en_US.UTF-8 does, but the current code is breaking modern correctly-configured systems for the benefit of old misconfigured ones (C.UTF-8 shouldn't really be in the environment if it isn't available on the system, after all). ---------- messages: 296828 nosy: mattheww priority: normal severity: normal status: open title: locale.normalize() and getdefaultlocale() convert C.UTF-8 to en_US.UTF-8 versions: Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 25 15:02:20 2017 From: report at bugs.python.org (Cheryl Sabella) Date: Sun, 25 Jun 2017 19:02:20 +0000 Subject: [New-bugs-announce] [issue30756] GUI tests fail on Ubuntu Message-ID: <1498417340.5.0.500567108578.issue30756@psf.upfronthosting.co.za> New submission from Cheryl Sabella: Running the tests over up to date build on Ubuntu 16.04 64-bit. ./python -m test.test_ttk_guionly -v Sometimes this runs without failure and sometimes it 'hangs' and then produces failures. When it hangs, my computer freezes completely. As you can see, it can run for 8 minutes. It seems to hang most often on test_idenify in EntryTest. Here's one set of failures: ====================================================================== FAIL: test_identify (tkinter.test.test_ttk.test_widgets.EntryTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 332, in test_identify self.assertEqual(self.entry.identify(5, 5), "textarea") AssertionError: '' != 'textarea' + textarea ====================================================================== FAIL: test_get (tkinter.test.test_ttk.test_widgets.ScaleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 807, in test_get self.assertEqual(self.scale.get(scale_width, 0), self.scale['to']) AssertionError: 0.0 != 1.0 ====================================================================== FAIL: test_set (tkinter.test.test_ttk.test_widgets.ScaleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 849, in test_set self.assertEqual(conv(self.scale.get(self.scale.winfo_width(), 0)), max) AssertionError: 0.0 != 1.0 ====================================================================== FAIL: test_identify (tkinter.test.test_ttk.test_widgets.WidgetTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 71, in test_identify ), "label") AssertionError: '' != 'label' + label ---------------------------------------------------------------------- Ran 272 tests in 491.572s FAILED (failures=4) Here's another set from a different run: ====================================================================== FAIL: test_get (tkinter.test.test_ttk.test_widgets.ScaleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 807, in test_get self.assertEqual(self.scale.get(scale_width, 0), self.scale['to']) AssertionError: 0.0 != 1.0 ====================================================================== FAIL: test_set (tkinter.test.test_ttk.test_widgets.ScaleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 849, in test_set self.assertEqual(conv(self.scale.get(self.scale.winfo_width(), 0)), max) AssertionError: 0.0 != 1.0 ====================================================================== FAIL: test_identify (tkinter.test.test_ttk.test_widgets.WidgetTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 71, in test_identify ), "label") AssertionError: '' != 'label' + label ====================================================================== FAIL: test_horizontal_range (tkinter.test.test_ttk.test_extensions.LabeledScaleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cheryl/cpython/Lib/tkinter/test/test_ttk/test_extensions.py", line 122, in test_horizontal_range self.assertEqual(prev_xcoord, int(linfo_1['x'])) AssertionError: 16 != 1 ---------------------------------------------------------------------- Ran 272 tests in 353.180s FAILED (failures=4) ---------- components: Tests messages: 296835 nosy: csabella, serhiy.storchaka, terry.reedy priority: normal severity: normal status: open title: GUI tests fail on Ubuntu versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 00:26:08 2017 From: report at bugs.python.org (Denis Akhiyarov) Date: Mon, 26 Jun 2017 04:26:08 +0000 Subject: [New-bugs-announce] [issue30757] pyinstaller can be added to docs, py2exe ref can be updated Message-ID: <1498451168.27.0.593036349197.issue30757@psf.upfronthosting.co.za> New submission from Denis Akhiyarov: https://github.com/python/cpython/pull/1158 It is not clear why this FAQ item is written in addition to this document: https://github.com/python/cpython/blob/master/Doc/faq/windows.rst#how-do-i-make-python-scripts-executable https://github.com/python/cpython/blob/master/Doc/faq/programming.rst#how-can-i-create-a-stand-alone-binary-from-a-python-script ---------- assignee: docs at python components: Documentation messages: 296844 nosy: denfromufa, docs at python priority: normal severity: normal status: open title: pyinstaller can be added to docs, py2exe ref can be updated type: enhancement versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 05:39:54 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 26 Jun 2017 09:39:54 +0000 Subject: [New-bugs-announce] [issue30758] test_pydoc (regrtest?) hangs on ARMv7 Ubuntu 3.x Message-ID: <1498469994.85.0.367724213837.issue30758@psf.upfronthosting.co.za> New submission from STINNER Victor: > ./python ./Tools/scripts/run_tests.py -j 1 -u all -W --slowest --timeout=900 -j2 -j8 faulthandler was supposed to kill test_pydoc after 15 minutes, and regrtest is supposed to log "running: pydoc (since xxx seconds)" every 30 seconds. Something gone bad. Buildbot killed regrtest because it didn't produce output during 20 minutes. http://buildbot.python.org/all/builders/ARMv7%20Ubuntu%203.x/builds/968/steps/test/logs/stdio running: test_pydoc (420 sec), test_datetime (234 sec), test_tools (258 sec) 0:11:42 load avg: 3.90 [404/406] test_datetime passed (240 sec) -- running: test_pydoc (428 sec), test_tools (266 sec) running: test_pydoc (458 sec), test_tools (296 sec) 0:12:13 load avg: 3.15 [405/406] test_tools passed (296 sec) -- running: test_pydoc (459 sec) command timed out: 1200 seconds without output running ['make', 'buildbottest', 'TESTOPTS=-j2 -j8', 'TESTPYTHONOPTS=', 'TESTTIMEOUT=900'], attempting to kill process killed by signal 9 program finished with exit code -1 elapsedTime=1936.512343 ---------- components: Tests keywords: buildbot messages: 296861 nosy: haypo priority: normal severity: normal status: open title: test_pydoc (regrtest?) hangs on ARMv7 Ubuntu 3.x versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 05:44:05 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 26 Jun 2017 09:44:05 +0000 Subject: [New-bugs-announce] [issue30759] [2.7] Fix python2 -m test --list-cases test_multibytecodec_support test_robotparser Message-ID: <1498470245.46.0.632048342488.issue30759@psf.upfronthosting.co.za> New submission from STINNER Victor: On Python 2.7, listing *all* test cases with "./python -m test --list-cases" fails on the following test files: * test_multibytecodec_support * test_robotparser regrtest of Python 2.7 uses the test_main() function of each test file, if the function is defined. Whereas --list-cases is more written as a raw discovery function listing all cases which inherit from unittest.TestCase. These 3 files have base test cases which are "abstract" or configured below. Options: * Modify --list-cases to tolerate failures and report them at exit * Modify these 2 tests to make them more "test discovery"-friendly * Use test_main() function if available but modify its behaviour to only list test cases, instead of running them I would prefer to limit changes in Python 2.7 branch, so IMHO the second option is the best: modify the 2 tests. haypo at selma$ ./python -m test --list-cases test_multibytecodec_support Traceback (most recent call last): ... File "/home/haypo/prog/python/2.7/Lib/test/test_multibytecodec_support.py", line 268, in __init__ self.open_mapping_file().close() # test it to report the error early File "/home/haypo/prog/python/2.7/Lib/test/test_multibytecodec_support.py", line 273, in open_mapping_file return test_support.open_urlresource(self.mapfileurl) AttributeError: 'TestBase_Mapping' object has no attribute 'mapfileurl' haypo at selma$ ./python -m test --list-cases test_robotparser Traceback (most recent call last): ... File "/home/haypo/prog/python/2.7/Lib/test/regrtest.py", line 1511, in list_cases suite = unittest.defaultTestLoader.loadTestsFromName(abstest) File "/home/haypo/prog/python/2.7/Lib/unittest/loader.py", line 103, in loadTestsFromName return self.loadTestsFromModule(obj) File "/home/haypo/prog/python/2.7/Lib/unittest/loader.py", line 65, in loadTestsFromModule tests.append(self.loadTestsFromTestCase(obj)) File "/home/haypo/prog/python/2.7/Lib/unittest/loader.py", line 56, in loadTestsFromTestCase loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames)) TypeError: __init__() takes exactly 6 arguments (2 given) ---------- messages: 296862 nosy: haypo priority: normal severity: normal status: open title: [2.7] Fix python2 -m test --list-cases test_multibytecodec_support test_robotparser _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 05:48:10 2017 From: report at bugs.python.org (quanyechavshuo) Date: Mon, 26 Jun 2017 09:48:10 +0000 Subject: [New-bugs-announce] [issue30760] configparse module in python3 can not write '%' to config file Message-ID: <1498470490.58.0.585332868378.issue30760@psf.upfronthosting.co.za> New submission from quanyechavshuo: Hello,I was using configparser module in python3.6,but find it works not good when I try to write '%' to my config file,below is my func: def update_config_file_key_value(file, section, key_name, key_value): # ??configparser??????????? # section?[]???? if os.path.exists(file) == False: os.system("touch %s" % file) import configparser config = configparser.ConfigParser() config.read(file) sectionList = config.sections() if section not in sectionList: config.add_section(section) config.set(section, key_name, str(key_value)) with open(file, 'w') as f: config.write(f) When I use it as: update_config_file_key_value('config.ini','default','cookie',"123") it works well,but below not ok: update_config_file_key_value('config.ini','default','cookie',"%123") and below not ok: update_config_file_key_value('config.ini','default','cookie',"123%") and below not ok: update_config_file_key_value('config.ini','default','cookie',"12%3") That's to say,configparser can not write '%' to config file. ---------- messages: 296865 nosy: quanyechavshuo priority: normal severity: normal status: open title: configparse module in python3 can not write '%' to config file type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 06:10:13 2017 From: report at bugs.python.org (Louie Lu) Date: Mon, 26 Jun 2017 10:10:13 +0000 Subject: [New-bugs-announce] [issue30761] pdb: Add step / next count arguments Message-ID: <1498471813.04.0.648864128078.issue30761@psf.upfronthosting.co.za> New submission from Louie Lu: This propose to add *count* times on step and next instruction in pdb. step [count] next [count] User can use `next [count]` to run next *count* times, or `step [count]` to run step *count* times, until it countdown, or occure a breakpoint. Similar function has been implemented in gdb[1] before. [1]: https://sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html ---------- components: Library (Lib) messages: 296869 nosy: louielu priority: normal severity: normal status: open title: pdb: Add step / next count arguments type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 06:13:37 2017 From: report at bugs.python.org (Antoine Pietri) Date: Mon, 26 Jun 2017 10:13:37 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue30762=5D_Misleading_messag?= =?utf-8?b?ZSDigJxjYW4ndCBjb25jYXQgYnl0ZXMgdG8gc3Ry4oCd?= Message-ID: <1498472017.09.0.210411923746.issue30762@psf.upfronthosting.co.za> New submission from Antoine Pietri: >>> b'a' + 'a' Traceback (most recent call last): File "", line 1, in TypeError: can't concat bytes to str This error message is misleading because it is reversed: what is really happening is that we're concatenating str to bytes! When you say "attach A to B" it means B is there first and A is added to it afterwards. That said, we can't just reverse the message (?can't concat str to bytes?), because having the message reversed compared to the code would be also misleading. I therefore propose to use ?and? (? ?can't concat bytes and str?), which makes more sense and preserve the order. ---------- messages: 296870 nosy: antoine.pietri priority: normal severity: normal status: open title: Misleading message ?can't concat bytes to str? _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 07:30:08 2017 From: report at bugs.python.org (Yang Xiao) Date: Mon, 26 Jun 2017 11:30:08 +0000 Subject: [New-bugs-announce] [issue30763] There is functionality bug in linecache library. Message-ID: <1498476608.04.0.760408193877.issue30763@psf.upfronthosting.co.za> New submission from Yang Xiao: There is a functionality bug in linecache library. >>test.py<< import linecache def test_getline(f): print linecache.getlines(f) if __name__ == "__main__": tf1 = 'aaa' with open(tf1,'w') as f: f.write('good morning\n') test_getline(tf1) tf2 = 'bbb' with open(tf2,'w') as f: f.write('good evening\n') test_getline(tf2) tf1 = 'aaa' with open(tf1,'w') as f: f.write('good morning 123\n') test_getline(tf1) tf2 = 'bbb' with open(tf2,'w') as f: f.write('good evening 123\n') test_getline(tf2) The expectant output shoule be: ['good morning\n'] ['good evening\n'] ['good morning\n'] ['good evening\n'] However, the script above outputs below: ['good morning\n'] ['good evening\n'] ['good morning\n'] ['good evening\n'] I think there is a bug about implementation of linecache library. ---------- components: 2to3 (2.x to 3.x conversion tool) messages: 296874 nosy: Yang Xiao priority: normal severity: normal status: open title: There is functionality bug in linecache library. type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 08:17:09 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 26 Jun 2017 12:17:09 +0000 Subject: [New-bugs-announce] [issue30764] regrtest: Add --fail-env-changed option Message-ID: <1498479429.85.0.905289080128.issue30764@psf.upfronthosting.co.za> New submission from STINNER Victor: The be able to debug bpo-30280 using my bisection script: https://github.com/haypo/misc/blob/205fea00d509ddd1cffa30c5c6f2da012f3ec54e/python/bisect_test.py I would like to be able to mark tests which alter the environment as failed, using an explicit option. It would be nice to be able to enable this option by default, or even remove the option and just make the behaviour as the default, but it would require to fix some issues first (like bpo-30280). ---------- components: Tests messages: 296883 nosy: haypo priority: normal severity: normal status: open title: regrtest: Add --fail-env-changed option type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 08:27:17 2017 From: report at bugs.python.org (Antoine Pitrou) Date: Mon, 26 Jun 2017 12:27:17 +0000 Subject: [New-bugs-announce] [issue30765] PyThread_acquire_lock can block even when asked not ot Message-ID: <1498480037.14.0.659231073261.issue30765@psf.upfronthosting.co.za> New submission from Antoine Pitrou: Discovered in issue30703. When POSIX semaphores are not used for Python locks, pthread_mutex_lock() is called for acquiring a lock even when asked not to block. This can be disastrous when called from a signal handler. ---------- components: Interpreter Core messages: 296886 nosy: haypo, ned.deily, pitrou, ronaldoussoren priority: normal severity: normal stage: needs patch status: open title: PyThread_acquire_lock can block even when asked not ot type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 08:40:49 2017 From: report at bugs.python.org (Antoine Pitrou) Date: Mon, 26 Jun 2017 12:40:49 +0000 Subject: [New-bugs-announce] [issue30766] Make CHECK_STATUS_PTHREAD signal-safe Message-ID: <1498480849.13.0.653593799418.issue30766@psf.upfronthosting.co.za> New submission from Antoine Pitrou: Lock functions may be called from the C signal handler, so strive to make them more signal-safe (they are not unfortunately, but minimizing the number of non-signal-safe functions called there is a good thing). Discovered in issue30703. ---------- components: Interpreter Core messages: 296887 nosy: pitrou priority: low severity: normal stage: needs patch status: open title: Make CHECK_STATUS_PTHREAD signal-safe type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 09:23:05 2017 From: report at bugs.python.org (Mihail Krivushin) Date: Mon, 26 Jun 2017 13:23:05 +0000 Subject: [New-bugs-announce] [issue30767] logging must check exc_info correctly Message-ID: <1498483385.09.0.415131659339.issue30767@psf.upfronthosting.co.za> New submission from Mihail Krivushin: Logging checking `if exc_info:` and this maybe incorrect, due exception instance can have __bool__ method and thus can be false. If this is a case, then error that is return false from __bool__ will cause logging to swallow traceback. We need to check exc_info correctly. Will do PR myself. ---------- components: Library (Lib) messages: 296892 nosy: krivushinme priority: normal severity: normal status: open title: logging must check exc_info correctly _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 09:50:01 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 26 Jun 2017 13:50:01 +0000 Subject: [New-bugs-announce] [issue30768] PyThread_acquire_lock_timed() should recompute the timeout when interrupted by a signal Message-ID: <1498485001.71.0.115721395457.issue30768@psf.upfronthosting.co.za> New submission from STINNER Victor: The current code of PyThread_acquire_lock_timed() (the implementation not using semaphore) doesn't compute correctly the timeout when pthread_cond_timedwait() is interrupted by a signal. We should recompute the timeout using a deadline. Something like select.select(): if (tvp) deadline = _PyTime_GetMonotonicClock() + timeout; do { ... use tvp if (errno != EINTR) break; /* select() was interrupted by a signal */ if (PyErr_CheckSignals()) goto finally; if (tvp) { timeout = deadline - _PyTime_GetMonotonicClock(); if (timeout < 0) { n = 0; break; } _PyTime_AsTimeval_noraise(timeout, &tv, _PyTime_ROUND_CEILING); /* retry select() with the recomputed timeout */ } } while (1); ---------- messages: 296896 nosy: haypo, neologix, pitrou priority: normal severity: normal status: open title: PyThread_acquire_lock_timed() should recompute the timeout when interrupted by a signal versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 12:41:42 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 26 Jun 2017 16:41:42 +0000 Subject: [New-bugs-announce] [issue30769] test_execve_invalid_env() of test_os leaks references Message-ID: <1498495302.46.0.49393281355.issue30769@psf.upfronthosting.co.za> New submission from STINNER Victor: haypo at selma$ ./python -m test -R 3:3 -m test_execve_invalid_env test_os test_os leaked [2, 2, 2] references, sum=6 test_os leaked [2, 2, 2] memory blocks, sum=6 I don't understand if it's related to bpo-30602 or not? ---------- components: Tests messages: 296915 nosy: haypo priority: normal severity: normal status: open title: test_execve_invalid_env() of test_os leaks references type: resource usage versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 14:08:51 2017 From: report at bugs.python.org (Nate Soares) Date: Mon, 26 Jun 2017 18:08:51 +0000 Subject: [New-bugs-announce] [issue30772] If I make an attribute "[a unicode version of B]", it gets assigned to "[ascii B]", and so on. Message-ID: <1498500531.27.0.587971014084.issue30772@psf.upfronthosting.co.za> New submission from Nate Soares: [NOTE: In this comment, I use BB to mean unicode character 0x1D539, b/c the issue tracker won't let me submit a comment with unicode characters in it.] Directory structure: repro/ foo.py test_foo.py Contents of foo.py: BB = 1 __all__ = ['BB'] Contents of test_foo.py: from .foo import * Error message: AttributeError: module 'repro.foo' has no attribute 'BB' If I change foo.py to have `__all__ = ['B']` (note that 'B' is not the same as 'BB'), then everything works "fine", modulo the fact that now foo.B is a thing and foo.BB is not a thing. [Recall that in the above, BB is a placeholder for U+1D539, which the issuetracker prevents me from writing here.] ---------- components: Unicode messages: 296928 nosy: Nate Soares, ezio.melotti, haypo priority: normal severity: normal status: open title: If I make an attribute "[a unicode version of B]", it gets assigned to "[ascii B]", and so on. versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 14:55:33 2017 From: report at bugs.python.org (Dima Tisnek) Date: Mon, 26 Jun 2017 18:55:33 +0000 Subject: [New-bugs-announce] [issue30773] async generator receives wrong value when shared between coroutines Message-ID: <1498503333.78.0.356156621032.issue30773@psf.upfronthosting.co.za> New submission from Dima Tisnek: MRE ``` import asyncio async def generator(): while True: x = yield 42 print("received", x) await asyncio.sleep(0.1) async def user(name, g): print("sending", name) await g.asend(name) async def helper(): g = generator() await g.asend(None) await asyncio.gather(*(user(f"user-{x}", g) for x in range(3))) if __name__ == "__main__": asyncio.get_event_loop().run_until_complete(helper()) ``` Produces output: ``` sending user-0 received user-0 sending user-1 sending user-2 received None received None ``` Expected output (some variance allowed): ``` sending user-0 received user-0 sending user-1 sending user-2 received user-1 received user-2 ``` Initial report / discussion: https://mail.python.org/pipermail/async-sig/2017-June/000293.html ---------- components: asyncio messages: 296931 nosy: Dima.Tisnek, yselivanov priority: normal severity: normal status: open title: async generator receives wrong value when shared between coroutines type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 15:56:59 2017 From: report at bugs.python.org (Antoine Pitrou) Date: Mon, 26 Jun 2017 19:56:59 +0000 Subject: [New-bugs-announce] [issue30774] list_repr not safe against concurrent mutation Message-ID: <1498507019.02.0.505462443219.issue30774@psf.upfronthosting.co.za> New submission from Antoine Pitrou: list_repr() is careful to fetch the list size on each iteration. However, it seems that the list size may be mutated just after by concurrent code, perhaps in _PyUnicodeWriter_WriteASCIIString() or Py_EnterRecursiveCall(). I witnessed this with a signal handler that shrank a list while printing a list from a loop in the main code path. gdb excerpt: Program received signal SIGSEGV, Segmentation fault. 0x00000000004a17d6 in PyObject_Repr (v=) at Objects/object.c:485 485 res = (*v->ob_type->tp_repr)(v); (gdb) bt #0 0x00000000004a17d6 in PyObject_Repr (v=) at Objects/object.c:485 #1 0x000000000047eef3 in list_repr (v=0x7ffff68e1d08) at Objects/listobject.c:373 [...] (gdb) frame 1 #1 0x000000000047eef3 in list_repr (v=0x7ffff68e1d08) at Objects/listobject.c:373 373 s = PyObject_Repr(v->ob_item[i]); (gdb) p v $2 = (PyListObject *) 0x7ffff68e1d08 (gdb) p i $3 = 19 (gdb) p v->ob_item[18] $12 = (gdb) p v->ob_item[19] $13 = (gdb) p ((PyVarObject*)(v))->ob_size $14 = 19 ---------- messages: 296936 nosy: haypo, pitrou, rhettinger, serhiy.storchaka priority: normal severity: normal status: open title: list_repr not safe against concurrent mutation versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 16:16:57 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 26 Jun 2017 20:16:57 +0000 Subject: [New-bugs-announce] [issue30775] [3.6] test_multiprocessing_forkserver leaks references on Python 3.6 Message-ID: <1498508217.21.0.984521551654.issue30775@psf.upfronthosting.co.za> New submission from STINNER Victor: $ ./python -m test --match=test.test_multiprocessing_forkserver.WithProcessesTestBarrier.test_barrier --match=test.test_multiprocessing_forkserver.WithProcessesTestFinalize.test_finalize -R 3:3 test_multiprocessing_forkserver test_multiprocessing_forkserver leaked [222, 222, 225] memory blocks, sum=669 test_multiprocessing_forkserver failed Total duration: 5 sec Tests result: FAILURE ---------- components: Tests messages: 296942 nosy: haypo priority: normal severity: normal status: open title: [3.6] test_multiprocessing_forkserver leaks references on Python 3.6 type: resource usage versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 17:49:23 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 26 Jun 2017 21:49:23 +0000 Subject: [New-bugs-announce] [issue30776] regrtest: change -R/--huntrleaks rule to decide if a test leaks Message-ID: <1498513763.26.0.144257056209.issue30776@psf.upfronthosting.co.za> New submission from STINNER Victor: Currently, regrtest considers that a test file leaks if at least one run increased or decreased the global reference counter. The problem is that in practice, Python is full of singletons, caches, and other jokes of the garbage collector, etc. To reduce false alarms and focus more on real bugs, I suggest to change the reference difference checker from: def check_rc_deltas(deltas): return any(deltas) to: def check_rc_deltas(deltas): return all(delta>=1 for delta in deltas) It would allow to ignore false positives like: * [3, 0, 0] * [0, 1, 0] * [8, -8, 1] ---------- components: Tests messages: 296950 nosy: haypo priority: normal severity: normal status: open title: regrtest: change -R/--huntrleaks rule to decide if a test leaks versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 17:57:01 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 26 Jun 2017 21:57:01 +0000 Subject: [New-bugs-announce] [issue30777] IDLE: configdialog -- add docstrings and improve comments Message-ID: <1498514221.98.0.774452449719.issue30777@psf.upfronthosting.co.za> New submission from Terry J. Reedy: Spinoff from #30728. Docstrings are a form of comment. Both leave behavior alone and do not require testing, just human review. Add the docstrings from the original version of PR 2307, and any others. Review and fix comments in light of the comments on that PR. ---------- messages: 296955 nosy: csabella, louielu, terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE: configdialog -- add docstrings and improve comments type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 17:58:36 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 26 Jun 2017 21:58:36 +0000 Subject: [New-bugs-announce] [issue30778] test_bsddb3 crash on x86 Windows XP 2.7 Message-ID: <1498514316.81.0.754509003042.issue30778@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/x86%20Windows%20XP%202.7/builds/213/steps/test/logs/stdio Run tests in parallel using 2 child processes ... 0:22:09 [321/404/1] test_bsddb3 crashed -- running: test_io (242 sec) test_bsddb3 still working, be patient... Berkeley DB 4.7.25: (May 15, 2008) Test path prefix: c:\docume~1\db3l\locals~1\temp\z-test_bsddb3-2068 ... 361 tests OK. 1 test failed: test_bsddb3 ... Re-running test 'test_bsddb3' in verbose mode ... testCheckElapsedTime (test.test_bsddb3.TimingCheck) ... ok test01_get_returns_none (bsddb.test.test_get_none.GetReturnsNoneTestCase) ... ok test02_get_raises_exception (bsddb.test.test_get_none.GetReturnsNoneTestCase) ... ok testCheckElapsedTime (test.test_bsddb3.TimingCheck) ... ok test01_join (bsddb.test.test_join.JoinTestCase) ... ok testCheckElapsedTime (test.test_bsddb3.TimingCheck) ... ok test01_simple (bsddb.test.test_lock.LockingTestCase) ... ok test02_threaded (bsddb.test.test_lock.LockingTestCase) ... ok test04_lock_timeout2 (bsddb.test.test_lock.LockingTestCase) ... FAIL testCheckElapsedTime (test.test_bsddb3.TimingCheck) ... ok test01_badpointer (bsddb.test.test_misc.MiscTestCase) ... Berkeley DB 4.7.25: (May 15, 2008) Test path prefix: c:\docume~1\db3l\locals~1\temp\z-test_bsddb3-644 program finished with exit code -1073741819 elapsedTime=2073.500000 ---------- messages: 296956 nosy: haypo priority: normal severity: normal status: open title: test_bsddb3 crash on x86 Windows XP 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 18:34:16 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 26 Jun 2017 22:34:16 +0000 Subject: [New-bugs-announce] [issue30779] IDLE: configdialog -- factor out Changes class Message-ID: <1498516456.91.0.038376204652.issue30779@psf.upfronthosting.co.za> New submission from Terry J. Reedy: configdialog.ConfigDialog mixes together two things: a user interface for changing options and a mechanism for storing proposed changes and applying them to the configuration dictionaries managed by config. The change mechanism is based on a 3-level dict that maps user config file, config file section, and section entry to a new values. Most GUI event handlers insert entries into the dict. Cancel clears the dict. Apply and call a method to apply changes (and then clear them). This issue will factor out the changes structure and all methods that touch it into a new Changes class. ConfigDialog needs to be able to call methods to add changes, clear changes, apply changes, and maybe something else. GUI tests need to be able to query currently stored changes. Tests of Changes, which are part of this issue and should be 'complete', will accept examples changes from the test functions and send changes to either configparser mocks or even the actual configparser structures, but not to disk. A complete test of the GUI (not part of this issue) will simulate user interaction with every widget and then query Changes() to see that the proper changes orders have been recorded. ---------- messages: 296962 nosy: terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE: configdialog -- factor out Changes class type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 18:38:31 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 26 Jun 2017 22:38:31 +0000 Subject: [New-bugs-announce] [issue30780] IDLE: configdialog - add tests for ConfigDialog GUI. Message-ID: <1498516711.25.0.892352273971.issue30780@psf.upfronthosting.co.za> New submission from Terry J. Reedy: A complete test of the GUI will simulate user interaction with every widget and then query Changes() to see that the proper changes orders have been recorded. This issue depends on #30779, factor out Changes class. ---------- messages: 296963 nosy: terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE: configdialog - add tests for ConfigDialog GUI. type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 18:47:15 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 26 Jun 2017 22:47:15 +0000 Subject: [New-bugs-announce] [issue30781] IDLE: configdialog -- switch to ttk widgets. Message-ID: <1498517235.92.0.120194527847.issue30781@psf.upfronthosting.co.za> New submission from Terry J. Reedy: Change imports and see what else needs fixing. #27755 is one specific ttk switch that could be done before, as part of, or after this. This issue depends on #30780 test GUI ---------- assignee: terry.reedy components: IDLE messages: 296964 nosy: terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE: configdialog -- switch to ttk widgets. type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 21:05:22 2017 From: report at bugs.python.org (Andy Balaam) Date: Tue, 27 Jun 2017 01:05:22 +0000 Subject: [New-bugs-announce] [issue30782] Allow limiting the number of concurrent tasks in asyncio.as_completed Message-ID: <1498525522.6.0.617023291854.issue30782@psf.upfronthosting.co.za> New submission from Andy Balaam: asyncio.as_completed allows us to provide lots of coroutines (or Futures) to schedule, and then deal with the results as soon as they are available, in a loop, or a streaming style. I propose to allow as_completed to work on very large numbers of coroutines, provided through a generator (rather than a list). In order to make this practical, we need to limit the number of coroutines that are scheduled simultaneously to a reasonable number. For tasks that open files or sockets, a reasonable number might be 1000 or fewer. For other tasks, a much larger number might be reasonable, but we would still like some limit to prevent us running out of memory. I suggest adding a "limit" argument to as_completed that limits the number of coroutines that it schedules simultaneously. For me, the key advantage of as_completed (in the proposed modified form) is that it enables a streaming style that looks quite like synchronous code, but is efficient in terms of memory usage (as you'd expect from a streaming style): #!/usr/bin/env python3 import asyncio import sys limit = int(sys.argv[1]) async def double(x): await asyncio.sleep(1) return x * 2 async def print_doubles(): coros = (double(x) for x in range(1000000)) for res in asyncio.as_completed(coros, limit=limit): r = await res if r % 100000 == 0: print(r) loop = asyncio.get_event_loop() loop.run_until_complete(print_doubles()) loop.close() Using my prototype implementation, this runs faster and uses much less memory on my machine when you run it with a limit of 100K instead of 1 million concurrent tasks: $ /usr/bin/time --format "Memory usage: %MKB\tTime: %e seconds" ./example 1000000 Memory usage: 2234552KB Time: 97.52 seconds $ /usr/bin/time --format "Memory usage: %MKB\tTime: %e seconds" ./example 100000 Memory usage: 252732KB Time: 94.13 seconds I have been working on an implementation and there is some discussion in my blog posts: http://www.artificialworlds.net/blog/2017/06/12/making-100-million-requests-with-python-aiohttp/ and http://www.artificialworlds.net/blog/2017/06/27/adding-a-concurrency-limit-to-pythons-asyncio-as_completed/ Possibly the most controversial thing about this proposal is the fact that we need to allow passing a generator to as_completed instead of enforcing that it be a list. This is fundamental to allowing the style I outlined above, but it's possible that we can do better than the blanket allowing of all generators that I did. ---------- components: asyncio messages: 296982 nosy: andybalaam, yselivanov priority: normal severity: normal status: open title: Allow limiting the number of concurrent tasks in asyncio.as_completed type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 22:23:04 2017 From: report at bugs.python.org (Ofek Lev) Date: Tue, 27 Jun 2017 02:23:04 +0000 Subject: [New-bugs-announce] [issue30783] Spawned subprocesses don't respect environment Message-ID: <1498530184.51.0.0376373958552.issue30783@psf.upfronthosting.co.za> New submission from Ofek Lev: The following example shows that we are indeed changing PATH, but the subprocess does not acknowledge it in Windows 7 x64. Also note this works in Linux (Ubuntu 16.04). ----- import os import subprocess from contextlib import contextmanager from tempfile import TemporaryDirectory def get_python_path(): return subprocess.check_output( ['python', '-c', 'import sys;print(sys.executable)'] ).decode().strip() @contextmanager def temp_chdir(cwd=None): with TemporaryDirectory() as d: origin = cwd or os.getcwd() os.chdir(d) try: yield d finally: os.chdir(origin) def create_venv(d, pypath=None): command = ['virtualenv', d] if pypath: command.extend(['-p', pypath]) subprocess.call(command) @contextmanager def venv(d): if os.path.exists(os.path.join(d, 'bin')): # no cov venv_exe_dir = os.path.join(d, 'bin') elif os.path.exists(os.path.join(d, 'Scripts')): venv_exe_dir = os.path.join(d, 'Scripts') else: raise OSError('Unable to locate executables directory.') old_path = os.environ['PATH'] os.environ['PATH'] = '{}{}{}'.format(venv_exe_dir, os.pathsep, old_path) yield os.environ['PATH'] = old_path def test_venv(): with temp_chdir() as d: d = os.path.join(d, 'test_env') create_venv(d) global_python = get_python_path() print('PATH', os.environ['PATH'][:140]) with venv(d): print('PATH', os.environ['PATH'][:140]) venv_python = get_python_path() assert global_python != venv_python assert global_python == get_python_path() ---------- components: Windows messages: 296986 nosy: Ofekmeister, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Spawned subprocesses don't respect environment type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 26 23:21:40 2017 From: report at bugs.python.org (Louie Lu) Date: Tue, 27 Jun 2017 03:21:40 +0000 Subject: [New-bugs-announce] [issue30784] IDLE: seperate editor window and text Message-ID: <1498533700.74.0.75769354704.issue30784@psf.upfronthosting.co.za> New submission from Louie Lu: Currently, IDLE EditorWindow was mixed with the GUI skeleton and text area, and the other plugin such as hyperparser was operate on editwin. Such a design let IDLE is difficult to changed its GUI design, from new window to new tab style. If we seperate EditorWindow and the text zone, it will make more easy to port to ttk.Notebook. How do you think about this, terry? ---------- assignee: terry.reedy components: IDLE messages: 296992 nosy: louielu, terry.reedy priority: normal severity: normal status: open title: IDLE: seperate editor window and text versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 27 04:01:37 2017 From: report at bugs.python.org (Christopher Aycock) Date: Tue, 27 Jun 2017 08:01:37 +0000 Subject: [New-bugs-announce] [issue30785] ast.c duplicates STR(CHILD) Message-ID: <1498550497.04.0.537095530939.issue30785@psf.upfronthosting.co.za> New submission from Christopher Aycock: The function alias_for_import_name() duplicates logic starting at Python/ast.c:3237 char *sch = STR(CHILD(n, i)); strcpy(s, STR(CHILD(n, i))); s += strlen(sch); *s++ = '.'; I assume the strcpy() is supposed to use the sch value from the line above. There shouldn't be any consequence to the code as it currently is; I just noticed it while reading through the source. ---------- components: Interpreter Core messages: 297018 nosy: Christopher Aycock priority: normal severity: normal status: open title: ast.c duplicates STR(CHILD) type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 27 06:40:08 2017 From: report at bugs.python.org (Radek Smejkal) Date: Tue, 27 Jun 2017 10:40:08 +0000 Subject: [New-bugs-announce] [issue30786] getaddrinfo emulation does not support AI_NUMERICSERV Message-ID: <1498560008.54.0.948539783321.issue30786@psf.upfronthosting.co.za> New submission from Radek Smejkal: Modules/getaddrinfo.c should support AI_NUMERICSERV. Moreover, not supporting AI_NUMERICSERV may cause troubles on platforms where the getaddrinfo function is available but it's buggy (see configure.ac and Modules/socketmodule.c), because Modules/addrinfo.h does not #undef AI_NUMERICSERV and Modules/socketmodule.c exports AI_NUMERICSERV defined in a system header that may collide with another flag defined in Modules/addrinfo.h and confuse the user. ./configure --with-pydebug Comment out HAVE_GETADDRINFO in pyconfig.h Comment out ENABLE_IPV6 in pyconfig.h on platforms where getipnodebyname and friends are not available make -j ./python Python 3.7.0a0 (default, Jun 27 2017, 11:59:50) [GCC 4.7.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> socket.AI_NUMERICSERV >>> socket.getaddrinfo(None, "http", flags=socket.AI_NUMERICSERV) Traceback (most recent call last): File "", line 1, in File "/home/radek/src/github/cpython/Lib/socket.py", line 743, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 3] invalid value for ai_flags. >>> ---------- components: Extension Modules messages: 297020 nosy: smejkar priority: normal severity: normal status: open title: getaddrinfo emulation does not support AI_NUMERICSERV type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 27 10:23:18 2017 From: report at bugs.python.org (tom kronmiller) Date: Tue, 27 Jun 2017 14:23:18 +0000 Subject: [New-bugs-announce] [issue30787] Please add a comprehensive index of decorators to the documentation. Message-ID: <1498573398.64.0.663772847899.issue30787@psf.upfronthosting.co.za> New submission from tom kronmiller: It is difficult to learn what decorators there are because there is no single index which lists all of them (at least, I have been unable to find one). Instead, one must stumble across them while reading library module documentation. An index listing the decorators with a short description would be really helpful (to me, at least). Thanks. ---------- assignee: docs at python components: Documentation messages: 297039 nosy: docs at python, tom kronmiller priority: normal severity: normal status: open title: Please add a comprehensive index of decorators to the documentation. type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 27 15:58:41 2017 From: report at bugs.python.org (Joel Hillacre) Date: Tue, 27 Jun 2017 19:58:41 +0000 Subject: [New-bugs-announce] [issue30788] email.policy.SMTP.fold() issue with long filenames with spaces Message-ID: <1498593521.18.0.236128551176.issue30788@psf.upfronthosting.co.za> New submission from Joel Hillacre: Found an issue in email.policy.SMTP.fold on "Content-Disposition" headers for long filenames with spaces. Managed to simply the issue to a test case as follows: >>> from email.policy import SMTP; SMTP.fold('Content-Disposition', 'attachment; filename="{}"'.format('1234 67890' + '1234567890' * 6)) Below are the tracebacks various python versions produces for this code. I think that the difference between python 3.5 - 3.6 and 3.7 are related to the fix in bpo-30532. Python 3.6.1 (default, Apr 7 2017, 09:32:32) & Python 3.5.3 (default, Jan 17 2017, 14:34:36) Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.6/email/policy.py", line 183, in fold return self._fold(name, value, refold_binary=True) File "/usr/lib64/python3.6/email/policy.py", line 213, in _fold return self.header_factory(name, ''.join(lines)).fold(policy=self) File "/usr/lib64/python3.6/email/headerregistry.py", line 255, in fold return header.fold(policy=policy) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 300, in fold self._fold(folded) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 1228, in _fold rest._fold(folded) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 347, in _fold if folded.append_if_fits(part): File "/usr/lib64/python3.6/email/_header_value_parser.py", line 149, in append_if_fits token._fold(self) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 338, in _fold if folded.append_if_fits(part, tstr): ... last 4 lines repeated 482 more times ... File "/usr/lib64/python3.6/email/_header_value_parser.py", line 149, in append_if_fits token._fold(self) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 325, in _fold tstr = str(part) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 196, in __str__ return ''.join(str(x) for x in self) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 196, in return ''.join(str(x) for x in self) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 196, in __str__ return ''.join(str(x) for x in self) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 196, in return ''.join(str(x) for x in self) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 196, in __str__ return ''.join(str(x) for x in self) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 196, in return ''.join(str(x) for x in self) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 633, in __str__ return quote_string(''.join(str(x) for x in self)) File "/usr/lib64/python3.6/email/_header_value_parser.py", line 633, in return quote_string(''.join(str(x) for x in self)) RecursionError: maximum recursion depth exceeded while getting the str of an object Python 3.7.0a0 (heads/master:e613e6add5, Jun 27 2017, 12:17:18) Traceback (most recent call last): File "", line 1, in File "/home/joel/PycharmProjects/cpython/Lib/email/policy.py", line 183, in fold return self._fold(name, value, refold_binary=True) File "/home/joel/PycharmProjects/cpython/Lib/email/policy.py", line 213, in _fold return self.header_factory(name, ''.join(lines)).fold(policy=self) File "/home/joel/PycharmProjects/cpython/Lib/email/headerregistry.py", line 255, in fold return header.fold(policy=policy) File "/home/joel/PycharmProjects/cpython/Lib/email/_header_value_parser.py", line 300, in fold self._fold(folded) File "/home/joel/PycharmProjects/cpython/Lib/email/_header_value_parser.py", line 1226, in _fold rest._fold(folded) File "/home/joel/PycharmProjects/cpython/Lib/email/_header_value_parser.py", line 345, in _fold if folded.append_if_fits(part): File "/home/joel/PycharmProjects/cpython/Lib/email/_header_value_parser.py", line 145, in append_if_fits ws = token.pop_leading_fws() File "/home/joel/PycharmProjects/cpython/Lib/email/_header_value_parser.py", line 272, in pop_leading_fws return self[0].pop_leading_fws() File "/home/joel/PycharmProjects/cpython/Lib/email/_header_value_parser.py", line 272, in pop_leading_fws return self[0].pop_leading_fws() File "/home/joel/PycharmProjects/cpython/Lib/email/_header_value_parser.py", line 270, in pop_leading_fws if self[0].token_type == 'fws': IndexError: list index out of range Note that the following example without a space does not cause a traceback: Python 3.7.0a0 (heads/master:e613e6add5, Jun 27 2017, 12:17:18) >>> from email.policy import SMTP; SMTP.fold('Content-Disposition', 'attachment; filename="{}"'.format('1234567890' + '1234567890' * 6)) 'Content-Disposition: attachment;\r\n filename="1234567890123456789012345678901234567890123456789012345678901234567890"\r\n' ---------- components: email messages: 297072 nosy: barry, jhillacre, r.david.murray priority: normal severity: normal status: open title: email.policy.SMTP.fold() issue with long filenames with spaces versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 27 20:10:41 2017 From: report at bugs.python.org (STINNER Victor) Date: Wed, 28 Jun 2017 00:10:41 +0000 Subject: [New-bugs-announce] [issue30789] Redesign PyCodeObject.co_extras to use a single memory block, instead of two Message-ID: <1498608641.09.0.230211440925.issue30789@psf.upfronthosting.co.za> New submission from STINNER Victor: Currently, _PyCode_SetExtra() uses two memory block for code extras. Using a different structure, it would be possible to use a single memory block: less memory fragmentation, better CPU cache usage, less indirections, etc. It matters since the long term plan for co_extras is to implement of kind-of JIT compiler insider CPython: see bpo-28158. ---------- components: Interpreter Core messages: 297077 nosy: haypo priority: normal severity: normal status: open title: Redesign PyCodeObject.co_extras to use a single memory block, instead of two type: performance versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 28 05:21:41 2017 From: report at bugs.python.org (Wu Zongyong) Date: Wed, 28 Jun 2017 09:21:41 +0000 Subject: [New-bugs-announce] [issue30790] Can't use proxy to connect internet on windows Message-ID: <1498641701.55.0.210548070467.issue30790@psf.upfronthosting.co.za> Changes by Wu Zongyong : ---------- components: Library (Lib) nosy: Cordius priority: normal severity: normal status: open title: Can't use proxy to connect internet on windows type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 28 11:18:18 2017 From: report at bugs.python.org (=?utf-8?b?SMOla29uIEjDpmdsYW5k?=) Date: Wed, 28 Jun 2017 15:18:18 +0000 Subject: [New-bugs-announce] [issue30791] tkinter.Tk() adds suffix to window class name when launching multiple instances Message-ID: <1498663098.01.0.2360806195.issue30791@psf.upfronthosting.co.za> New submission from H?kon H?gland: Hello. In order to group several instances of a given application under one icon in the desktop launcher (I am using Ubuntu 17.04) they must have the same appName property of the WM_CLASS string. For example, if I run emacs twice: ?$ emacs & $ emacs & Both instances will show up under the Emacs icon in the desktop launchbar. The reason is that both instances have the same WM_CLASS string. We can check this string using ?$ xprop WM_CLASS and then click on the Emacs window. It then shows: ?WM_CLASS(STRING) = "emacs", "Emacs" Here "emacs" is the resource (appName), and "Emacs" is the className. Now, consider this program (my-tkapp.py): #! /usr/bin/env python import tkinter as tk root = tk.Tk(className='myTkApp') label = tk.Label(root, text="Hello World") label.pack() root.mainloop() If I run this program twice: ?$ my-tkapp.py & $ my-tkapp.py & and then run xprop to check the WM_CLASS property of both windows, the first window gives: ?WM_CLASS(STRING) = "myTkApp", "Mytkapp" whereas the second gives: ?WM_CLASS(STRING) = "myTkApp #2", "Mytkapp" Note that tkinter has added a #2 suffix to the app name property. This is not desired. It makes the window manager group the two windows under separate icons in the desktop launch bar. How can I keep the same appName property of the WM_CLASS string for different instances of my application? Note: This question was first asked at stackoverflow.com: https://stackoverflow.com/q/44795622/2173773 I tried to follow the source from the call: root = tkinter.Tk(className='myTkApp') but at 5 levels down on the stack I ended up inside TCL code, and I was not able to determine who was responsible for adding the "#2" suffix. However, a similar perl script gives the same behavior, so I suspect the problem is within the TCL TK code. Is there a way to change the WM_CLASS property of the window after the call to tkinter.Tk, but before entering mainloop() in order to work around the issue? After entering the mainloop(), I guess it is too late to do anything, since then the icon is already displayed in the window manager's launch bar. I am using Ubuntu 17.04 and Python version 3.6.1. Best regards, H?kon H?gland ---------- components: Tkinter messages: 297191 nosy: hakonhagland priority: normal severity: normal status: open title: tkinter.Tk() adds suffix to window class name when launching multiple instances type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 28 11:48:31 2017 From: report at bugs.python.org (Steven D'Aprano) Date: Wed, 28 Jun 2017 15:48:31 +0000 Subject: [New-bugs-announce] [issue30792] Add contextlib.convert_exception manager Message-ID: <1498664911.2.0.271174194344.issue30792@psf.upfronthosting.co.za> New submission from Steven D'Aprano: As discussed on Python-Ideas, there's some interest in a context manager that can convert an exception from one type to another (similarly to the way PEP 479 has StopIteration converted to RuntimeError. See the thread starting here: https://mail.python.org/pipermail/python-ideas/2017-June/046109.html and particularly Nick's comment here: https://mail.python.org/pipermail/python-ideas/2017-June/046218.html I've written a recipe on ActiveState: https://code.activestate.com/recipes/580808-guard-against-an-exception-in-the-wrong-place/ which acts as both a context manager and function decorator. That can be used as proof-of-concept or as a basis for a PR. ---------- components: Library (Lib) messages: 297193 nosy: ncoghlan, steven.daprano priority: normal severity: normal status: open title: Add contextlib.convert_exception manager type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 28 14:58:13 2017 From: report at bugs.python.org (Anselm Kiefner) Date: Wed, 28 Jun 2017 18:58:13 +0000 Subject: [New-bugs-announce] [issue30793] Parsing error on f-string-expressions containing strings with backslash Message-ID: <1498676293.91.0.9735369648.issue30793@psf.upfronthosting.co.za> New submission from Anselm Kiefner: Considering that x = 3 f"{'hello' if x == 3 else 'goodbye'} world" is a simple, elegant and powerful piece of code that works just as expected by itself, I often find myself stumbling and wondering why f"text {'\n' if x == 3 else ''} text" fails horribly just because of the \ within the extra quoted string that must be worked around with ugly code like nl = "\n" f"text {nl if x==3 else ''} text" which really doesn't feel like python at all. I am aware that the specification for f-strings says "no \ in expressions", but please consider that in this case, the \ is not really part of the expression but rather part of a string that isn't evaluated as part of the expression, which might just as well be referenced to by a variable. ---------- messages: 297206 nosy: Anselm Kiefner priority: normal severity: normal status: open title: Parsing error on f-string-expressions containing strings with backslash type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 28 16:03:41 2017 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 28 Jun 2017 20:03:41 +0000 Subject: [New-bugs-announce] [issue30794] Add multiprocessing.Process.kill() Message-ID: <1498680221.55.0.739149893408.issue30794@psf.upfronthosting.co.za> New submission from Antoine Pitrou: subprocess.Popen() has both terminate() and kill() methods. Under Unix, the first sends SIGTERM and the second SIGKILL. multiprocessing.Process() only has terminate(), which sends SIGTERM. It may be useful to add a kill() method to send SIGKILL (on Windows, kill() would be the same as terminate()). One possible use case is when the child process has redefined the SIGTERM handler to something that doesn't trigger an exit (or takes a long time to exit). Or if something non-interruptible is running... ---------- components: Library (Lib) messages: 297216 nosy: davin, pitrou priority: normal severity: normal stage: needs patch status: open title: Add multiprocessing.Process.kill() type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 28 16:05:38 2017 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 28 Jun 2017 20:05:38 +0000 Subject: [New-bugs-announce] [issue30795] OS X failures in test_site Message-ID: <1498680338.75.0.476997562196.issue30795@psf.upfronthosting.co.za> New submission from Antoine Pitrou: It seems there is a sporadic failure on OS X (oops, sorry, I mean "macOS"): https://travis-ci.org/python/cpython/jobs/248079407#L3403 ====================================================================== FAIL: test_getsitepackages (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/travis/build/python/cpython/Lib/test/test_site.py", line 266, in test_getsitepackages self.assertEqual(len(dirs), 2) AssertionError: 1 != 2 ---------------------------------------------------------------------- ---------- components: macOS messages: 297217 nosy: haypo, ned.deily, pitrou, ronaldoussoren priority: normal severity: normal status: open title: OS X failures in test_site type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 28 18:23:54 2017 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 28 Jun 2017 22:23:54 +0000 Subject: [New-bugs-announce] [issue30796] Failures/crashes in test_signal on some buildbots Message-ID: <1498688634.58.0.502091331703.issue30796@psf.upfronthosting.co.za> New submission from Antoine Pitrou: The test added for issue #30703 crashes on some Unix buildbots (FreeBSD 9.x, OS X Tiger, AIX). Example here: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.x%203.x/builds/275/steps/test/logs/stdio As noted in the PR for that issue, some systems may have low resolution for setitimer(). For example, the FreeBSD man page says: > Time values smaller than the resolution of the system clock are rounded up to this resolution (typically 10 milliseconds). ---------- components: Tests messages: 297237 nosy: haypo, pitrou priority: normal severity: normal stage: needs patch status: open title: Failures/crashes in test_signal on some buildbots type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 28 18:24:05 2017 From: report at bugs.python.org (Segev Finer) Date: Wed, 28 Jun 2017 22:24:05 +0000 Subject: [New-bugs-announce] [issue30797] ./pyconfig.h:1438:0: warning: "_GNU_SOURCE" redefined [enabled by default] Message-ID: <1498688645.93.0.221276689872.issue30797@psf.upfronthosting.co.za> New submission from Segev Finer: This is caused by _GNU_SOURCE being defined here: https://github.com/python/cpython/blob/c08177a1ccad2ed0d50898c2731b518c631aed14/configure.ac#L124, But also getting defined by AC_USE_SYSTEM_EXTENSIONS (https://github.com/python/cpython/blob/c08177a1ccad2ed0d50898c2731b518c631aed14/configure.ac#L906). AC_USE_SYSTEM_EXTENSIONS does use an #ifndef but Python's AC_DEFINE seems to be getting order after it. ---------- components: Build messages: 297238 nosy: Segev Finer priority: normal severity: normal status: open title: ./pyconfig.h:1438:0: warning: "_GNU_SOURCE" redefined [enabled by default] type: compile error versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 28 22:32:34 2017 From: report at bugs.python.org (James Lin) Date: Thu, 29 Jun 2017 02:32:34 +0000 Subject: [New-bugs-announce] [issue30798] Document that subprocess.Popen does not set PWD Message-ID: <1498703554.38.0.302571639781.issue30798@psf.upfronthosting.co.za> New submission from James Lin: Even though http://bugs.python.org/issue4057 was rejected (which I think is fair), I think it would be worth mentioning something about PWD in the Python docs for subprocess.Popen's cwd parameter (and possibly for os.chdir): 1. It's pretty common for people to use Python to execute other things. 2. I don't think it's that uncommon to come across binaries/scripts that directly read PWD instead of calling getcwd() or equivalent. 3. For people who encounter this problem for the first time, it can be really puzzling. My suggestion would be to add something like: Note: Some programs might expect that the current directory is specified in a PWD environment variable. Callers should explicitly set it themselves when invoking such programs. or even just: Note: Callers are responsible for setting a PWD environment variable if necessary. ---------- assignee: docs at python components: Documentation messages: 297244 nosy: docs at python, jamesdlin priority: normal severity: normal status: open title: Document that subprocess.Popen does not set PWD type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 01:28:50 2017 From: report at bugs.python.org (chexex) Date: Thu, 29 Jun 2017 05:28:50 +0000 Subject: [New-bugs-announce] [issue30799] Improved test coverage Lib/_osx_support.py 99% Message-ID: <1498714130.01.0.630088547438.issue30799@psf.upfronthosting.co.za> Changes by chexex : ---------- components: Tests nosy: chexex priority: normal severity: normal status: open title: Improved test coverage Lib/_osx_support.py 99% versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 01:56:39 2017 From: report at bugs.python.org (dennis) Date: Thu, 29 Jun 2017 05:56:39 +0000 Subject: [New-bugs-announce] [issue30800] zlib.compressobj took too much memory on window Message-ID: <1498715799.11.0.0910878994528.issue30800@psf.upfronthosting.co.za> New submission from dennis: I'm working on a MMORPG Game server, and using the 32bit window Python(Python2.7.9 and Python3.6.0). And i create a zlib.compressobj for every connection. when the connection reach about 7500, the program raise an MemoryError exception. The Program only took me 700MB in memory, But the committed memory is about 2GB. Here is my test result and test code: -----------test result------------------ 7613 compressobj created! ('memory info:', pmem(rss=736342016, vms=2057256960, num_page_faults=179812, pea k_wset=736342016, wset=736342016, peak_paged_pool=130760, paged_pool=130584, pea k_nonpaged_pool=28344, nonpaged_pool=28344, pagefile=2057256960, peak_pagefile=2 057256960, private=2057256960)) --------------test code ---------------- # -*- encoding:utf-8 -*- import os import psutil import zlib def test(): result = [] for i in range(10000): try: result.append(zlib.compressobj()) except: print('%d compressobj created!'%(i)) pid = os.getpid() p = psutil.Process(pid) print('memory info:', p.memory_info()) break if __name__ == '__main__': test() ---------- components: Windows messages: 297257 nosy: dennisding, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: zlib.compressobj took too much memory on window type: resource usage versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 03:56:43 2017 From: report at bugs.python.org (alberfontan1) Date: Thu, 29 Jun 2017 07:56:43 +0000 Subject: [New-bugs-announce] [issue30801] shoutdown process error with python 3.4 and pyqt/PySide Message-ID: <1498723003.06.0.480156754664.issue30801@psf.upfronthosting.co.za> New submission from alberfontan1: For a package applicaction with pyqt/PySide, Python 3.4 on Windows, appers a window fatal error when shoutdown process manager of multiprocessing ---------- components: Library (Lib) messages: 297261 nosy: alberfontan1 priority: normal severity: normal status: open title: shoutdown process error with python 3.4 and pyqt/PySide type: crash versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 04:58:08 2017 From: report at bugs.python.org (winton Wang) Date: Thu, 29 Jun 2017 08:58:08 +0000 Subject: [New-bugs-announce] [issue30802] datetime.datetime.strptime('200722', '%Y%U') Message-ID: <1498726688.6.0.920894490968.issue30802@psf.upfronthosting.co.za> New submission from winton Wang: datetime stiptime error according to "%U" format. Python version: 3.4.3, 2.7.13 ,3.6.0, 3.5.2 from datetime import datetime input: datetime.strptime('201726', '%Y%U') output: datetime.datetime(2007, 1, 1, 0, 0) ---------- components: Library (Lib) messages: 297265 nosy: winton priority: normal severity: normal status: open title: datetime.datetime.strptime('200722', '%Y%U') type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 09:36:18 2017 From: report at bugs.python.org (Peter Thomassen) Date: Thu, 29 Jun 2017 13:36:18 +0000 Subject: [New-bugs-announce] [issue30803] Truth value of sets not properly documented Message-ID: <1498743378.1.0.0570911503542.issue30803@psf.upfronthosting.co.za> New submission from Peter Thomassen: The truth value of sets is not properly documented, in particular regarding whether an empty set is considered false or not. Ignoring primitive (such as numerals) as well as user-defined types, https://docs.python.org/3/library/stdtypes.html#truth says: > The following values are considered false: > > - [...] > - any empty sequence, for example, '', (), []. > - any empty mapping, for example, {}. > - [...] > > All other values are considered true According to https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range, a set is not a sequence (it is unordered, its elements do not have indices, etc.): > There are three basic sequence types: lists, tuples, and range objects. And, according to https://docs.python.org/3/library/stdtypes.html#mapping-types-dict, > There is currently only one standard mapping type, the dictionary. So, as per the documentation, the set type is not a type that can ever be False. However, when I try, bool(set()) evaluates to False. When I asked this on Stack Overflow, someone checked in the CPython code and judged that this is most likely a mere documentation issue: https://stackoverflow.com/a/44813565/6867099 ---------- assignee: docs at python components: Documentation messages: 297268 nosy: docs at python, thomassen priority: normal severity: normal status: open title: Truth value of sets not properly documented type: enhancement versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 11:30:53 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 29 Jun 2017 15:30:53 +0000 Subject: [New-bugs-announce] [issue30804] bolen-dmg-3.x build-installer.py failed Message-ID: <1498750253.94.0.363268872371.issue30804@psf.upfronthosting.co.za> New submission from STINNER Victor: It may be related to bpo-29585, see commits: - a8f8d5b4bd30dbe0828550469d98f12d2ebb2ef4 - b01c574ad6d796025152b5d605eceb7816e6f7a7 - 6b42eb17649bed9615b6e6cecaefdb2f46990b2c http://buildbot.python.org/all/builders/bolen-dmg-3.x/builds/209/steps/compile/logs/stdio ... gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -L/Users/db3l/buildarea.dmg/bolen-dmg-3.x/build/dmg/libraries/usr/local/lib -Wl,-stack_size,1000000 -framework CoreFoundation Python.framework/Versions/3.7/Python -o python.exe Programs/python.o -ldl -framework CoreFoundation DYLD_FRAMEWORK_PATH=/Users/db3l/buildarea.dmg/bolen-dmg-3.x/build/dmg/_bld/python ./python.exe -E -S -m sysconfig --generate-posix-vars ;\ if test $? -ne 0 ; then \ echo "generate-posix-vars failed" ; \ rm -f ./pybuilddir.txt ; \ exit 1 ; \ fi gcc-4.0 -c -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -I/Users/db3l/buildarea.dmg/bolen-dmg-3.x/build/dmg/libraries/usr/local/include -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -IObjects -IInclude -IPython -I. -I/Users/db3l/buildarea.dmg/bolen-dmg-3.x/build/Include -isysroot /Developer/SDKs/MacOSX10.4u.sdk -DPy_BUILD_CORE -o Modules/_math.o /Users/db3l/buildarea.dmg/bolen-dmg-3.x/build/Modules/_math.c File "/Users/db3l/buildarea.dmg/bolen-dmg-3.x/build/Mac/BuildScript/build-installer.py", line 1643, in main() File "/Users/db3l/buildarea.dmg/bolen-dmg-3.x/build/Mac/BuildScript/build-installer.py", line 1596, in main buildPython() File "/Users/db3l/buildarea.dmg/bolen-dmg-3.x/build/Mac/BuildScript/build-installer.py", line 1146, in buildPython runCommand("make") File "/Users/db3l/buildarea.dmg/bolen-dmg-3.x/build/Mac/BuildScript/build-installer.py", line 531, in runCommand raise RuntimeError("command failed: %s"%(commandline,)) RuntimeError: command failed: make program finished with exit code 1 elapsedTime=1419.113943 ---------- components: macOS messages: 297277 nosy: haypo, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: bolen-dmg-3.x build-installer.py failed versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 13:40:25 2017 From: report at bugs.python.org (William Grzybowski) Date: Thu, 29 Jun 2017 17:40:25 +0000 Subject: [New-bugs-announce] [issue30805] asyncio: race condition with debug and subprocess Message-ID: <1498758025.07.0.201255065023.issue30805@psf.upfronthosting.co.za> New submission from William Grzybowski: If a process is schedule to run in the event loop with debug disabled and debug is then enabled before the process finishes it will result in a traceback: debug_log undefined. [2017/06/29 14:39:13] (ERROR) asyncio.default_exception_handler():1261 - Ta sk exception was never retrieved future: exception=UnboundLocal Error("local variable 'debug_log' referenced before assignment",)> Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/vm.py", line 503, in kmod_load kldstat = (await (await Popen(['/sbin/kldstat'], stdout=subprocess.PIPE )).communicate())[0].decode() File "/usr/local/lib/python3.6/asyncio/subprocess.py", line 225, in creat e_subprocess_exec stderr=stderr, **kwds) File "/usr/local/lib/python3.6/asyncio/base_events.py", line 1194, in sub process_exec logger.info('%s: %r', debug_log, transport) ---------- components: asyncio messages: 297289 nosy: wg, yselivanov priority: normal pull_requests: 2549 severity: normal status: open title: asyncio: race condition with debug and subprocess versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 15:12:21 2017 From: report at bugs.python.org (James) Date: Thu, 29 Jun 2017 19:12:21 +0000 Subject: [New-bugs-announce] [issue30806] netrc.__repr__() is broken for writing to file Message-ID: <1498763541.77.0.380552653426.issue30806@psf.upfronthosting.co.za> New submission from James: Have any valid .netrc file. For testing purposes you can use this: machine abc.xyz login myusername password mypassword The documentation for netrc.__repr__() states that it "dumps the class data as a string in the format of a netrc file". However, when you try to actually do this, you'll encounter a nasty bug. This can be seen by running the follow commands: auth = netrc.netrc(os.path.expanduser(r"~\.netrc")) print(auth.__repr__()) The expected output is: machine abc.xyz login myusername password mypassword The actual output is: machine abc.xyz login 'myusername' password 'mypassword' If you write this back out to the .netrc file, authentication will fail since incorrect username/password (with ' character at beginning at end) will be passed. ---------- components: Library (Lib) messages: 297296 nosy: Bezier89 priority: normal pull_requests: 2550 severity: normal status: open title: netrc.__repr__() is broken for writing to file type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 15:49:10 2017 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 29 Jun 2017 19:49:10 +0000 Subject: [New-bugs-announce] [issue30807] setitimer() can disable timer by mistake Message-ID: <1498765750.02.0.334201584192.issue30807@psf.upfronthosting.co.za> New submission from Antoine Pitrou: The C setitimer() function supports intervals with microsecond resolution. However, Python's setitimer() takes a float and then converts it to a C `struct timeval`, which can round down to zero. The consequence is that the timer is disabled (timeval == {0,0}) while the user asked for a one microsecond timeout. ---------- components: Library (Lib) messages: 297300 nosy: pitrou priority: normal severity: normal stage: needs patch status: open title: setitimer() can disable timer by mistake type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 16:01:06 2017 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 29 Jun 2017 20:01:06 +0000 Subject: [New-bugs-announce] [issue30808] Use _Py_atomic API for concurrency-sensitive signal state Message-ID: <1498766466.5.0.206048898577.issue30808@psf.upfronthosting.co.za> New submission from Antoine Pitrou: We already use the _Py_atomic APIs in ceval.c, for lockless boolean flags. We should do the same in the signal module where there are similar concurrency issues (for example between the signal handler running in one thread and PyErr_CheckSignals running in another thread). ---------- components: Interpreter Core messages: 297304 nosy: haypo, jyasskin, neologix, pitrou priority: normal severity: normal stage: patch review status: open title: Use _Py_atomic API for concurrency-sensitive signal state type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 29 16:36:07 2017 From: report at bugs.python.org (Charles Wohlganger) Date: Thu, 29 Jun 2017 20:36:07 +0000 Subject: [New-bugs-announce] [issue30809] IDLE parenmatch - highlighting options Message-ID: <1498768567.92.0.13204753323.issue30809@psf.upfronthosting.co.za> New submission from Charles Wohlganger: Current IDLE parenmatch highlighting uses the 'hilite' style when highlighting the parens/expression. Desired behavior is to use a user-setting based style that is independent from the hilite style (which is used for highlighting selected text). Desired selectable options are for foreground color, background color, underlining and font (which covers font type, size, bold, and italics) Apart from running IDLE and checking that the selections match, I don't know how to test. Testing would need a human to check for correct colors, etc. if it was made, so it couldn't be automated... ---------- assignee: terry.reedy components: IDLE messages: 297317 nosy: terry.reedy, wohlganger priority: normal severity: normal status: open title: IDLE parenmatch - highlighting options type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 03:58:55 2017 From: report at bugs.python.org (Tarek Saier) Date: Fri, 30 Jun 2017 07:58:55 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue30810=5D_Germany_made_the_?= =?utf-8?b?dXBwZXIgY2FzZSDDnyBvZmZpY2lhbC4gJ8OfJy51cHBlcigpIHNob3VsZCBu?= =?utf-8?b?b3cgcmV0dXJuIOG6ni4=?= Message-ID: <1498809535.65.0.688686047851.issue30810@psf.upfronthosting.co.za> New submission from Tarek Saier: I'm not sure if Python just relies on some other resource for this (i.e. a C function), but as of yesterday the correct upper case of ? is ?: Official announcement in German: http://www.rechtschreibrat.com/DOX/rfdr_PM_2017-06-29_Aktualisierung_Regelwerk.pdf ---------- messages: 297351 nosy: Tarek Saier priority: normal severity: normal status: open title: Germany made the upper case ? official. '?'.upper() should now return ?. _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 05:02:48 2017 From: report at bugs.python.org (Antony Lee) Date: Fri, 30 Jun 2017 09:02:48 +0000 Subject: [New-bugs-announce] [issue30811] A venv created and activated from within a virtualenv uses the outer virtualenv's site-packages rather than its own. Message-ID: <1498813368.34.0.349011380575.issue30811@psf.upfronthosting.co.za> New submission from Antony Lee: Python 3.6.1, virtualenv 15.1.0 (Arch Linux, distro packages) ``` export PIP_CONFIG_FILE=/dev/null # just to be sure # python -mvirtualenv outer-env # using /usr/bin/python(3) python2 -mvirtualenv outer-env # using /usr/bin/python(3) source outer-env/bin/activate python -mvenv inner-env # using outer-env's python source inner-env/bin/activate python -minspect -d pip ``` The last step outputs ``` Target: pip Origin: /tmp/inner-env/lib/python3.6/site-packages/pip/__init__.py Cached: /tmp/inner-env/lib/python3.6/site-packages/pip/__pycache__/__init__.cpython-36.pyc Loader: <_frozen_importlib_external.SourceFileLoader object at 0x7f27c019c710> Submodule search path: ['/tmp/inner-env/lib/python3.6/site-packages/pip'] ``` i.e., the outer environment's pip leaks into the inner environment; the inner environment does not have its own pip installed. Trying to use that pip from the inner environment (from inner-env, `python -mpip install ...`) results in the package being installed in the outer environment rather than the inner one. Now this may all seem very academic, but for example Travis uses virtualenvs as toplevel containers for their Python projects, so this bug makes it difficult to test, say, projects that set up venvs as part of their workflow. ---------- components: Library (Lib) messages: 297365 nosy: Antony.Lee priority: normal severity: normal status: open title: A venv created and activated from within a virtualenv uses the outer virtualenv's site-packages rather than its own. versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 05:43:34 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 30 Jun 2017 09:43:34 +0000 Subject: [New-bugs-announce] [issue30812] Running test_warnings twice fails Message-ID: <1498815814.09.0.930459011173.issue30812@psf.upfronthosting.co.za> New submission from STINNER Victor: Example on Python 3.6: haypo at selma$ ./python -m test test_warnings test_warnings Run tests sequentially 0:00:00 load avg: 1.74 [1/2] test_warnings 0:00:01 load avg: 1.68 [2/2] test_warnings /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:902: UserWarning: foo wmod.warn("foo") /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:1000: UserWarning: foo wmod.warn("foo") /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:964: UserWarning: This is a warning wmod.warn(text) /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:986: UserWarning: This is a warning wmod.warn(text) /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:148: UserWarning: FilterTests.test_always self.module.warn(message, UserWarning) /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:159: UserWarning: FilterTests.test_always_after_ignore self.module.warn(message, UserWarning) /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:180: UserWarning: FilterTests.test_default self.module.warn(message, UserWarning) /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:249: UserWarning: handle normally self.module.warn(text) /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:135: UserWarning: FilterTests.test_ignore_after_default self.module.warn(message, UserWarning) /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:195: UserWarning: FilterTests.test_module self.module.warn(message, UserWarning) f.py:42: UserWarning: b __init__.py:42: UserWarning: FilterTests.test_once /home/haypo/prog/python/3.6/Lib/test/test_warnings/data/stacklevel.py:9: UserWarning: spam1 warnings.warn(message, stacklevel=stacklevel) /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:354: UserWarning: multi 0 self.module.warn(text) /home/haypo/prog/python/3.6/Lib/test/__main__.py:9: UserWarning: spam9 __main__:9: UserWarning: spam11 __main__:9: UserWarning: spam10 test.test_warnings.data.stacklevel:9: UserWarning: spam8 /home/haypo/prog/python/3.6/Lib/test/test_warnings/data/stacklevel.py:9: UserWarning: spam3 warnings.warn(message, stacklevel=stacklevel) /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:415: DeprecationWarning: module-level warning import test.test_warnings.data.import_warning nonascii??:1: UserWarning: text /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:365: UserWarning: self.module.warn(ob) /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:561: MyWarningClass: good warning category self.module.warn('good warning category', MyWarningClass) :42: UserWarning: defaultaction test test.test_warnings:778: UserWarning: test file:42: UserWarning: onceregistry test /home/haypo/prog/python/3.6/Lib/test/test_warnings/__init__.py:741: UserWarning: Warning! self.module.warn('Warning!') /home/haypo/prog/python/3.6/Lib/unittest/case.py:178: UserWarning: Warning! callable_obj(*args, **kwargs) test test_warnings failed -- multiple errors occurred; run in verbose mode for details test_warnings failed 1 test OK. 1 test failed: test_warnings Total duration: 3 sec Tests result: FAILURE ---------- messages: 297368 nosy: haypo priority: normal severity: normal status: open title: Running test_warnings twice fails versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 05:50:28 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 30 Jun 2017 09:50:28 +0000 Subject: [New-bugs-announce] [issue30813] test_unittest fails when hunting reference leaks Message-ID: <1498816228.35.0.729692699149.issue30813@psf.upfronthosting.co.za> New submission from STINNER Victor: Example of Python 3.5 (same error on master): haypo at selma$ ./python -m test -R 3:3 -v test_unittest (...) ====================================================================== ERROR: test_discover_with_init_module_that_raises_SkipTest_on_import (unittest.test.test_discovery.TestDiscovery) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/haypo/prog/python/3.5/Lib/unittest/test/test_discovery.py", line 572, in test_discover_with_init_module_that_raises_SkipTest_on_import pickle.loads(pickle.dumps(suite, proto)) _pickle.PicklingError: Can't pickle : attribute lookup ModuleSkipped on unittest.loader failed ====================================================================== ERROR: test_discover_with_module_that_raises_SkipTest_on_import (unittest.test.test_discovery.TestDiscovery) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/haypo/prog/python/3.5/Lib/unittest/test/test_discovery.py", line 548, in test_discover_with_module_that_raises_SkipTest_on_import pickle.loads(pickle.dumps(suite, proto)) _pickle.PicklingError: Can't pickle : attribute lookup ModuleSkipped on unittest.loader failed ---------- messages: 297370 nosy: haypo priority: normal severity: normal status: open title: test_unittest fails when hunting reference leaks versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 07:09:48 2017 From: report at bugs.python.org (Samuele Santi) Date: Fri, 30 Jun 2017 11:09:48 +0000 Subject: [New-bugs-announce] [issue30814] Import dotted name as alias breaks with concurrency Message-ID: <1498820988.28.0.530762803635.issue30814@psf.upfronthosting.co.za> New submission from Samuele Santi: I noticed this weird behavior in Python 3.6: Apparently ``import package.module as _alias`` fails in a threaded environment, sometimes raising an ``ImportError``, seemingly at random. Everything seems to be working perfectly fine: - On 3.5 and lower - When *not* defining an alias, eg. ``import package.module`` - When using the ``from package import module as alias`` style See this repo with code for reproducing the issue: https://github.com/rshk/python36-import-alias-concurrency-bug I tested this on the system Python 3.6.1 shipped with Archlinux (both inside and outside of a virtualenv), and in the official docker image for 3.6. This all started here https://github.com/psycopg/psycopg2/issues/550 as others were experiencing this issue too. ---------- messages: 297380 nosy: Samuele Santi2 priority: normal severity: normal status: open title: Import dotted name as alias breaks with concurrency versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 08:26:04 2017 From: report at bugs.python.org (INADA Naoki) Date: Fri, 30 Jun 2017 12:26:04 +0000 Subject: [New-bugs-announce] [issue30815] StringIO uses inefficient PyUnicode_AsUCS4 Message-ID: <1498825564.05.0.576507824205.issue30815@psf.upfronthosting.co.za> New submission from INADA Naoki: >From PEP393, PyUnicode_AsUCS4 is inefficient. And C implementation of io.StringIO() uses it. That's why Python 3 is slower than Python 2 on logging_format and logging_simple benchmarks. https://mail.python.org/pipermail/speed/2017-February/000503.html Maybe, it can use _PyUnicodeWriter APIs instead. ---------- components: IO messages: 297394 nosy: inada.naoki priority: normal severity: normal status: open title: StringIO uses inefficient PyUnicode_AsUCS4 type: performance versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 10:19:31 2017 From: report at bugs.python.org (Xavier de Gaye) Date: Fri, 30 Jun 2017 14:19:31 +0000 Subject: [New-bugs-announce] [issue30817] Abort in PyErr_PrintEx() when no memory Message-ID: <1498832371.19.0.0580869338001.issue30817@psf.upfronthosting.co.za> New submission from Xavier de Gaye: To reproduce the abort (the set_nomemory() function is being added to _testcapi in issue 30695): $ ./python memerr.py python: Objects/call.c:89: _PyObject_FastCallDict: Assertion `!PyErr_Occurred()' failed. Aborted (core dumped) The corresponding backtrace: #0 0x00007ffff7131670 in raise () from /usr/lib/libc.so.6 #1 0x00007ffff7132d00 in abort () from /usr/lib/libc.so.6 #2 0x00007ffff712a45a in __assert_fail_base () from /usr/lib/libc.so.6 #3 0x00007ffff712a4d2 in __assert_fail () from /usr/lib/libc.so.6 #4 0x00000000004628ce in _PyObject_FastCallDict ( callable=, args=args at entry=0x7fffffffe330, nargs=nargs at entry=3, kwargs=kwargs at entry=0x0) at Objects/call.c:89 #5 0x0000000000426004 in PyErr_PrintEx (set_sys_last_vars=set_sys_last_vars at entry=1) at Python/pythonrun.c:641 #6 0x00000000004263ac in PyErr_Print () at Python/pythonrun.c:510 #7 0x0000000000427586 in PyRun_SimpleFileExFlags (fp=fp at entry=0x987620, filename=, filename at entry=0x7ffff6febcd0 "memerr.py", closeit=closeit at entry=1, flags=flags at entry=0x7fffffffe4cc) at Python/pythonrun.c:403 #8 0x0000000000427673 in PyRun_AnyFileExFlags (fp=fp at entry=0x987620, filename=0x7ffff6febcd0 "memerr.py", closeit=closeit at entry=1, flags=flags at entry=0x7fffffffe4cc) at Python/pythonrun.c:82 #9 0x0000000000437217 in run_file (fp=fp at entry=0x987620, filename=0x91a190 L"memerr.py", p_cf=p_cf at entry=0x7fffffffe4cc) at Modules/main.c:341 #10 0x0000000000437bae in Py_Main (argc=argc at entry=2, argv=argv at entry=0x918020) at Modules/main.c:901 #11 0x000000000041d7fa in main (argc=2, argv=0x7fffffffe6c8) at ./Programs/python.c:102 ---------- components: Interpreter Core files: memerr.py messages: 297408 nosy: xdegaye priority: normal severity: normal status: open title: Abort in PyErr_PrintEx() when no memory type: crash versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46982/memerr.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 10:17:08 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 30 Jun 2017 14:17:08 +0000 Subject: [New-bugs-announce] [issue30816] test_open() of test_eintr timeout after 10 min Message-ID: <1498832228.54.0.975621351907.issue30816@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/x86-64%20El%20Capitan%203.x/builds/413/steps/test/logs/stdio 0:32:36 load avg: 1.58 [328/406/1] test_eintr failed 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 151, 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 137, in _assert_python res.fail(cmd_line) File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/support/script_helper.py", line 79, in fail err)) 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: --- test_read (__main__.OSEINTRTest) ... ok test_wait (__main__.OSEINTRTest) ... ok test_wait3 (__main__.OSEINTRTest) ... ok test_wait4 (__main__.OSEINTRTest) ... ok test_waitpid (__main__.OSEINTRTest) ... ok test_write (__main__.OSEINTRTest) ... ok test_accept (__main__.SocketEINTRTest) ... ok test_open (__main__.SocketEINTRTest) ... --- stderr: --- Timeout (0:10:00)! Thread 0x00007fff79b17000 (most recent call first): File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/eintrdata/eintr_tester.py", line 343 in python_open File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/eintrdata/eintr_tester.py", line 339 in _test_open File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/support/__init__.py", line 556 in wrapper File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/eintrdata/eintr_tester.py", line 348 in test_open File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/case.py", line 615 in run File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/unittest/case.py", line 663 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/test/support/__init__.py", line 1896 in _run_suite File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/support/__init__.py", line 1940 in run_unittest File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/eintrdata/eintr_tester.py", line 488 in test_main File "/Users/buildbot/buildarea/3.x.billenstein-elcapitan/build/Lib/test/eintrdata/eintr_tester.py", line 492 in --- ---------------------------------------------------------------------- Ran 1 test in 603.735s FAILED (failures=1) Warning -- files was modified by test_eintr Before: [] After: ['@test_40253_tmp'] test test_eintr failed ---------- components: Tests, macOS keywords: buildbot messages: 297407 nosy: haypo, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: test_open() of test_eintr timeout after 10 min versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 11:04:34 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 30 Jun 2017 15:04:34 +0000 Subject: [New-bugs-announce] [issue30818] Warning -- asyncore.socket_map was modified by test_ftplib on AMD64 FreeBSD 10.x Shared 3.x Message-ID: <1498835074.68.0.82947303088.issue30818@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.x%20Shared%203.x/builds/524/steps/test/logs/stdio test_with_statement (test.test_ftplib.TestTLS_FTPClassMixin) ... ok test_auth_issued_twice (test.test_ftplib.TestTLS_FTPClass) ... ok test_auth_ssl (test.test_ftplib.TestTLS_FTPClass) ... ok test_ccc (test.test_ftplib.TestTLS_FTPClass) ... ok test_check_hostname (test.test_ftplib.TestTLS_FTPClass) ... ok test_context (test.test_ftplib.TestTLS_FTPClass) ... ok test_control_connection (test.test_ftplib.TestTLS_FTPClass) ... ok test_data_connection (test.test_ftplib.TestTLS_FTPClass) ... ok test_login (test.test_ftplib.TestTLS_FTPClass) ... Exception in thread Thread-88: Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_ftplib.py", line 388, in recv return super(SSLConnection, self).recv(buffer_size) File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asyncore.py", line 374, in recv data = self.socket.recv(buffer_size) File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 987, in recv return self.read(buflen) File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 865, in read return self._sslobj.read(len, buffer) File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 627, in read v = self._sslobj.read(len) ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2136) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asynchat.py", line 117, in handle_read data = self.recv(self.ac_in_buffer_size) File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_ftplib.py", line 394, in recv self.handle_close() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asynchat.py", line 190, in handle_close self.close() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_ftplib.py", line 404, in close self._do_ssl_shutdown() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_ftplib.py", line 356, in _do_ssl_shutdown super(SSLConnection, self).close() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asyncore.py", line 397, in close self.socket.close() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socket.py", line 417, in close self._real_close() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 1052, in _real_close socket._real_close(self) File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socket.py", line 411, in _real_close _ss.close(self) ConnectionResetError: [Errno 54] Connection reset by peer During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asyncore.py", line 83, in read obj.handle_read_event() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_ftplib.py", line 366, in handle_read_event super(SSLConnection, self).handle_read_event() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asyncore.py", line 423, in handle_read_event self.handle_read() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asynchat.py", line 121, in handle_read self.handle_error() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_ftplib.py", line 399, in handle_error raise Exception Exception During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/threading.py", line 917, in _bootstrap_inner self.run() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_ftplib.py", line 279, in run asyncore.loop(timeout=0.1, count=1) File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asyncore.py", line 207, in loop poll_fun(timeout, map) File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asyncore.py", line 150, in poll read(obj) File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asyncore.py", line 87, in read obj.handle_error() File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_ftplib.py", line 399, in handle_error raise Exception Exception ok test__all__ (test.test_ftplib.MiscTestCase) ... ok ---------------------------------------------------------------------- Ran 89 tests in 11.986s OK Warning -- threading_cleanup() failed to cleanup 0 threads after 2 sec (count: 0, dangling: 2) Warning -- asyncore.socket_map was modified by test_ftplib Before: {} After: {4: } ---------- components: Tests messages: 297415 nosy: haypo priority: normal severity: normal status: open title: Warning -- asyncore.socket_map was modified by test_ftplib on AMD64 FreeBSD 10.x Shared 3.x versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 12:56:50 2017 From: report at bugs.python.org (Robert Boehne) Date: Fri, 30 Jun 2017 16:56:50 +0000 Subject: [New-bugs-announce] [issue30819] Linking with 'ld -b' fails with 64-bit using HP compiler Message-ID: <1498841810.07.0.0205568789779.issue30819@psf.upfronthosting.co.za> Changes by Robert Boehne : ---------- components: Build nosy: Robert Boehne priority: normal severity: normal status: open title: Linking with 'ld -b' fails with 64-bit using HP compiler type: compile error versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 13:03:41 2017 From: report at bugs.python.org (Anton Khirnov) Date: Fri, 30 Jun 2017 17:03:41 +0000 Subject: [New-bugs-announce] [issue30820] email.contentmanager.raw_data_manager fails to create multipart messages Message-ID: <1498842221.12.0.837001254234.issue30820@psf.upfronthosting.co.za> New submission from Anton Khirnov: The documentation for the "new API" -- email.contentmanager.raw_data_manager -- claims that passing a list of messages to set_content() will create a multipart message. However, it fails with "KeyError: 'builtins.list'" and from looking at the code it seems this functionality is not and never was implemented. ---------- components: email messages: 297430 nosy: barry, elenril, r.david.murray priority: normal severity: normal status: open title: email.contentmanager.raw_data_manager fails to create multipart messages type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 13:13:29 2017 From: report at bugs.python.org (Max Rothman) Date: Fri, 30 Jun 2017 17:13:29 +0000 Subject: [New-bugs-announce] [issue30821] unittest.mock.Mocks with specs aren't aware of default arguments Message-ID: <1498842809.59.0.716482523297.issue30821@psf.upfronthosting.co.za> New submission from Max Rothman: For a function f with the signature f(foo=None), the following three calls are equivalent: f(None) f(foo=None) f() However, only the first two are equivalent in the eyes of unittest.mock.Mock.assert_called_with: >>> with patch('__main__.f', autospec=True) as f_mock: f_mock(foo=None) f_mock.assert_called_with(None) >>> with patch('__main__.f', autospec=True) as f_mock: f_mock(None) f_mock.assert_called_with() AssertionError: Expected call: f() Actual call: f(None) This is definitely surprising to new users (it was surprising to me!) and unnecessarily couples tests to how a particular piece of code happens to call a function. ---------- components: Library (Lib) messages: 297433 nosy: Max Rothman priority: normal severity: normal status: open title: unittest.mock.Mocks with specs aren't aware of default arguments versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 30 19:47:48 2017 From: report at bugs.python.org (Utkarsh Upadhyay) Date: Fri, 30 Jun 2017 23:47:48 +0000 Subject: [New-bugs-announce] [issue30822] Python implementation of datetime module is not being tested correctly. Message-ID: <1498866468.86.0.743233238239.issue30822@psf.upfronthosting.co.za> New submission from Utkarsh Upadhyay: While investigating http://bugs.python.org/issue30302 it was discovered that the Python implementation of the datetime module was not being tested correctly. The datetimetester.py was supposed to execute tests twice, once for the _Fast implementation (i.e. C extension code in _datetimemodule.c) and once for the _Pure implementation (i.e the Python code). The fix is contained in the following two commits: - https://github.com/python/cpython/pull/1493/commits/08e7548f56838fca43b488cefe51de4bdd600f3d - https://github.com/python/cpython/pull/1493/commits/94d5a4e4d33a1d14a2bb1be8fbff5e1e4cd2b7a6 The bug does not effect Python 2.7 as the C version of the datetime module had not been introduced back then. However, as fas as I can tell, the fix needs to be applied to all Python 3.x branches. ---------- components: Tests messages: 297455 nosy: musically_ut, serhiy.storchaka priority: normal severity: normal status: open title: Python implementation of datetime module is not being tested correctly. type: enhancement versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________