From report at bugs.python.org Sun Nov 1 00:31:45 2020 From: report at bugs.python.org (Jeremy Howard) Date: Sun, 01 Nov 2020 04:31:45 +0000 Subject: [New-bugs-announce] [issue42226] imghdr.what is missing docstring, has a logic error, and is overly complex Message-ID: <1604205105.29.0.494636878964.issue42226@roundup.psfhosted.org> New submission from Jeremy Howard : imghdr.what does not set f if h is passed, but still passed f to tests functions. None of the tests functions use it - they would not be able to anyway since it is not always set. imghdr.what is missing a docstring. imghdr.what has a complex highly nest structure with multiple return paths which makes the logic hard to follow. ---------- components: Library (Lib) messages: 380114 nosy: jph00 priority: normal severity: normal status: open title: imghdr.what is missing docstring, has a logic error, and is overly complex type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 01:28:43 2020 From: report at bugs.python.org (Kaiyu Zheng) Date: Sun, 01 Nov 2020 05:28:43 +0000 Subject: [New-bugs-announce] [issue42227] Unexpected sharing of list/set/dict between instances of the same class, when the list/set/dict is a default parameter value of the constructor Message-ID: <1604208523.28.0.858749665776.issue42227@roundup.psfhosted.org> New submission from Kaiyu Zheng : In the following toy example, with Python 3.7.4 class Foo: def __init__(self, a=set()): self.a = a foo1 = Foo() foo2 = Foo() foo1.a.add(1) print(foo2.a) This shows {1}. This means that modifying the .a field of foo1 changed that of foo2. I was not expecting this behavior, as I thought that when the constructor is called, an empty set is created for the parameter `a`. But instead, what seems to happen is that a set() is created, and then shared between instances of Foo. What is the reason for this? What is the benefit? It adds a lot of confusion ---------- messages: 380115 nosy: kaiyutony priority: normal severity: normal status: open title: Unexpected sharing of list/set/dict between instances of the same class, when the list/set/dict is a default parameter value of the constructor type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 05:46:29 2020 From: report at bugs.python.org (Ben Boeckel) Date: Sun, 01 Nov 2020 10:46:29 +0000 Subject: [New-bugs-announce] [issue42228] Activate.ps1 clears PYTHONHOME Message-ID: <1604227589.68.0.567841470196.issue42228@roundup.psfhosted.org> New submission from Ben Boeckel : On Windows, we are extracting a tarball of a Python installation for CI (to avoid needing to juggle umpteen Python installs on umpteen machines). This requires `PYTHONHOME` to be set to use properly since there is no registry entry for the "installation". However, `Activate.ps1` clears `PYTHONHOME` unconditionally. Is there something else we can do to properly integrate with it or should there be an option to say "no, I need `PYTHONHOME` for the stdlib to work"? I don't know how relevant this is to other platforms at the moment as other mechanisms are sufficient there (Xcode's Python3.framework in the SDK and Linux system packages). ---------- components: Windows messages: 380125 nosy: mathstuf, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Activate.ps1 clears PYTHONHOME type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 05:49:32 2020 From: report at bugs.python.org (Samuel Marks) Date: Sun, 01 Nov 2020 10:49:32 +0000 Subject: [New-bugs-announce] [issue42229] Fix SQLite warnings on macOS Message-ID: <1604227772.18.0.746348927327.issue42229@roundup.psfhosted.org> New submission from Samuel Marks : Planned to fix all the compiler warnings on macOS. Ended up just fixing this SQLite one: ``` Python-3.9.0/Modules/_sqlite/connection.c:1066:9: warning: 'sqlite3_trace' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations] sqlite3_trace(self->db, 0, (void*)0); ^~~~~~~~~~~~~ sqlite3_trace_v2 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sqlite3.h:3022:36: note: 'sqlite3_trace' has been explicitly marked deprecated here SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace( ^ Python-3.9.0/Modules/_sqlite/connection.c:1069:9: warning: 'sqlite3_trace' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations] sqlite3_trace(self->db, _trace_callback, trace_callback); ^~~~~~~~~~~~~ sqlite3_trace_v2 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sqlite3.h:3022:36: note: 'sqlite3_trace' has been explicitly marked deprecated here SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace( ^ ``` Note that: `sqlite3_enable_shared_cache` should be removed from `Modules/_sqlite/module.c` also, as warning and guide says: https://www.sqlite.org/c3ref/enable_shared_cache.html ``` Python-3.9.0/Modules/_sqlite/module.c:147:10: warning: 'sqlite3_enable_shared_cache' is deprecated: first deprecated in macOS 10.7 - Not supported [-Wdeprecated-declarations] ``` But I think that would require a major version change, so let's keep that warning fix to one side. Same with the tk issues, as per https://bugs.python.org/issue41016 ; although I suspect there's a way to quiet the warnings here? ---------- components: Build messages: 380126 nosy: samuelmarks priority: normal pull_requests: 21992 severity: normal status: open title: Fix SQLite warnings on macOS type: compile error versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 07:17:01 2020 From: report at bugs.python.org (Jakub Stasiak) Date: Sun, 01 Nov 2020 12:17:01 +0000 Subject: [New-bugs-announce] [issue42230] Document that asyncio's wait() and as_completed() accept arbitrary iterables Message-ID: <1604233021.96.0.386232269828.issue42230@roundup.psfhosted.org> New submission from Jakub Stasiak : The documentation explicitly says "sets" but arbitrary iterables are accepted and various non-sets are passed to those in real world almost certainly. ---------- components: asyncio messages: 380128 nosy: asvetlov, jstasiak, yselivanov priority: normal severity: normal status: open title: Document that asyncio's wait() and as_completed() accept arbitrary iterables versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 08:44:32 2020 From: report at bugs.python.org (STINNER Victor) Date: Sun, 01 Nov 2020 13:44:32 +0000 Subject: [New-bugs-announce] [issue42231] test_zipimport failure Message-ID: <1604238272.76.0.181231986099.issue42231@roundup.psfhosted.org> New submission from STINNER Victor : ARM Raspbian 3.x: https://buildbot.python.org/all/#/builders/424/builds/294 I don't understand why the test started to fail at build 294 which only has one new change: commit 2165cea548f961b308050f30d1f042a377651d44 ("bpo-29566: binhex.binhex now consitently writes MacOS 9 line endings"). It seems to be unrelated. I failed to reproduce the issue on Linux. ====================================================================== FAIL: testBoth (test.test_zipimport.UncompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/lib/buildbot/workers/3.x.gps-raspbian/build/Lib/test/test_zipimport.py", line 194, in testBoth self.doTest(pyc_ext, files, TESTMOD) File "/var/lib/buildbot/workers/3.x.gps-raspbian/build/Lib/test/test_zipimport.py", line 148, in doTest self.assertEqual(file, os.path.join(TEMP_ZIP, AssertionError: '/var[64 chars]8289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.py' != '/var[64 chars]8289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.pyc' - /var/lib/buildbot/workers/3.x.gps-raspbian/build/build/test_python_18289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.py + /var/lib/buildbot/workers/3.x.gps-raspbian/build/build/test_python_18289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.pyc ? + ====================================================================== FAIL: testGetCompiledSource (test.test_zipimport.UncompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/lib/buildbot/workers/3.x.gps-raspbian/build/Lib/test/test_zipimport.py", line 594, in testGetCompiledSource self.doTest(pyc_ext, files, TESTMOD, call=self.assertModuleSource) File "/var/lib/buildbot/workers/3.x.gps-raspbian/build/Lib/test/test_zipimport.py", line 148, in doTest self.assertEqual(file, os.path.join(TEMP_ZIP, AssertionError: '/var[64 chars]8289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.py' != '/var[64 chars]8289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.pyc' - /var/lib/buildbot/workers/3.x.gps-raspbian/build/build/test_python_18289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.py + /var/lib/buildbot/workers/3.x.gps-raspbian/build/build/test_python_18289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.pyc ? + ====================================================================== FAIL: testBoth (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/lib/buildbot/workers/3.x.gps-raspbian/build/Lib/test/test_zipimport.py", line 194, in testBoth self.doTest(pyc_ext, files, TESTMOD) File "/var/lib/buildbot/workers/3.x.gps-raspbian/build/Lib/test/test_zipimport.py", line 148, in doTest self.assertEqual(file, os.path.join(TEMP_ZIP, AssertionError: '/var[64 chars]8289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.py' != '/var[64 chars]8289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.pyc' - /var/lib/buildbot/workers/3.x.gps-raspbian/build/build/test_python_18289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.py + /var/lib/buildbot/workers/3.x.gps-raspbian/build/build/test_python_18289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.pyc ? + ====================================================================== FAIL: testGetCompiledSource (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/lib/buildbot/workers/3.x.gps-raspbian/build/Lib/test/test_zipimport.py", line 594, in testGetCompiledSource self.doTest(pyc_ext, files, TESTMOD, call=self.assertModuleSource) File "/var/lib/buildbot/workers/3.x.gps-raspbian/build/Lib/test/test_zipimport.py", line 148, in doTest self.assertEqual(file, os.path.join(TEMP_ZIP, AssertionError: '/var[64 chars]8289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.py' != '/var[64 chars]8289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.pyc' - /var/lib/buildbot/workers/3.x.gps-raspbian/build/build/test_python_18289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.py + /var/lib/buildbot/workers/3.x.gps-raspbian/build/build/test_python_18289?/test_python_worker_2163?/junk95142.zip/ziptestmodule.pyc ? + ---------- components: Tests messages: 380135 nosy: vstinner priority: normal severity: normal status: open title: test_zipimport failure versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 10:08:43 2020 From: report at bugs.python.org (David CARLIER) Date: Sun, 01 Nov 2020 15:08:43 +0000 Subject: [New-bugs-announce] [issue42232] mmap module add Darwin specific madvise options Message-ID: <1604243323.33.0.637936661343.issue42232@roundup.psfhosted.org> Change by David CARLIER : ---------- components: macOS nosy: devnexen, ned.deily, ronaldoussoren priority: normal pull_requests: 21996 severity: normal status: open title: mmap module add Darwin specific madvise options type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 10:32:10 2020 From: report at bugs.python.org (Ken Jin) Date: Sun, 01 Nov 2020 15:32:10 +0000 Subject: [New-bugs-announce] [issue42233] GenericAlias does not support union type expressions Message-ID: <1604244730.48.0.778653484179.issue42233@roundup.psfhosted.org> New submission from Ken Jin : Union type expressions added in PEP 604 throw an error when both operands are GenericAlias objects. Eg the following works:: int | list[str] The following throws TypeError:: list[int] | dict[float, str] Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'types.GenericAlias' I have submitted a PR to fix this. Coincidentally, it also fixes the fact that union expressions weren't de-duplicating GenericAlias properly. Eg:: >>> list[int] | int | list[int] list[int] | int | list[int] For non-GenericAlias type expressions, the new code shouldn't be much slower. Rich compare is only used for GenericAlias objects. This isn't very scientific, but python -m timeit "int | str | float" # original 1000000 loops, best of 5: 295 nsec per loop # purely rich compare 1000000 loops, best of 5: 344 nsec per loop # check for GenericAlias and rich compare only for that 1000000 loops, best of 5: 297 nsec per loop ---------- components: Interpreter Core messages: 380145 nosy: gvanrossum, kj, levkivskyi priority: normal severity: normal status: open title: GenericAlias does not support union type expressions versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 10:48:23 2020 From: report at bugs.python.org (Armins Stepanjans) Date: Sun, 01 Nov 2020 15:48:23 +0000 Subject: [New-bugs-announce] [issue42234] pathlib relative_to behaviour change Message-ID: <1604245703.4.0.361207259352.issue42234@roundup.psfhosted.org> New submission from Armins Stepanjans : In the docs (https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.relative_to) PurePath.relative_to() is specified to fail for arguments that are not on the original path (e.g. Path('/ham/beans').relative_to(Path('/spam'))). I believe it would be useful to extend the behaviour of relative_to so that it handles the case above. For example, I would expect Path('/ham/beans').relative_to(Path('/spam')) to return Path('../ham/beans'). If this sounds like a useful change I'd be happy to make a PR for it. ---------- components: Library (Lib) messages: 380148 nosy: armins.bagrats priority: normal severity: normal status: open title: pathlib relative_to behaviour change type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 11:31:13 2020 From: report at bugs.python.org (Ronald Oussoren) Date: Sun, 01 Nov 2020 16:31:13 +0000 Subject: [New-bugs-announce] [issue42235] [macOS] Use --enable-optimizations in build-installer.py Message-ID: <1604248273.75.0.377267734476.issue42235@roundup.psfhosted.org> New submission from Ronald Oussoren : With recent enough compilers it is possible to use --enable-optimzations when building the installer. ---------- messages: 380152 nosy: ronaldoussoren priority: normal severity: normal status: open title: [macOS] Use --enable-optimizations in build-installer.py type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 13:12:56 2020 From: report at bugs.python.org (STINNER Victor) Date: Sun, 01 Nov 2020 18:12:56 +0000 Subject: [New-bugs-announce] [issue42236] os.device_encoding() doesn't respect the UTF-8 Mode Message-ID: <1604254376.75.0.724076396779.issue42236@roundup.psfhosted.org> New submission from STINNER Victor : When the UTF-8 Mode is enabled, sys.stdout.encoding is always UTF-8, whereas os.devide_encoding(sys.stdout.fileno()) returns the locale encoding. os.devide_encoding() must return UTF-8 when the UTF-8 Mode is used. ---------- components: Library (Lib) messages: 380156 nosy: vstinner priority: normal severity: normal status: open title: os.device_encoding() doesn't respect the UTF-8 Mode versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 15:07:47 2020 From: report at bugs.python.org (Sebastian Wiedenroth) Date: Sun, 01 Nov 2020 20:07:47 +0000 Subject: [New-bugs-announce] [issue42237] test_socket.SendfileUsingSendfileTest fails on illumos Message-ID: <1604261267.98.0.369045235153.issue42237@roundup.psfhosted.org> New submission from Sebastian Wiedenroth : I'm investigating some test failures related to sendfile on illumos: testCount (test.test_socket.SendfileUsingSendfileTest) ... FAIL testCountSmall (test.test_socket.SendfileUsingSendfileTest) ... ok testCountWithOffset (test.test_socket.SendfileUsingSendfileTest) ... ok testEmptyFileSend (test.test_socket.SendfileUsingSendfileTest) ... ok testNonBlocking (test.test_socket.SendfileUsingSendfileTest) ... ok testNonRegularFile (test.test_socket.SendfileUsingSendfileTest) ... ok testOffset (test.test_socket.SendfileUsingSendfileTest) ... ERROR testRegularFile (test.test_socket.SendfileUsingSendfileTest) ... ok testWithTimeout (test.test_socket.SendfileUsingSendfileTest) ... FAIL testWithTimeoutTriggeredSend (test.test_socket.SendfileUsingSendfileTest) ... ok test_errors (test.test_socket.SendfileUsingSendfileTest) ... ok ====================================================================== ERROR: testOffset (test.test_socket.SendfileUsingSendfileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/root/cpython/Lib/socket.py", line 386, in _sendfile_use_sendfile sent = os_sendfile(sockno, fileno, offset, blocksize) OSError: [Errno 22] Invalid argument During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/root/cpython/Lib/test/test_socket.py", line 374, in _tearDown raise exc File "/root/cpython/Lib/test/test_socket.py", line 392, in clientRun test_func() File "/root/cpython/Lib/test/test_socket.py", line 6057, in _testOffset sent = meth(file, offset=5000) File "/root/cpython/Lib/socket.py", line 399, in _sendfile_use_sendfile raise _GiveupOnSendfile(err) socket._GiveupOnSendfile: [Errno 22] Invalid argument ====================================================================== FAIL: testCount (test.test_socket.SendfileUsingSendfileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/root/cpython/Lib/test/test_socket.py", line 6085, in testCount self.assertEqual(len(data), count) AssertionError: 5405948743 != 5000007 ====================================================================== FAIL: testWithTimeout (test.test_socket.SendfileUsingSendfileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/root/cpython/Lib/test/test_socket.py", line 6159, in testWithTimeout self.assertEqual(len(data), self.FILESIZE) AssertionError: 429006848 != 10485760 ---------------------------------------------------------------------- Ran 11 tests in 33.603s FAILED (failures=2, errors=1) Looking at the testCount case I could observe repeated calls to sendfile() with out_fd=7, in_fd=6 off=0, len=5000007 which returned -1 with errno set to EAGAIN. ---------- components: IO, Library (Lib) messages: 380160 nosy: wiedi priority: normal severity: normal status: open title: test_socket.SendfileUsingSendfileTest fails on illumos versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 1 18:49:23 2020 From: report at bugs.python.org (Julien Palard) Date: Sun, 01 Nov 2020 23:49:23 +0000 Subject: [New-bugs-announce] [issue42238] Deprecate suspicious.py? Message-ID: <1604274563.95.0.828690163802.issue42238@roundup.psfhosted.org> New submission from Julien Palard : I was not here 21 years ago when it was introduced [1], but according to the commit message it was introduced to find leftover Latex mardown. It tries to find 4 patterns in Sphinx node text (not in raw rst files): ::(?=[^=])| # two :: (but NOT ::=) This one has ~100 false positive in susp-ignored.csv (pypi classifiers, slices, ipv6, ...) :[a-zA-Z][a-zA-Z0-9]+| # :foo This one has ~300 false positive in susp-ignored.csv (slices, C:\, ipv6, ...) `| # ` (seldom used by itself) This one has ~20 false positive in susp-ignored.csv (mostly reStructuredText in code-blocks) (? _______________________________________ From report at bugs.python.org Mon Nov 2 00:24:17 2020 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 02 Nov 2020 05:24:17 +0000 Subject: [New-bugs-announce] [issue42239] IDLE: Restore calltip when needed Message-ID: <1604294657.06.0.127781184025.issue42239@roundup.psfhosted.org> New submission from Terry J. Reedy : If one types 'int(' an int calltip is displayed. If one adds 'float(' then the float calltip is displayed instead. If one adds '"3.1")', the int calltip is restored. (Actually a new int calltip.) Finally, if one closes with ')', the int calltip is removed. If, after 'int(', one adds instead 'f(', where f has no accessible signature or docstring and hence no calltip, the int calltip is dropped with no replacement. When f is closed, the int calltip is not restored because open_calltip in def refresh_calltip_event(self, event): # Bound to ')'. if self.active_calltip and self.active_calltip.tipwindow: self.open_calltip(False) is not called because there is no existing calltip. This issue is about somehow having the int calltip after the f call. Possibilities. 1. Do not drop the int calltip when an inner call has none. 2. Give the inner call a fake calltip, something like "f(". Again, revise open_calltip. 3. Drop the outer calltip and set a 'nested_call flag in open_calltip and test it with 'or' in refresh_calltip_event (and unset the flag -- conditionally?) to restore it. 4. Add a calltip stack and test it for not empty in refresh_calltip_event. Tal, any opinions on the desired behavior. I believe the #40511 revision should make any of the above, with 1 and 2 being easiest and safest. A problem with 3 and 4 is that the text cursor can be moved out of the call and the calltip closed without the call being completed with ')'. I want to add more tests first. ---------- assignee: terry.reedy components: IDLE messages: 380180 nosy: taleinat, terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE: Restore calltip when needed type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 2 01:29:44 2020 From: report at bugs.python.org (Rudresh Veerkhare) Date: Mon, 02 Nov 2020 06:29:44 +0000 Subject: [New-bugs-announce] [issue42240] Add Maxheap version of a heappush into heapq module Message-ID: <1604298584.59.0.170869406843.issue42240@roundup.psfhosted.org> New submission from Rudresh Veerkhare : Main functions required to implement Heap data structure are: function heappush - to push an element in Heap function heappop - to pop an element from Heap for implementing Minheap this functions are present in the module as : heappush - for adding element into Minheap heappop - to pop an element from Minheap for implementing Maxheap only one of this two required functions is present: _heappop_max - to pop an element from Maxheap I suggest adding a Maxheap version of heappush into heapq module. _heappush_max - for adding an element into Maxheap. ---------- components: Library (Lib) messages: 380184 nosy: veerkharerudresh priority: normal severity: normal status: open title: Add Maxheap version of a heappush into heapq module type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 2 02:17:08 2020 From: report at bugs.python.org (Samuel Marks) Date: Mon, 02 Nov 2020 07:17:08 +0000 Subject: [New-bugs-announce] [issue42241] Backport SQLite trace API v2 Message-ID: <1604301428.79.0.759085975242.issue42241@roundup.psfhosted.org> New submission from Samuel Marks : Backports https://github.com/python/cpython/pull/19581 https://bugs.python.org/issue40318 as per https://bugs.python.org/issue42229 ---------- components: Build messages: 380185 nosy: samuelmarks priority: normal pull_requests: 22011 severity: normal status: open title: Backport SQLite trace API v2 type: compile error versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 2 02:26:01 2020 From: report at bugs.python.org (Samuel Marks) Date: Mon, 02 Nov 2020 07:26:01 +0000 Subject: [New-bugs-announce] [issue42242] Backport SQLite trace API v2 Message-ID: <1604301961.05.0.228655015786.issue42242@roundup.psfhosted.org> New submission from Samuel Marks : Backports https://github.com/python/cpython/pull/19581 https://bugs.python.org/issue40318 as per https://bugs.python.org/issue42229 See also 3.9 backporting: https://bugs.python.org/issue42241 [not sure if this is how you do backporting, a new issue and GH PR for each supported release tag?] ---------- components: Build messages: 380186 nosy: samuelmarks priority: normal pull_requests: 22013 severity: normal status: open title: Backport SQLite trace API v2 type: compile error versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 2 03:20:25 2020 From: report at bugs.python.org (Erlend Egeberg Aasland) Date: Mon, 02 Nov 2020 08:20:25 +0000 Subject: [New-bugs-announce] [issue42243] Don't access the module dictionary directly Message-ID: <1604305225.53.0.387494771093.issue42243@roundup.psfhosted.org> New submission from Erlend Egeberg Aasland : Quoting from https://docs.python.org/3.10/c-api/module.html: "It is recommended extensions use other PyModule_* and PyObject_* functions rather than directly manipulate a module?s __dict__." A number of modules still access the module dictionary directly: zsh % grep -r PyModule_GetDict Modules Modules/errnomodule.c: PyObject *module_dict = PyModule_GetDict(module); Modules/_sre.c: d = PyModule_GetDict(m); Modules/_cursesmodule.c: d = PyModule_GetDict(m); Modules/_threadmodule.c: d = PyModule_GetDict(m); Modules/signalmodule.c: PyObject *d = PyModule_GetDict(m); Modules/_xxsubinterpretersmodule.c: PyObject *ns = PyModule_GetDict(main_mod); // borrowed Modules/_xxsubinterpretersmodule.c: PyObject *ns = PyModule_GetDict(module); // borrowed Modules/socketmodule.c: dict = PyModule_GetDict(m); Modules/_ssl.c: d = PyModule_GetDict(m); Modules/_curses_panel.c: PyObject *d = PyModule_GetDict(mod); Modules/_sqlite/connection.c: module_dict = PyModule_GetDict(module); Modules/_winapi.c: PyObject *d = PyModule_GetDict(m); Modules/pyexpat.c: d = PyModule_GetDict(m); ---------- components: Library (Lib) messages: 380197 nosy: erlendaasland priority: normal severity: normal status: open title: Don't access the module dictionary directly type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 2 04:19:48 2020 From: report at bugs.python.org (Cristian Martinez de Morentin) Date: Mon, 02 Nov 2020 09:19:48 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue42244=5D_TimedRotatingFile?= =?utf-8?q?Handler_doesn=E2=80=99t_handle_the_switch_to/from_DST_when_usin?= =?utf-8?q?g_daily/midnight_rotation?= Message-ID: <1604308788.03.0.39429090744.issue42244@roundup.psfhosted.org> New submission from Cristian Martinez de Morentin : TimedRotatingFileHandler doesn?t handle the switch to/from DST when using daily/midnight rotation. When DST switch occurs, the previous day logging file is overwritten. The issue is present regardless of the value of the UTC flag (True/False). For instance, we had a DST switch on october 24th in Spain and no logging file was created for that day. Instead, the data was written to october 23rd file. ---------- components: Library (Lib) messages: 380201 nosy: Cristian Martinez de Morentin priority: normal severity: normal status: open title: TimedRotatingFileHandler doesn?t handle the switch to/from DST when using daily/midnight rotation type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 2 08:33:55 2020 From: report at bugs.python.org (DanilZ) Date: Mon, 02 Nov 2020 13:33:55 +0000 Subject: [New-bugs-announce] [issue42245] concurrent.futures.ProcessPoolExecutor freezes depending on complexity Message-ID: <1604324035.95.0.0561998847241.issue42245@roundup.psfhosted.org> New submission from DanilZ : Note: problem occurs only after performing the RandomizedSearchCV... When applying a function in a multiprocess using concurrent.futures if the function includes anything else other than print(), it is not executed and the process freezes. Here is the code to reproduce. from xgboost import XGBRegressor from sklearn.model_selection import KFold import concurrent.futures from sklearn.datasets import make_regression import pandas as pd import numpy as np from sklearn.model_selection import RandomizedSearchCV # STEP 1 # ---------------------------------------------------------------------------- # simulate RandomizedSearchCV data = make_regression(n_samples=500, n_features=100, n_informative=10, n_targets=1, random_state=5) X = pd.DataFrame(data[0]) y = pd.Series(data[1]) kf = KFold(n_splits = 3, shuffle = True, random_state = 5) model = XGBRegressor(n_jobs = -1) params = { 'min_child_weight': [0.1, 1, 5], 'subsample': [0.5, 0.7, 1.0], 'colsample_bytree': [0.5, 0.7, 1.0], 'eta': [0.005, 0.01, 0.1], 'n_jobs': [-1] } random_search = RandomizedSearchCV( model, param_distributions = params, n_iter = 50, n_jobs = -1, refit = True, # necessary for random_search.best_estimator_ cv = kf.split(X,y), verbose = 1, random_state = 5 ) random_search.fit(X, np.array(y)) # STEP 2.0 # ---------------------------------------------------------------------------- # test if multiprocessing is working in the first place def just_print(): print('Just printing') with concurrent.futures.ProcessPoolExecutor() as executor: results_temp = [executor.submit(just_print) for i in range(0,12)] # ---------------------------------------------------------------------------- # STEP 2.1 # ---------------------------------------------------------------------------- # test on a slightly more complex function def fit_model(): # JUST CREATING A DATASET, NOT EVEN FITTING ANY MODEL!!! AND IT FREEZES data = make_regression(n_samples=500, n_features=100, n_informative=10, n_targets=1, random_state=5) # model = XGBRegressor(n_jobs = -1) # model.fit(data[0],data[1]) print('Fit complete') with concurrent.futures.ProcessPoolExecutor() as executor: results_temp = [executor.submit(fit_model) for i in range(0,12)] # ---------------------------------------------------------------------------- Attached this code in a .py file. ---------- components: macOS files: concur_fut_freeze.py messages: 380220 nosy: DanilZ, bquinlan, ned.deily, pitrou, ronaldoussoren priority: normal severity: normal status: open title: concurrent.futures.ProcessPoolExecutor freezes depending on complexity versions: Python 3.7 Added file: https://bugs.python.org/file49562/concur_fut_freeze.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 2 10:32:42 2020 From: report at bugs.python.org (Mark Shannon) Date: Mon, 02 Nov 2020 15:32:42 +0000 Subject: [New-bugs-announce] [issue42246] Implement PEP 626 Message-ID: <1604331162.26.0.596873070589.issue42246@roundup.psfhosted.org> New submission from Mark Shannon : Implementation of PEP 626 requires: 1. Implementation of the new line number table and associated APIs. 2. Removal of BEGIN_DO_NOT_EMIT_BYTECODE and END_DO_NOT_EMIT_BYTECODE from the compiler as they do not understand line numbers and may remove lines from the bytecode that they shouldn't. 3. Enhance compiler front-end and CFG optimizer to avoid the negative performance impact of PEP. a) Duplicate the tests in while blocks to avoid the extra jump instruction at the end of the loop. b) Duplicate and renumber terminator blocks that have no line numbers. Guaranteeing that f_lineno is correct without hurting performance ----------------------------------------------------------------- PEP 626 mandates that the f_lineno attribute of a frame is always correct, even after a return or raise, but we don't want to hurt performance. Since the interpreter ensures that the f_lasti attribute of a frame is always correct, we can ensure correctness of f_lineno at zero cost, by ensuring that all RETURN_VALUE, RAISE_VARARGS and RERAISE instruction have a non-negative line number. Then f_lineno can always be lazily computed from f_lasti. The front-end generates artificial RERAISEs and RETURN_VALUE that have no line number. To give these instructions a valid line number we can take advantage of the fact that such terminator blocks (blocks with no successors) can be freely duplicated. Once duplicated, each terminator block will have only one predecessor and can acquire the line number of the preceding block, without causing false line events. ---------- assignee: Mark.Shannon messages: 380231 nosy: Mark.Shannon, pablogsal priority: normal severity: normal status: open title: Implement PEP 626 type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 2 13:25:59 2020 From: report at bugs.python.org (David Mandelberg) Date: Mon, 02 Nov 2020 18:25:59 +0000 Subject: [New-bugs-announce] [issue42247] unittest hides traceback frames in chained exceptions Message-ID: <1604341559.53.0.224869314437.issue42247@roundup.psfhosted.org> New submission from David Mandelberg : The traceback in the output of the attached test (see below) doesn't include line 5, which is where the original exception is raised. I think this is because https://github.com/python/cpython/blob/b9ee4af4c643a323779fd7076e80b29d611f2709/Lib/unittest/result.py#L180-L186 uses the `limit` parameter to try to hide the implementation of `self.fail()` from the traceback, but `traceback.TracebackException.format()` applies the limit to the chained exception. I'm not sure if that's a bug in unittest or traceback, but from the comment in the above part of unittest, I don't think it's intentional. F ====================================================================== FAIL: test_foo (__main__.FooTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "foo.py", line 12, in test_foo foo() ValueError: foo During handling of the above exception, another exception occurred: Traceback (most recent call last): File "foo.py", line 14, in test_foo self.fail('foo() raised ValueError') AssertionError: foo() raised ValueError ---------------------------------------------------------------------- Ran 1 test in 0.000s FAILED (failures=1) ---------- components: Library (Lib) files: foo.py messages: 380244 nosy: dseomn priority: normal severity: normal status: open title: unittest hides traceback frames in chained exceptions type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49563/foo.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 2 15:46:49 2020 From: report at bugs.python.org (Eric Froemling) Date: Mon, 02 Nov 2020 20:46:49 +0000 Subject: [New-bugs-announce] [issue42248] Raised exception in Enum keeping user objects alive unnecessarily Message-ID: <1604350009.17.0.208770748804.issue42248@roundup.psfhosted.org> New submission from Eric Froemling : I've run into an issue where exceptions thrown by Enum constructors are keeping my objects alive. The underlying issue seems to be the same as https://bugs.python.org/issue36820 The same method used to fix the issue above seems to work here: simply adding a try/finally clause around the error handling at the end of enum.Enum.__new__() which sets ve_exc and exc to None does the trick. I've attached a short script which demonstrates the issue. I realize that the cyclic garbage collector will eventually handle this case, but its a bummer to lose determinism in the destruction of my objects. I'd be happy to create a PR for this or whatever I can do to help; just let me know if I should (I'm new here). ---------- components: Library (Lib) files: enum_ref_loop_example.py messages: 380249 nosy: efroemling priority: normal severity: normal status: open title: Raised exception in Enum keeping user objects alive unnecessarily versions: Python 3.8 Added file: https://bugs.python.org/file49564/enum_ref_loop_example.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 3 02:21:29 2020 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 03 Nov 2020 07:21:29 +0000 Subject: [New-bugs-announce] [issue42249] Plistlib cannot create binary Plist file larger than 4GiB Message-ID: <1604388089.74.0.470654148102.issue42249@roundup.psfhosted.org> New submission from Serhiy Storchaka : Due to a typo plistlib uses at most 32 bits for references and offsets. It will fail if try to create a file larger than 4GiB or containing more than 2**32 unique objects (the latter of course implies the former). ---------- components: Library (Lib), macOS messages: 380263 nosy: ned.deily, ronaldoussoren, serhiy.storchaka priority: normal severity: normal status: open title: Plistlib cannot create binary Plist file larger than 4GiB type: behavior versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 3 05:49:29 2020 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Tue, 03 Nov 2020 10:49:29 +0000 Subject: [New-bugs-announce] [issue42250] test_ast leaked [23640, 23636, 23640] references Message-ID: <1604400569.36.0.556312833681.issue42250@roundup.psfhosted.org> New submission from Pablo Galindo Salgado : https://buildbot.python.org/all/#/builders/205/builds/83 OK ...... test_ast leaked [23640, 23636, 23640] references, sum=70916 test_ast leaked [7932, 7930, 7932] memory blocks, sum=23794 1 test failed again: test_ast ---------- messages: 380269 nosy: pablogsal priority: normal severity: normal status: open title: test_ast leaked [23640, 23636, 23640] references _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 3 08:15:23 2020 From: report at bugs.python.org (Mario Corchero) Date: Tue, 03 Nov 2020 13:15:23 +0000 Subject: [New-bugs-announce] [issue42251] Add threading.gettrace and threading.getprofile Message-ID: <1604409323.63.0.865948030488.issue42251@roundup.psfhosted.org> New submission from Mario Corchero : When working in a C extension from a non-python created thread which calls PyGILState_Ensure as it later calls a Python callback on user code, I wished there was a way to set the trace function similar to what a native Python thread would do. We could just call sys.gettrace within the thread, but the application might have chosen to set threading.settrace differently. Same applies for threading.setprofile. ---------- components: Library (Lib) messages: 380273 nosy: mariocj89 priority: normal severity: normal status: open title: Add threading.gettrace and threading.getprofile versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 3 08:17:22 2020 From: report at bugs.python.org (Tom Kent) Date: Tue, 03 Nov 2020 13:17:22 +0000 Subject: [New-bugs-announce] [issue42252] Embeddable Python indicates that it uses PYTHONPATH Message-ID: <1604409442.14.0.226700475813.issue42252@roundup.psfhosted.org> New submission from Tom Kent : According to the documentation https://docs.python.org/3/using/windows.html#windows-embeddable > When extracted, the embedded distribution is (almost) fully isolated > from the user?s system, including environment variables, system registry > settings, and installed packages The embedded distribution should ignore the environment variables. This is echoed in this prior issue that thought `PYTHONPATH` not being respected was a bug: https://bugs.python.org/issue28245 Regardless of the decision to respect environment variables, the message that is displayed when running the distribution's `python --help` needs to indicate how it will act. Currently, for the embedded distribution, which doesn't respect the env variables, there is a section in the output from running `python -help` that indicates: ``` Other environment variables: PYTHONSTARTUP: file executed on interactive startup (no default) PYTHONPATH : ';'-separated list of directories prefixed to the default module search path. The result is sys.path. PYTHONHOME : alternate directory (or ;). The default module search path uses \python{major}{minor}. PYTHONPLATLIBDIR : override sys.platlibdir. PYTHONCASEOK : ignore case in 'import' statements (Windows). PYTHONUTF8: if set to 1, enable the UTF-8 mode. PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr. PYTHONFAULTHANDLER: dump the Python traceback on fatal errors. PYTHONHASHSEED: if this variable is set to 'random', a random value is used to seed the hashes of str and bytes objects. It can also be set to an integer in the range [0,4294967295] to get hash values with a predictable seed. PYTHONMALLOC: set the Python memory allocators and/or install debug hooks on Python memory allocators. Use PYTHONMALLOC=debug to install debug hooks. PYTHONCOERCECLOCALE: if this variable is set to 0, it disables the locale coercion behavior. Use PYTHONCOERCECLOCALE=warn to request display of locale coercion and locale compatibility warnings on stderr. PYTHONBREAKPOINT: if this variable is set to 0, it disables the default debugger. It can be set to the callable of your debugger of choice. PYTHONDEVMODE: enable the development mode. PYTHONPYCACHEPREFIX: root directory for bytecode cache (pyc) files. ``` This may lead users (it did lead this one) to assume that they are doing something wrong when for example the output of `sys.path` doesn't included items in `os.environ["PYTHONPATH"]`. Realizing that it may be difficult to achieve, the help output should match the state of what the interpreter will actually do if run. ---------- components: Windows messages: 380274 nosy: paul.moore, steve.dower, teeks99, tim.golden, zach.ware priority: normal severity: normal status: open title: Embeddable Python indicates that it uses PYTHONPATH versions: Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 3 09:03:02 2020 From: report at bugs.python.org (Jens Diemer) Date: Tue, 03 Nov 2020 14:03:02 +0000 Subject: [New-bugs-announce] [issue42253] xml.dom.minidom.rst missed informations Message-ID: <1604412182.71.0.862314326589.issue42253@roundup.psfhosted.org> New submission from Jens Diemer : The standalone arguments was added in Python 3.9. This information is missed in the docu. ---------- messages: 380277 nosy: jedie2 priority: normal pull_requests: 22042 severity: normal status: open title: xml.dom.minidom.rst missed informations versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 3 12:49:42 2020 From: report at bugs.python.org (signing_agreement) Date: Tue, 03 Nov 2020 17:49:42 +0000 Subject: [New-bugs-announce] [issue42254] inspect.getmembers iterator version Message-ID: <1604425782.8.0.580845588744.issue42254@roundup.psfhosted.org> New submission from signing_agreement : inspect.getmembers should have a generator version. ---------- components: Library (Lib) messages: 380287 nosy: signing_agreement priority: normal severity: normal status: open title: inspect.getmembers iterator version type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 3 14:15:01 2020 From: report at bugs.python.org (Ronald Oussoren) Date: Tue, 03 Nov 2020 19:15:01 +0000 Subject: [New-bugs-announce] [issue42255] webbrowser.MacOSX is unused, untested and undocumented Message-ID: <1604430901.68.0.981211049507.issue42255@roundup.psfhosted.org> New submission from Ronald Oussoren : class webbrower.MacOSX is untested and undocumented. It is also not used by webbrowser itself (webbrowser.MacOSXOSAScript is used to launch browsers). It's probably safe to just remove the class, otherwise deprecate in 3.10 for removal in 3.11. ---------- components: Library (Lib), macOS messages: 380293 nosy: ned.deily, ronaldoussoren priority: normal severity: normal status: open title: webbrowser.MacOSX is unused, untested and undocumented type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 3 14:17:21 2020 From: report at bugs.python.org (Paulie Pena) Date: Tue, 03 Nov 2020 19:17:21 +0000 Subject: [New-bugs-announce] [issue42256] BaseCookie.__parse_string() doesn't work with expires= between cookies Message-ID: <1604431041.17.0.875441243707.issue42256@roundup.psfhosted.org> New submission from Paulie Pena : Since `requests` creates a comma-separated list for any duplicated headers, this causes a problem when `expires=...` is between two `Set-Cookie` header values. `BaseCookie.__parse_string()` in https://github.com/python/cpython/blob/master/Lib/http/cookies.py, in that case, will just give up, since it thinks it was given an invalid cookie. The fix is to replace the comma at the end of each trailing `expires=...` with a semicolon. Inside `BaseCookie.__parse_string()`, before the `while` loop, all that should be needed is to add this: ``` str = re.sub('(=\w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT),', r'\1;', str) ``` ---------- components: Library (Lib) messages: 380294 nosy: paulie4 priority: normal severity: normal status: open title: BaseCookie.__parse_string() doesn't work with expires= between cookies type: behavior versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 01:01:55 2020 From: report at bugs.python.org (Kurochan) Date: Wed, 04 Nov 2020 06:01:55 +0000 Subject: [New-bugs-announce] [issue42257] platform.libc_ver() doesn't consider in case of executable is empty string Message-ID: <1604469715.55.0.889552705694.issue42257@roundup.psfhosted.org> New submission from Kurochan : Currently, `platform.libc_ver()` doesn't consider in case of `executable` variable is an empty string. However, with Python 3.8, the following code could pass an empty string `executable` to the `platform.libc_ver()` function. https://github.com/python/cpython/blob/efc782d29e229924076ffb6645a72f26242fb3ef/Lib/platform.py#L1205 https://docs.python.org/3/library/sys.html#sys.executable Because the `sys.executable` could return an empty string, so I would like to add the empty string handler. https://github.com/python/cpython/blob/efc782d29e229924076ffb6645a72f26242fb3ef/Lib/platform.py#L174 Or please also merge the following PR to Python 3.8. https://github.com/python/cpython/pull/14418 ---------- components: Library (Lib) messages: 380311 nosy: kurochan priority: normal severity: normal status: open title: platform.libc_ver() doesn't consider in case of executable is empty string type: behavior versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 06:21:13 2020 From: report at bugs.python.org (mendelmaleh) Date: Wed, 04 Nov 2020 11:21:13 +0000 Subject: [New-bugs-announce] [issue42258] argparse: show choices once per argument Message-ID: <1604488873.92.0.395352183605.issue42258@roundup.psfhosted.org> Change by mendelmaleh : ---------- components: Library (Lib) nosy: mendelmaleh priority: normal severity: normal status: open title: argparse: show choices once per argument type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 06:44:31 2020 From: report at bugs.python.org (Danylo Hlynskyi) Date: Wed, 04 Nov 2020 11:44:31 +0000 Subject: [New-bugs-announce] [issue42259] pprint: infinite recursion for saferepr() when using nested objects, but str() works Message-ID: <1604490271.59.0.652277780579.issue42259@roundup.psfhosted.org> New submission from Danylo Hlynskyi : First, here's an example using str(): ``` class NiceObject: def __str__(self): return str(self.__dict__) def __repr__(self): return str(self) s = NiceObject() s.self = s ``` This outputs: ``` >>> s {'self': {...}} ``` When I replace str() call with pprint.saferepr(), I end up in infinite recursion. ``` import pprint class ReallyNiceObject: def __str__(self): return pprint.saferepr(self.__dict__) def __repr__(self): return str(self) ``` Same happens for pprint.pformat(), with depth set. Is this expected behavior? ---------- components: Library (Lib) messages: 380315 nosy: danbst priority: normal severity: normal status: open title: pprint: infinite recursion for saferepr() when using nested objects, but str() works type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 09:45:21 2020 From: report at bugs.python.org (STINNER Victor) Date: Wed, 04 Nov 2020 14:45:21 +0000 Subject: [New-bugs-announce] [issue42260] [C API] Add PyInterpreterState_SetConfig(): reconfigure an interpreter Message-ID: <1604501121.18.0.0957616798897.issue42260@roundup.psfhosted.org> New submission from STINNER Victor : This issue is a follow-up of the PEP 567 which introduced the PyConfig C API and is related to PEP 432 which wants to rewrite Modules/getpath.c in Python. I would like to add a new PyInterpreterState_SetConfig() function to be able to reconfigure a Python interpreter in C. One example is to write a custom sys.path, to implement of virtual environment (common request for embedded Python), etc. Currently, it's really complex to tune the Python configuration. The use case is to tune Python for embedded Python. First, I would like to add new functions to the C API for that: * PyInterpreterState_GetConfigCopy() * PyInterpreterState_SetConfig() The second step will to be expose these two functions in Python (I'm not sure where for now), and gives the ablity to tune the Python configuration in pure Python. The site module already does that for sys.path, but it is running "too late" in the Python initialization. Here the idea is to configure Python before it does access any file on disk, after the "core" initialization and before the "main" initialization. One concrete example would be to reimplement Modules/getpath.c in Python, convert it to a frozen module, and run it at Python startup to populate sys.path. It would allow to move some of the site code into this module to run it earlier. Pseudo-code in C: --------------------- void init_core(void) { // "Core" initialization PyConfig config; PyConfig_InitPython(&config); PyConfig._init_main = 0 Py_InitializeFromc(&config); PyConfig_Clear(&config); } void tune_config(void) { PyConfig config; PyConfig_InitPython(&config); // Get a copy of the current configuration PyInterpreterState_GetConfigCopy(&config); // <== NEW API! // ... put your code to tune config ... // dummy example, current not possible in Python config.bytes_warnings = 1; // Reconfigure Python with the updated configuration PyInterpreterState_SetConfig(&config); // <=== NEW API! PyConfig_Clear(&config); } int main() { init_core(); tune_config(); // <=== THE USE CASE! _Py_InitializeMain(); return Py_RunMain(); } --------------------- In this example, tune_config() is implemented in C. But later, it will be possible to convert the configuration to a Python dict and run Python code to tune the configuration. The PEP 587 added a "Multi-Phase Initialization Private Provisional API": * PyConfig._init_main = 0 * _Py_InitializeMain() https://docs.python.org/dev/c-api/init_config.html#multi-phase-initialization-private-provisional-api ---------- components: C API messages: 380327 nosy: vstinner priority: normal severity: normal status: open title: [C API] Add PyInterpreterState_SetConfig(): reconfigure an interpreter versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 10:20:48 2020 From: report at bugs.python.org (Eryk Sun) Date: Wed, 04 Nov 2020 15:20:48 +0000 Subject: [New-bugs-announce] [issue42261] Windows legacy I/O mode mistakenly ignores the device encoding Message-ID: <1604503248.47.0.606925187106.issue42261@roundup.psfhosted.org> New submission from Eryk Sun : In Python 3.8+, legacy standard I/O mode uses the process code page from GetACP instead of the correct device encoding from GetConsoleCP and GetConsoleOutputCP. For example: C:\>chcp 850 Active code page: 850 C:\>set PYTHONLEGACYWINDOWSSTDIO=1 C:\>py -3.7 -c "import sys; print(sys.stdin.encoding)" cp850 C:\>py -3.8 -c "import sys; print(sys.stdin.encoding)" cp1252 C:\>py -3.9 -c "import sys; print(sys.stdin.encoding)" cp1252 This is based on config_init_stdio_encoding() in Python/initconfig.c, which sets config->stdio_encoding via config_get_locale_encoding(). Cannot config->stdio_encoding be set to NULL for default behavior? Computing this ahead of time would require separate encodings config->stdin_encoding, config->stdout_encoding, and config->stderr_encoding. And _Py_device_encoding would have to be duplicated as something like config_get_device_encoding(PyConfig *config, int fd, wchar_t **device_encoding). ---------- components: IO, Interpreter Core, Windows messages: 380329 nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Windows legacy I/O mode mistakenly ignores the device encoding type: behavior versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 11:20:34 2020 From: report at bugs.python.org (STINNER Victor) Date: Wed, 04 Nov 2020 16:20:34 +0000 Subject: [New-bugs-announce] [issue42262] [C API] Add Py_NewRef() function to get a new strong reference to an object Message-ID: <1604506834.94.0.230929451807.issue42262@roundup.psfhosted.org> New submission from STINNER Victor : In C, the following pattern (A) is very common: Py_INCREF(sysdict); interp->sysdict = sysdict; * (1) Increment the reference counter * (2) Store a reference to the object somewhere Similar pattern (B) using return: Py_INCREF(temp); return temp; The problem in these patterns is that the object has to be written twice. I propose to add a simple new Py_NewRef() function which returns a new strong reference. In short, it's just: static inline PyObject* Py_NewRef(PyObject *obj) { Py_INCREF(obj); return obj; } (The actual implementation is just a little bit more complex, to also export it as a regular function.) Pattern (A) becomes: interp->sysdict = Py_NewRef(sysdict); Pattern (B) becomes: return Py_NewRef(temp); Py_NewRef() might help to prepare a C extension to be converted to HPy which uses a HPy_Dup() function. HPy_Dup() is different than "Py_INCREF(obj), obj" for subtle reasons. I let you dig into HPy documentation for the rationale: https://hpy.readthedocs.io/en/latest/api.html#handles Even if you ignore HPy, Py_NewRef() avoids to repeat the object variable, and so makes the code simpler. Simple example: -#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None +#define Py_RETURN_NONE return Py_NewRef(Py_None) ---------- components: C API messages: 380337 nosy: vstinner priority: normal severity: normal status: open title: [C API] Add Py_NewRef() function to get a new strong reference to an object versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 14:42:45 2020 From: report at bugs.python.org (Jason R. Coombs) Date: Wed, 04 Nov 2020 19:42:45 +0000 Subject: [New-bugs-announce] [issue42263] Removing thread reference in thread results in leaked reference Message-ID: <1604518965.9.0.468423053621.issue42263@roundup.psfhosted.org> New submission from Jason R. Coombs : In issue37193, I'd worked on an implementation in which a thread reference would be removed as the thread was closing, but this led to a memory leak caught by the buildbots (https://bugs.python.org/issue37193#msg380172). As I tracked down the issue in GH-23127, I discovered that removing the reference to the thread from within the thread triggered the reference leak detection. I've distilled that behavior into its own test which fails on master: ``` cpython master $ git diff diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index e0e5406ac2..2b4924d4d0 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -443,6 +443,15 @@ def _run(self, other_ref, yet_another): msg=('%d references still around' % sys.getrefcount(weak_raising_cyclic_object()))) + def test_remove_thread_ref_in_thread(self): + def remove_ref(): + threads[:] = [] + + threads = [ + threading.Thread(target=remove_ref), + ] + threads[0].start() + def test_old_threading_api(self): # Just a quick sanity check to make sure the old method names are # still present ``` Running that test with refcount checks leads to this failure: ``` cpython master $ ./python.exe Tools/scripts/run_tests.py -R 3:3 test.test_threading -m test_remove_thread_ref_in_thread /Users/jaraco/code/public/cpython/python.exe -u -W default -bb -E -m test -r -w -j 0 -u all,-largefile,-audio,-gui -R 3:3 test.test_threading -m test_remove_thread_ref_in_thread Using random seed 8650903 0:00:00 load avg: 1.76 Run tests in parallel using 10 child processes 0:00:01 load avg: 1.78 [1/1/1] test.test_threading failed == Tests result: FAILURE == 1 test failed: test.test_threading 0:00:01 load avg: 1.78 0:00:01 load avg: 1.78 Re-running failed tests in verbose mode 0:00:01 load avg: 1.78 Re-running test.test_threading in verbose mode beginning 6 repetitions 123456 ...... test.test_threading leaked [1, 1, 1] references, sum=3 test.test_threading leaked [3, 1, 1] memory blocks, sum=5 beginning 6 repetitions 123456 test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.001s OK .test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.001s OK .test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.001s OK .test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.001s OK .test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.001s OK .test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.001s OK . test.test_threading leaked [1, 1, 1] references, sum=3 test.test_threading leaked [1, 1, 1] memory blocks, sum=3 1 test failed again: test.test_threading == Tests result: FAILURE then FAILURE == 1 test failed: test.test_threading 1 re-run test: test.test_threading Total duration: 2.0 sec Tests result: FAILURE then FAILURE ``` Is that behavior by design? Is it simply not possible to remove a reference to a thread from within the thread? ---------- messages: 380353 nosy: jaraco priority: normal severity: normal status: open title: Removing thread reference in thread results in leaked reference versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 16:24:26 2020 From: report at bugs.python.org (Erlend Egeberg Aasland) Date: Wed, 04 Nov 2020 21:24:26 +0000 Subject: [New-bugs-announce] [issue42264] Deprecate or remove sqlite3.OptimizedUnicode Message-ID: <1604525066.61.0.869187561497.issue42264@roundup.psfhosted.org> New submission from Erlend Egeberg Aasland : Ref. discussion on GH-23148: https://github.com/python/cpython/pull/23148#discussion_r517536083 OptimizedUnicode was obsoleted and undocumented in Python 3.3 (see commit 86dc732f1f). Suggesting to either deprecate OptimizedUnicode in 3.10 and remove it in 3.11, or just simply remove it in 3.10. Relevant history: 48b13f0427 (undoc) bc35bebb45 (clean up and undoc, closing bpo-13921) (Pablo, adding you to nosy since you're the release manager; hope that's ok) ---------- components: Library (Lib) messages: 380363 nosy: berker.peksag, erlendaasland, pablogsal, vstinner priority: normal severity: normal status: open title: Deprecate or remove sqlite3.OptimizedUnicode versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 16:35:07 2020 From: report at bugs.python.org (Anatoliy Platonov) Date: Wed, 04 Nov 2020 21:35:07 +0000 Subject: [New-bugs-announce] [issue42265] Remove binhex module following PEP-594 Message-ID: <1604525707.18.0.925908508614.issue42265@roundup.psfhosted.org> New submission from Anatoliy Platonov : https://www.python.org/dev/peps/pep-0594/#id163 ---------- components: Library (Lib), Tests messages: 380365 nosy: p4m-dev priority: normal severity: normal status: open title: Remove binhex module following PEP-594 versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 16:56:10 2020 From: report at bugs.python.org (Kevin Modzelewski) Date: Wed, 04 Nov 2020 21:56:10 +0000 Subject: [New-bugs-announce] [issue42266] LOAD_ATTR cache does not fully replicate PyObject_GetAttr behavior Message-ID: <1604526970.3.0.249891884923.issue42266@roundup.psfhosted.org> New submission from Kevin Modzelewski : The problem is that the descriptor-ness of a type-level attribute is only checked at opcache-set time, not at opcache-hit time. $ python3.8 test.py 2 $ ./python --version Python 3.10.0a2+ $ git rev-parse --short HEAD 789359f47c $ ./python test.py 1 ---------- components: Interpreter Core files: test.py messages: 380370 nosy: Kevin Modzelewski, pablogsal priority: normal severity: normal status: open title: LOAD_ATTR cache does not fully replicate PyObject_GetAttr behavior type: behavior versions: Python 3.10 Added file: https://bugs.python.org/file49568/test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 18:17:09 2020 From: report at bugs.python.org (=?utf-8?q?Axel_Grull=C3=B3n?=) Date: Wed, 04 Nov 2020 23:17:09 +0000 Subject: [New-bugs-announce] [issue42267] Python 3.9 broken installer Message-ID: <1604531829.54.0.433305713685.issue42267@roundup.psfhosted.org> New submission from Axel Grull?n : Initially the Python 3.9 installer worked perfectly, I had every tool at my disposal and every component installed. After I tried installing discord.py an error was shown and it was about certain components that were missing. To my ignorance I uninstalled Python 3.9 and deleted every key and sub-key related to it thinking it would allow me to do a fresh install of Python 3.9 and fix the issue. What I get now is a disastrous incomplete installation when I try to install this Python version, a programmer with knowledge on it told me that no matter the registry keys deleted the installer should be able to install the version without issues. Without further ado, this is the error I get: Python path configuration: PYTHONHOME = (not set) PYTHONPATH = (not set) program name = 'python' isolated = 0 environment = 1 user site = 1 import site = 1 sys._base_executable = 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39\\python.exe' sys.base_prefix = '' sys.base_exec_prefix = '' sys.platlibdir = 'lib' sys.executable = 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39\\python.exe' sys.prefix = '' sys.exec_prefix = '' sys.path = [ 'C:\\WINDOWS\\SYSTEM32\\python39.zip', 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39\\Lib\\', 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39\\DLLs\\', 'C:\\Program Files\\Python39\\Lib\\', 'C:\\Program Files\\Python39\\DLLs\\', 'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python39', ] Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Python runtime state: core initialized ModuleNotFoundError: No module named 'encodings' Current thread 0x00002254 (most recent call first): But of course I get such error because a plethora of essential files are missing. C:\Users\user\AppData\Local\Programs\Python\Python39>tree /f Folder PATH listing Volume serial number is 8820-2829 C:. ? LICENSE.txt ? NEWS.txt ? python.exe ? pythonw.exe ? vcruntime140.dll ? vcruntime140_1.dll ? ????DLLs ? py.ico ? pyc.ico ? pyd.ico ? tcl86t.dll ? tk86t.dll ? _tkinter.pyd ? ????Doc ? python390.chm ? ????Lib ? ????idlelib ? ? ? autocomplete.py ? ? ? autocomplete_w.py ? ? ? autoexpand.py ? ? ? browser.py ? ? ? calltip.py ? ? ? calltip_w.py ? ? ? ChangeLog ? ? ? codecontext.py ? ? ? colorizer.py ? ? ? config-extensions.def ? ? ? config-highlight.def ? ? ? config-keys.def ? ? ? config-main.def ? ? ? config.py ? ? ? configdialog.py ? ? ? config_key.py ? ? ? CREDITS.txt ? ? ? debugger.py ? ? ? debugger_r.py ? ? ? debugobj.py ? ? ? debugobj_r.py ? ? ? delegator.py ? ? ? dynoption.py ? ? ? editor.py ? ? ? extend.txt ? ? ? filelist.py ? ? ? format.py ? ? ? grep.py ? ? ? help.html ? ? ? help.py ? ? ? help_about.py ? ? ? history.py ? ? ? HISTORY.txt ? ? ? hyperparser.py ? ? ? idle.bat ? ? ? idle.py ? ? ? idle.pyw ? ? ? iomenu.py ? ? ? macosx.py ? ? ? mainmenu.py ? ? ? multicall.py ? ? ? NEWS.txt ? ? ? NEWS2x.txt ? ? ? outwin.py ? ? ? parenmatch.py ? ? ? pathbrowser.py ? ? ? percolator.py ? ? ? pyparse.py ? ? ? pyshell.py ? ? ? query.py ? ? ? README.txt ? ? ? redirector.py ? ? ? replace.py ? ? ? rpc.py ? ? ? run.py ? ? ? runscript.py ? ? ? scrolledlist.py ? ? ? search.py ? ? ? searchbase.py ? ? ? searchengine.py ? ? ? sidebar.py ? ? ? squeezer.py ? ? ? stackviewer.py ? ? ? statusbar.py ? ? ? textview.py ? ? ? TODO.txt ? ? ? tooltip.py ? ? ? tree.py ? ? ? undo.py ? ? ? window.py ? ? ? zoomheight.py ? ? ? zzdummy.py ? ? ? __init__.py ? ? ? __main__.py ? ? ? ? ? ????Icons ? ? ? folder.gif ? ? ? idle.ico ? ? ? idle_16.gif ? ? ? idle_16.png ? ? ? idle_256.png ? ? ? idle_32.gif ? ? ? idle_32.png ? ? ? idle_48.gif ? ? ? idle_48.png ? ? ? minusnode.gif ? ? ? openfolder.gif ? ? ? plusnode.gif ? ? ? python.gif ? ? ? README.txt ? ? ? tk.gif ? ? ? ? ? ????idle_test ? ? ? ? htest.py ? ? ? ? mock_idle.py ? ? ? ? mock_tk.py ? ? ? ? README.txt ? ? ? ? template.py ? ? ? ? test_autocomplete.py ? ? ? ? test_autocomplete_w.py ? ? ? ? test_autoexpand.py ? ? ? ? test_browser.py ? ? ? ? test_calltip.py ? ? ? ? test_calltip_w.py ? ? ? ? test_codecontext.py ? ? ? ? test_colorizer.py ? ? ? ? test_config.py ? ? ? ? test_configdialog.py ? ? ? ? test_config_key.py ? ? ? ? test_debugger.py ? ? ? ? test_debugger_r.py ? ? ? ? test_debugobj.py ? ? ? ? test_debugobj_r.py ? ? ? ? test_delegator.py ? ? ? ? test_editmenu.py ? ? ? ? test_editor.py ? ? ? ? test_filelist.py ? ? ? ? test_format.py ? ? ? ? test_grep.py ? ? ? ? test_help.py ? ? ? ? test_help_about.py ? ? ? ? test_history.py ? ? ? ? test_hyperparser.py ? ? ? ? test_iomenu.py ? ? ? ? test_macosx.py ? ? ? ? test_mainmenu.py ? ? ? ? test_multicall.py ? ? ? ? test_outwin.py ? ? ? ? test_parenmatch.py ? ? ? ? test_pathbrowser.py ? ? ? ? test_percolator.py ? ? ? ? test_pyparse.py ? ? ? ? test_pyshell.py ? ? ? ? test_query.py ? ? ? ? test_redirector.py ? ? ? ? test_replace.py ? ? ? ? test_rpc.py ? ? ? ? test_run.py ? ? ? ? test_runscript.py ? ? ? ? test_scrolledlist.py ? ? ? ? test_search.py ? ? ? ? test_searchbase.py ? ? ? ? test_searchengine.py ? ? ? ? test_sidebar.py ? ? ? ? test_squeezer.py ? ? ? ? test_stackviewer.py ? ? ? ? test_statusbar.py ? ? ? ? test_text.py ? ? ? ? test_textview.py ? ? ? ? test_tooltip.py ? ? ? ? test_tree.py ? ? ? ? test_undo.py ? ? ? ? test_warning.py ? ? ? ? test_window.py ? ? ? ? test_zoomheight.py ? ? ? ? __init__.py ? ? ? ? ? ? ? ????__pycache__ ? ? ????__pycache__ ? ????tkinter ? ? ? colorchooser.py ? ? ? commondialog.py ? ? ? constants.py ? ? ? dialog.py ? ? ? dnd.py ? ? ? filedialog.py ? ? ? font.py ? ? ? messagebox.py ? ? ? scrolledtext.py ? ? ? simpledialog.py ? ? ? tix.py ? ? ? ttk.py ? ? ? __init__.py ? ? ? __main__.py ? ? ? ? ? ????test ? ? ? ? README ? ? ? ? runtktests.py ? ? ? ? support.py ? ? ? ? widget_tests.py ? ? ? ? __init__.py ? ? ? ? ? ? ? ????test_tkinter ? ? ? ? ? test_font.py ? ? ? ? ? test_geometry_managers.py ? ? ? ? ? test_images.py ? ? ? ? ? test_loadtk.py ? ? ? ? ? test_misc.py ? ? ? ? ? test_text.py ? ? ? ? ? test_variables.py ? ? ? ? ? test_widgets.py ? ? ? ? ? __init__.py ? ? ? ? ? ? ? ? ? ????__pycache__ ? ? ? ????test_ttk ? ? ? ? ? test_extensions.py ? ? ? ? ? test_functions.py ? ? ? ? ? test_style.py ? ? ? ? ? test_widgets.py ? ? ? ? ? __init__.py ? ? ? ? ? ? ? ? ? ????__pycache__ ? ? ? ????__pycache__ ? ? ????__pycache__ ? ????turtledemo ? ? bytedesign.py ? ? chaos.py ? ? clock.py ? ? colormixer.py ? ? forest.py ? ? fractalcurves.py ? ? lindenmayer.py ? ? minimal_hanoi.py ? ? nim.py ? ? paint.py ? ? peace.py ? ? penrose.py ? ? planet_and_moon.py ? ? rosette.py ? ? round_dance.py ? ? sorting_animate.py ? ? tree.py ? ? turtle.cfg ? ? two_canvases.py ? ? yinyang.py ? ? __init__.py ? ? __main__.py ? ? ? ????__pycache__ ????libs ? _tkinter.lib ? ????tcl ? tcl86t.lib ? tclConfig.sh ? tclooConfig.sh ? tclstub86.lib ? tk86t.lib ? tkstub86.lib ? ????dde1.4 ? pkgIndex.tcl ? tcldde14.dll ? ????nmake ? nmakehlp.c ? rules.vc ? targets.vc ? tcl.nmake ? ????reg1.3 ? pkgIndex.tcl ? tclreg13.dll ? ????tcl8 ? ????8.4 ? ? ? platform-1.0.14.tm ? ? ? ? ? ????platform ? ? shell-1.1.4.tm ? ? ? ????8.5 ? ? msgcat-1.6.1.tm ? ? tcltest-2.5.0.tm ? ? ? ????8.6 ? http-2.9.0.tm ? ????tcl8.6 ? ? auto.tcl ? ? clock.tcl ? ? history.tcl ? ? init.tcl ? ? package.tcl ? ? parray.tcl ? ? safe.tcl ? ? tclIndex ? ? tm.tcl ? ? word.tcl ? ? ? ????encoding ? ? ascii.enc ? ? big5.enc ? ? cp1250.enc ? ? cp1251.enc ? ? cp1252.enc ? ? cp1253.enc ? ? cp1254.enc ? ? cp1255.enc ? ? cp1256.enc ? ? cp1257.enc ? ? cp1258.enc ? ? cp437.enc ? ? cp737.enc ? ? cp775.enc ? ? cp850.enc ? ? cp852.enc ? ? cp855.enc ? ? cp857.enc ? ? cp860.enc ? ? cp861.enc ? ? cp862.enc ? ? cp863.enc ? ? cp864.enc ? ? cp865.enc ? ? cp866.enc ? ? cp869.enc ? ? cp874.enc ? ? cp932.enc ? ? cp936.enc ? ? cp949.enc ? ? cp950.enc ? ? dingbats.enc ? ? ebcdic.enc ? ? euc-cn.enc ? ? euc-jp.enc ? ? euc-kr.enc ? ? gb12345.enc ? ? gb1988.enc ? ? gb2312-raw.enc ? ? gb2312.enc ? ? iso2022-jp.enc ? ? iso2022-kr.enc ? ? iso2022.enc ? ? iso8859-1.enc ? ? iso8859-10.enc ? ? iso8859-13.enc ? ? iso8859-14.enc ? ? iso8859-15.enc ? ? iso8859-16.enc ? ? iso8859-2.enc ? ? iso8859-3.enc ? ? iso8859-4.enc ? ? iso8859-5.enc ? ? iso8859-6.enc ? ? iso8859-7.enc ? ? iso8859-8.enc ? ? iso8859-9.enc ? ? jis0201.enc ? ? jis0208.enc ? ? jis0212.enc ? ? koi8-r.enc ? ? koi8-u.enc ? ? ksc5601.enc ? ? macCentEuro.enc ? ? macCroatian.enc ? ? macCyrillic.enc ? ? macDingbats.enc ? ? macGreek.enc ? ? macIceland.enc ? ? macJapan.enc ? ? macRoman.enc ? ? macRomania.enc ? ? macThai.enc ? ? macTurkish.enc ? ? macUkraine.enc ? ? shiftjis.enc ? ? symbol.enc ? ? tis-620.enc ? ? ? ????http1.0 ? ? http.tcl ? ? pkgIndex.tcl ? ? ? ????msgs ? ? af.msg ? ? af_za.msg ? ? ar.msg ? ? ar_in.msg ? ? ar_jo.msg ? ? ar_lb.msg ? ? ar_sy.msg ? ? be.msg ? ? bg.msg ? ? bn.msg ? ? bn_in.msg ? ? ca.msg ? ? cs.msg ? ? da.msg ? ? de.msg ? ? de_at.msg ? ? de_be.msg ? ? el.msg ? ? en_au.msg ? ? en_be.msg ? ? en_bw.msg ? ? en_ca.msg ? ? en_gb.msg ? ? en_hk.msg ? ? en_ie.msg ? ? en_in.msg ? ? en_nz.msg ? ? en_ph.msg ? ? en_sg.msg ? ? en_za.msg ? ? en_zw.msg ? ? eo.msg ? ? es.msg ? ? es_ar.msg ? ? es_bo.msg ? ? es_cl.msg ? ? es_co.msg ? ? es_cr.msg ? ? es_do.msg ? ? es_ec.msg ? ? es_gt.msg ? ? es_hn.msg ? ? es_mx.msg ? ? es_ni.msg ? ? es_pa.msg ? ? es_pe.msg ? ? es_pr.msg ? ? es_py.msg ? ? es_sv.msg ? ? es_uy.msg ? ? es_ve.msg ? ? et.msg ? ? eu.msg ? ? eu_es.msg ? ? fa.msg ? ? fa_in.msg ? ? fa_ir.msg ? ? fi.msg ? ? fo.msg ? ? fo_fo.msg ? ? fr.msg ? ? fr_be.msg ? ? fr_ca.msg ? ? fr_ch.msg ? ? ga.msg ? ? ga_ie.msg ? ? gl.msg ? ? gl_es.msg ? ? gv.msg ? ? gv_gb.msg ? ? he.msg ? ? hi.msg ? ? hi_in.msg ? ? hr.msg ? ? hu.msg ? ? id.msg ? ? id_id.msg ? ? is.msg ? ? it.msg ? ? it_ch.msg ? ? ja.msg ? ? kl.msg ? ? kl_gl.msg ? ? ko.msg ? ? kok.msg ? ? kok_in.msg ? ? ko_kr.msg ? ? kw.msg ? ? kw_gb.msg ? ? lt.msg ? ? lv.msg ? ? mk.msg ? ? mr.msg ? ? mr_in.msg ? ? ms.msg ? ? ms_my.msg ? ? mt.msg ? ? nb.msg ? ? nl.msg ? ? nl_be.msg ? ? nn.msg ? ? pl.msg ? ? pt.msg ? ? pt_br.msg ? ? ro.msg ? ? ru.msg ? ? ru_ua.msg ? ? sh.msg ? ? sk.msg ? ? sl.msg ? ? sq.msg ? ? sr.msg ? ? sv.msg ? ? sw.msg ? ? ta.msg ? ? ta_in.msg ? ? te.msg ? ? te_in.msg ? ? th.msg ? ? tr.msg ? ? uk.msg ? ? vi.msg ? ? zh.msg ? ? zh_cn.msg ? ? zh_hk.msg ? ? zh_sg.msg ? ? zh_tw.msg ? ? ? ????opt0.4 ? ? optparse.tcl ? ? pkgIndex.tcl ? ? ? ????tzdata ? ? CET ? ? CST6CDT ? ? Cuba ? ? EET ? ? Egypt ? ? Eire ? ? EST ? ? EST5EDT ? ? GB ? ? GB-Eire ? ? GMT ? ? GMT+0 ? ? GMT-0 ? ? GMT0 ? ? Greenwich ? ? Hongkong ? ? HST ? ? Iceland ? ? Iran ? ? Israel ? ? Jamaica ? ? Japan ? ? Kwajalein ? ? Libya ? ? MET ? ? MST ? ? MST7MDT ? ? Navajo ? ? NZ ? ? NZ-CHAT ? ? Poland ? ? Portugal ? ? PRC ? ? PST8PDT ? ? ROC ? ? ROK ? ? Singapore ? ? Turkey ? ? UCT ? ? Universal ? ? UTC ? ? W-SU ? ? WET ? ? Zulu ? ? ? ????Africa ? ? Abidjan ? ? Accra ? ? Addis_Ababa ? ? Algiers ? ? Asmara ? ? Asmera ? ? Bamako ? ? Bangui ? ? Banjul ? ? Bissau ? ? Blantyre ? ? Brazzaville ? ? Bujumbura ? ? Cairo ? ? Casablanca ? ? Ceuta ? ? Conakry ? ? Dakar ? ? Dar_es_Salaam ? ? Djibouti ? ? Douala ? ? El_Aaiun ? ? Freetown ? ? Gaborone ? ? Harare ? ? Johannesburg ? ? Juba ? ? Kampala ? ? Khartoum ? ? Kigali ? ? Kinshasa ? ? Lagos ? ? Libreville ? ? Lome ? ? Luanda ? ? Lubumbashi ? ? Lusaka ? ? Malabo ? ? Maputo ? ? Maseru ? ? Mbabane ? ? Mogadishu ? ? Monrovia ? ? Nairobi ? ? Ndjamena ? ? Niamey ? ? Nouakchott ? ? Ouagadougou ? ? Porto-Novo ? ? Sao_Tome ? ? Timbuktu ? ? Tripoli ? ? Tunis ? ? Windhoek ? ? ? ????America ? ? ? Adak ? ? ? Anchorage ? ? ? Anguilla ? ? ? Antigua ? ? ? Araguaina ? ? ? Aruba ? ? ? Asuncion ? ? ? Atikokan ? ? ? Atka ? ? ? Bahia ? ? ? Bahia_Banderas ? ? ? Barbados ? ? ? Belem ? ? ? Belize ? ? ? Blanc-Sablon ? ? ? Boa_Vista ? ? ? Bogota ? ? ? Boise ? ? ? Buenos_Aires ? ? ? Cambridge_Bay ? ? ? Campo_Grande ? ? ? Cancun ? ? ? Caracas ? ? ? Catamarca ? ? ? Cayenne ? ? ? Cayman ? ? ? Chicago ? ? ? Chihuahua ? ? ? Coral_Harbour ? ? ? Cordoba ? ? ? Costa_Rica ? ? ? Creston ? ? ? Cuiaba ? ? ? Curacao ? ? ? Danmarkshavn ? ? ? Dawson ? ? ? Dawson_Creek ? ? ? Denver ? ? ? Detroit ? ? ? Dominica ? ? ? Edmonton ? ? ? Eirunepe ? ? ? El_Salvador ? ? ? Ensenada ? ? ? Fortaleza ? ? ? Fort_Nelson ? ? ? Fort_Wayne ? ? ? Glace_Bay ? ? ? Godthab ? ? ? Goose_Bay ? ? ? Grand_Turk ? ? ? Grenada ? ? ? Guadeloupe ? ? ? Guatemala ? ? ? Guayaquil ? ? ? Guyana ? ? ? Halifax ? ? ? Havana ? ? ? Hermosillo ? ? ? Indianapolis ? ? ? Inuvik ? ? ? Iqaluit ? ? ? Jamaica ? ? ? Jujuy ? ? ? Juneau ? ? ? Knox_IN ? ? ? Kralendijk ? ? ? La_Paz ? ? ? Lima ? ? ? Los_Angeles ? ? ? Louisville ? ? ? Lower_Princes ? ? ? Maceio ? ? ? Managua ? ? ? Manaus ? ? ? Marigot ? ? ? Martinique ? ? ? Matamoros ? ? ? Mazatlan ? ? ? Mendoza ? ? ? Menominee ? ? ? Merida ? ? ? Metlakatla ? ? ? Mexico_City ? ? ? Miquelon ? ? ? Moncton ? ? ? Monterrey ? ? ? Montevideo ? ? ? Montreal ? ? ? Montserrat ? ? ? Nassau ? ? ? New_York ? ? ? Nipigon ? ? ? Nome ? ? ? Noronha ? ? ? Ojinaga ? ? ? Panama ? ? ? Pangnirtung ? ? ? Paramaribo ? ? ? Phoenix ? ? ? Port-au-Prince ? ? ? Porto_Acre ? ? ? Porto_Velho ? ? ? Port_of_Spain ? ? ? Puerto_Rico ? ? ? Punta_Arenas ? ? ? Rainy_River ? ? ? Rankin_Inlet ? ? ? Recife ? ? ? Regina ? ? ? Resolute ? ? ? Rio_Branco ? ? ? Rosario ? ? ? Santarem ? ? ? Santa_Isabel ? ? ? Santiago ? ? ? Santo_Domingo ? ? ? Sao_Paulo ? ? ? Scoresbysund ? ? ? Shiprock ? ? ? Sitka ? ? ? St_Barthelemy ? ? ? St_Johns ? ? ? St_Kitts ? ? ? St_Lucia ? ? ? St_Thomas ? ? ? St_Vincent ? ? ? Swift_Current ? ? ? Tegucigalpa ? ? ? Thule ? ? ? Thunder_Bay ? ? ? Tijuana ? ? ? Toronto ? ? ? Tortola ? ? ? Vancouver ? ? ? Virgin ? ? ? Whitehorse ? ? ? Winnipeg ? ? ? Yakutat ? ? ? Yellowknife ? ? ? ? ? ????Argentina ? ? ? Buenos_Aires ? ? ? Catamarca ? ? ? ComodRivadavia ? ? ? Cordoba ? ? ? Jujuy ? ? ? La_Rioja ? ? ? Mendoza ? ? ? Rio_Gallegos ? ? ? Salta ? ? ? San_Juan ? ? ? San_Luis ? ? ? Tucuman ? ? ? Ushuaia ? ? ? ? ? ????Indiana ? ? ? Indianapolis ? ? ? Knox ? ? ? Marengo ? ? ? Petersburg ? ? ? Tell_City ? ? ? Vevay ? ? ? Vincennes ? ? ? Winamac ? ? ? ? ? ????Kentucky ? ? ? Louisville ? ? ? Monticello ? ? ? ? ? ????North_Dakota ? ? Beulah ? ? Center ? ? New_Salem ? ? ? ????Antarctica ? ? Casey ? ? Davis ? ? DumontDUrville ? ? Macquarie ? ? Mawson ? ? McMurdo ? ? Palmer ? ? Rothera ? ? South_Pole ? ? Syowa ? ? Troll ? ? Vostok ? ? ? ????Arctic ? ? Longyearbyen ? ? ? ????Asia ? ? Aden ? ? Almaty ? ? Amman ? ? Anadyr ? ? Aqtau ? ? Aqtobe ? ? Ashgabat ? ? Ashkhabad ? ? Atyrau ? ? Baghdad ? ? Bahrain ? ? Baku ? ? Bangkok ? ? Barnaul ? ? Beirut ? ? Bishkek ? ? Brunei ? ? Calcutta ? ? Chita ? ? Choibalsan ? ? Chongqing ? ? Chungking ? ? Colombo ? ? Dacca ? ? Damascus ? ? Dhaka ? ? Dili ? ? Dubai ? ? Dushanbe ? ? Famagusta ? ? Gaza ? ? Harbin ? ? Hebron ? ? Hong_Kong ? ? Hovd ? ? Ho_Chi_Minh ? ? Irkutsk ? ? Istanbul ? ? Jakarta ? ? Jayapura ? ? Jerusalem ? ? Kabul ? ? Kamchatka ? ? Karachi ? ? Kashgar ? ? Kathmandu ? ? Katmandu ? ? Khandyga ? ? Kolkata ? ? Krasnoyarsk ? ? Kuala_Lumpur ? ? Kuching ? ? Kuwait ? ? Macao ? ? Macau ? ? Magadan ? ? Makassar ? ? Manila ? ? Muscat ? ? Nicosia ? ? Novokuznetsk ? ? Novosibirsk ? ? Omsk ? ? Oral ? ? Phnom_Penh ? ? Pontianak ? ? Pyongyang ? ? Qatar ? ? Qyzylorda ? ? Rangoon ? ? Riyadh ? ? Saigon ? ? Sakhalin ? ? Samarkand ? ? Seoul ? ? Shanghai ? ? Singapore ? ? Srednekolymsk ? ? Taipei ? ? Tashkent ? ? Tbilisi ? ? Tehran ? ? Tel_Aviv ? ? Thimbu ? ? Thimphu ? ? Tokyo ? ? Tomsk ? ? Ujung_Pandang ? ? Ulaanbaatar ? ? Ulan_Bator ? ? Urumqi ? ? Ust-Nera ? ? Vientiane ? ? Vladivostok ? ? Yakutsk ? ? Yangon ? ? Yekaterinburg ? ? Yerevan ? ? ? ????Atlantic ? ? Azores ? ? Bermuda ? ? Canary ? ? Cape_Verde ? ? Faeroe ? ? Faroe ? ? Jan_Mayen ? ? Madeira ? ? Reykjavik ? ? South_Georgia ? ? Stanley ? ? St_Helena ? ? ? ????Australia ? ? ACT ? ? Adelaide ? ? Brisbane ? ? Broken_Hill ? ? Canberra ? ? Currie ? ? Darwin ? ? Eucla ? ? Hobart ? ? LHI ? ? Lindeman ? ? Lord_Howe ? ? Melbourne ? ? North ? ? NSW ? ? Perth ? ? Queensland ? ? South ? ? Sydney ? ? Tasmania ? ? Victoria ? ? West ? ? Yancowinna ? ? ? ????Brazil ? ? Acre ? ? DeNoronha ? ? East ? ? West ? ? ? ????Canada ? ? Atlantic ? ? Central ? ? East-Saskatchewan ? ? Eastern ? ? Mountain ? ? Newfoundland ? ? Pacific ? ? Saskatchewan ? ? Yukon ? ? ? ????Chile ? ? Continental ? ? EasterIsland ? ? ? ????Etc ? ? GMT ? ? GMT+0 ? ? GMT+1 ? ? GMT+10 ? ? GMT+11 ? ? GMT+12 ? ? GMT+2 ? ? GMT+3 ? ? GMT+4 ? ? GMT+5 ? ? GMT+6 ? ? GMT+7 ? ? GMT+8 ? ? GMT+9 ? ? GMT-0 ? ? GMT-1 ? ? GMT-10 ? ? GMT-11 ? ? GMT-12 ? ? GMT-13 ? ? GMT-14 ? ? GMT-2 ? ? GMT-3 ? ? GMT-4 ? ? GMT-5 ? ? GMT-6 ? ? GMT-7 ? ? GMT-8 ? ? GMT-9 ? ? GMT0 ? ? Greenwich ? ? UCT ? ? Universal ? ? UTC ? ? Zulu ? ? ? ????Europe ? ? Amsterdam ? ? Andorra ? ? Astrakhan ? ? Athens ? ? Belfast ? ? Belgrade ? ? Berlin ? ? Bratislava ? ? Brussels ? ? Bucharest ? ? Budapest ? ? Busingen ? ? Chisinau ? ? Copenhagen ? ? Dublin ? ? Gibraltar ? ? Guernsey ? ? Helsinki ? ? Isle_of_Man ? ? Istanbul ? ? Jersey ? ? Kaliningrad ? ? Kiev ? ? Kirov ? ? Lisbon ? ? Ljubljana ? ? London ? ? Luxembourg ? ? Madrid ? ? Malta ? ? Mariehamn ? ? Minsk ? ? Monaco ? ? Moscow ? ? Nicosia ? ? Oslo ? ? Paris ? ? Podgorica ? ? Prague ? ? Riga ? ? Rome ? ? Samara ? ? San_Marino ? ? Sarajevo ? ? Saratov ? ? Simferopol ? ? Skopje ? ? Sofia ? ? Stockholm ? ? Tallinn ? ? Tirane ? ? Tiraspol ? ? Ulyanovsk ? ? Uzhgorod ? ? Vaduz ? ? Vatican ? ? Vienna ? ? Vilnius ? ? Volgograd ? ? Warsaw ? ? Zagreb ? ? Zaporozhye ? ? Zurich ? ? ? ????Indian ? ? Antananarivo ? ? Chagos ? ? Christmas ? ? Cocos ? ? Comoro ? ? Kerguelen ? ? Mahe ? ? Maldives ? ? Mauritius ? ? Mayotte ? ? Reunion ? ? ? ????Mexico ? ? BajaNorte ? ? BajaSur ? ? General ? ? ? ????Pacific ? ? Apia ? ? Auckland ? ? Bougainville ? ? Chatham ? ? Chuuk ? ? Easter ? ? Efate ? ? Enderbury ? ? Fakaofo ? ? Fiji ? ? Funafuti ? ? Galapagos ? ? Gambier ? ? Guadalcanal ? ? Guam ? ? Honolulu ? ? Johnston ? ? Kiritimati ? ? Kosrae ? ? Kwajalein ? ? Majuro ? ? Marquesas ? ? Midway ? ? Nauru ? ? Niue ? ? Norfolk ? ? Noumea ? ? Pago_Pago ? ? Palau ? ? Pitcairn ? ? Pohnpei ? ? Ponape ? ? Port_Moresby ? ? Rarotonga ? ? Saipan ? ? Samoa ? ? Tahiti ? ? Tarawa ? ? Tongatapu ? ? Truk ? ? Wake ? ? Wallis ? ? Yap ? ? ? ????SystemV ? ? AST4 ? ? AST4ADT ? ? CST6 ? ? CST6CDT ? ? EST5 ? ? EST5EDT ? ? HST10 ? ? MST7 ? ? MST7MDT ? ? PST8 ? ? PST8PDT ? ? YST9 ? ? YST9YDT ? ? ? ????US ? Alaska ? Aleutian ? Arizona ? Central ? East-Indiana ? Eastern ? Hawaii ? Indiana-Starke ? Michigan ? Mountain ? Pacific ? Pacific-New ? Samoa ? ????tix8.4.3 ? ? Balloon.tcl ? ? BtnBox.tcl ? ? ChkList.tcl ? ? CObjView.tcl ? ? ComboBox.tcl ? ? Compat.tcl ? ? Console.tcl ? ? Control.tcl ? ? DefSchm.tcl ? ? DialogS.tcl ? ? DirBox.tcl ? ? DirDlg.tcl ? ? DirList.tcl ? ? DirTree.tcl ? ? DragDrop.tcl ? ? DtlList.tcl ? ? EFileBox.tcl ? ? EFileDlg.tcl ? ? Event.tcl ? ? FileBox.tcl ? ? FileCbx.tcl ? ? FileDlg.tcl ? ? FileEnt.tcl ? ? FloatEnt.tcl ? ? fs.tcl ? ? Grid.tcl ? ? HList.tcl ? ? HListDD.tcl ? ? IconView.tcl ? ? Init.tcl ? ? LabEntry.tcl ? ? LabFrame.tcl ? ? LabWidg.tcl ? ? ListNBk.tcl ? ? Makefile ? ? Meter.tcl ? ? MultView.tcl ? ? NoteBook.tcl ? ? OldUtil.tcl ? ? OptMenu.tcl ? ? PanedWin.tcl ? ? pkgIndex.tcl ? ? PopMenu.tcl ? ? Primitiv.tcl ? ? ResizeH.tcl ? ? Select.tcl ? ? SGrid.tcl ? ? Shell.tcl ? ? SHList.tcl ? ? SimpDlg.tcl ? ? SListBox.tcl ? ? StackWin.tcl ? ? StatBar.tcl ? ? StdBBox.tcl ? ? StdShell.tcl ? ? SText.tcl ? ? STList.tcl ? ? SWidget.tcl ? ? SWindow.tcl ? ? Tix.tcl ? ? tix84.dll ? ? tix84.lib ? ? TList.tcl ? ? Tree.tcl ? ? Utils.tcl ? ? Variable.tcl ? ? VResize.tcl ? ? VStack.tcl ? ? VTree.tcl ? ? WInfo.tcl ? ? ? ????bitmaps ? ? act_fold.gif ? ? act_fold.xbm ? ? act_fold.xpm ? ? balarrow.xbm ? ? cbxarrow.xbm ? ? ck_def.xbm ? ? ck_off.xbm ? ? ck_on.xbm ? ? cross.xbm ? ? decr.xbm ? ? drop.xbm ? ? file.gif ? ? file.xbm ? ? file.xpm ? ? folder.gif ? ? folder.xbm ? ? folder.xpm ? ? harddisk.xbm ? ? hourglas.mask ? ? hourglas.xbm ? ? incr.xbm ? ? info.gif ? ? info.xpm ? ? maximize.xbm ? ? minimize.xbm ? ? minus.gif ? ? minus.xbm ? ? minus.xpm ? ? minusarm.gif ? ? minusarm.xbm ? ? minusarm.xpm ? ? mktransgif.tcl ? ? network.xbm ? ? no_entry.gif ? ? no_entry.xpm ? ? openfile.xbm ? ? openfold.gif ? ? openfold.xbm ? ? openfold.xpm ? ? plus.gif ? ? plus.xbm ? ? plus.xpm ? ? plusarm.gif ? ? plusarm.xbm ? ? plusarm.xpm ? ? resize1.xbm ? ? resize2.xbm ? ? restore.xbm ? ? srcfile.gif ? ? srcfile.xbm ? ? srcfile.xpm ? ? system.xbm ? ? textfile.gif ? ? textfile.xbm ? ? textfile.xpm ? ? tick.xbm ? ? warning.gif ? ? warning.xpm ? ? ? ????demos ? ? ? MkChoose.tcl ? ? ? MkDirLis.tcl ? ? ? MkSample.tcl ? ? ? MkScroll.tcl ? ? ? tclIndex ? ? ? tixwidgets.tcl ? ? ? widget ? ? ? ? ? ????bitmaps ? ? ? about.xpm ? ? ? bold.xbm ? ? ? capital.xbm ? ? ? centerj.xbm ? ? ? code.xpm ? ? ? combobox.xbm ? ? ? combobox.xpm ? ? ? drivea.xbm ? ? ? drivea.xpm ? ? ? exit.xpm ? ? ? filebox.xbm ? ? ? filebox.xpm ? ? ? harddisk.xbm ? ? ? harddisk.xpm ? ? ? italic.xbm ? ? ? justify.xbm ? ? ? leftj.xbm ? ? ? netw.xbm ? ? ? netw.xpm ? ? ? network.xbm ? ? ? network.xpm ? ? ? optmenu.xpm ? ? ? rightj.xbm ? ? ? select.xpm ? ? ? tix.gif ? ? ? underlin.xbm ? ? ? ? ? ????samples ? ? AllSampl.tcl ? ? ArrowBtn.tcl ? ? Balloon.tcl ? ? BtnBox.tcl ? ? ChkList.tcl ? ? CmpImg.tcl ? ? CmpImg1.tcl ? ? CmpImg2.tcl ? ? CmpImg3.tcl ? ? CmpImg4.tcl ? ? CObjView.tcl ? ? ComboBox.tcl ? ? Control.tcl ? ? DirDlg.tcl ? ? DirList.tcl ? ? DirTree.tcl ? ? DragDrop.tcl ? ? DynTree.tcl ? ? EditGrid.tcl ? ? EFileDlg.tcl ? ? FileDlg.tcl ? ? FileEnt.tcl ? ? HList1.tcl ? ? LabEntry.tcl ? ? LabFrame.tcl ? ? ListNBK.tcl ? ? Meter.tcl ? ? NoteBook.tcl ? ? OptMenu.tcl ? ? PanedWin.tcl ? ? PopMenu.tcl ? ? Sample.tcl ? ? Select.tcl ? ? SGrid0.tcl ? ? SGrid1.tcl ? ? SHList.tcl ? ? SHList2.tcl ? ? SListBox.tcl ? ? StdBBox.tcl ? ? SText.tcl ? ? STList1.tcl ? ? STList2.tcl ? ? STList3.tcl ? ? SWindow.tcl ? ? Tree.tcl ? ? Xpm.tcl ? ? Xpm1.tcl ? ? ? ????pref ? ? 10Point.fs ? ? 10Point.fsc ? ? 12Point.fs ? ? 12Point.fsc ? ? 14Point.fs ? ? 14Point.fsc ? ? Bisque.cs ? ? Bisque.csc ? ? Blue.cs ? ? Blue.csc ? ? Gray.cs ? ? Gray.csc ? ? Makefile ? ? Old12Pt.fs ? ? Old14Pt.fs ? ? pkgIndex.tcl ? ? SGIGray.cs ? ? SGIGray.csc ? ? TixGray.cs ? ? TixGray.csc ? ? tixmkpref ? ? TK.cs ? ? TK.csc ? ? TK.fs ? ? TK.fsc ? ? TkWin.cs ? ? TkWin.csc ? ? TkWin.fs ? ? TkWin.fsc ? ? WmDefault.cs ? ? WmDefault.csc ? ? WmDefault.fs ? ? WmDefault.fsc ? ? WmDefault.py ? ? WmDefault.tcl ? ? WmDefault.txt ? ? ? ????__pycache__ ????tk8.6 ? bgerror.tcl ? button.tcl ? choosedir.tcl ? clrpick.tcl ? comdlg.tcl ? console.tcl ? dialog.tcl ? entry.tcl ? focus.tcl ? fontchooser.tcl ? iconlist.tcl ? icons.tcl ? license.terms ? listbox.tcl ? megawidget.tcl ? menu.tcl ? mkpsenc.tcl ? msgbox.tcl ? obsolete.tcl ? optMenu.tcl ? palette.tcl ? panedwindow.tcl ? pkgIndex.tcl ? safetk.tcl ? scale.tcl ? scrlbar.tcl ? spinbox.tcl ? tclIndex ? tearoff.tcl ? text.tcl ? tk.tcl ? tkfbox.tcl ? unsupported.tcl ? xmfbox.tcl ? ????demos ? ? anilabel.tcl ? ? aniwave.tcl ? ? arrow.tcl ? ? bind.tcl ? ? bitmap.tcl ? ? browse ? ? button.tcl ? ? check.tcl ? ? clrpick.tcl ? ? colors.tcl ? ? combo.tcl ? ? cscroll.tcl ? ? ctext.tcl ? ? dialog1.tcl ? ? dialog2.tcl ? ? en.msg ? ? entry1.tcl ? ? entry2.tcl ? ? entry3.tcl ? ? filebox.tcl ? ? floor.tcl ? ? fontchoose.tcl ? ? form.tcl ? ? goldberg.tcl ? ? hello ? ? hscale.tcl ? ? icon.tcl ? ? image1.tcl ? ? image2.tcl ? ? items.tcl ? ? ixset ? ? knightstour.tcl ? ? label.tcl ? ? labelframe.tcl ? ? license.terms ? ? mclist.tcl ? ? menu.tcl ? ? menubu.tcl ? ? msgbox.tcl ? ? nl.msg ? ? paned1.tcl ? ? paned2.tcl ? ? pendulum.tcl ? ? plot.tcl ? ? puzzle.tcl ? ? radio.tcl ? ? README ? ? rmt ? ? rolodex ? ? ruler.tcl ? ? sayings.tcl ? ? search.tcl ? ? spin.tcl ? ? square ? ? states.tcl ? ? style.tcl ? ? tclIndex ? ? tcolor ? ? text.tcl ? ? textpeer.tcl ? ? timer ? ? toolbar.tcl ? ? tree.tcl ? ? ttkbut.tcl ? ? ttkmenu.tcl ? ? ttknote.tcl ? ? ttkpane.tcl ? ? ttkprogress.tcl ? ? ttkscale.tcl ? ? twind.tcl ? ? unicodeout.tcl ? ? vscale.tcl ? ? widget ? ? ? ????images ? earth.gif ? earthmenu.png ? earthris.gif ? flagdown.xbm ? flagup.xbm ? gray25.xbm ? letters.xbm ? noletter.xbm ? ouster.png ? pattern.xbm ? tcllogo.gif ? teapot.ppm ? ????images ? logo.eps ? logo100.gif ? logo64.gif ? logoLarge.gif ? logoMed.gif ? pwrdLogo.eps ? pwrdLogo100.gif ? pwrdLogo150.gif ? pwrdLogo175.gif ? pwrdLogo200.gif ? pwrdLogo75.gif ? README ? tai-ku.gif ? ????msgs ? cs.msg ? da.msg ? de.msg ? el.msg ? en.msg ? en_gb.msg ? eo.msg ? es.msg ? fr.msg ? hu.msg ? it.msg ? nl.msg ? pl.msg ? pt.msg ? ru.msg ? sv.msg ? ????ttk altTheme.tcl aquaTheme.tcl button.tcl clamTheme.tcl classicTheme.tcl combobox.tcl cursors.tcl defaults.tcl entry.tcl fonts.tcl menubutton.tcl notebook.tcl panedwindow.tcl progress.tcl scale.tcl scrollbar.tcl sizegrip.tcl spinbox.tcl treeview.tcl ttk.tcl utils.tcl vistaTheme.tcl winTheme.tcl xpTheme.tcl ---- I hope this is enough information to discover the issue. ---------- components: Windows messages: 380380 nosy: JackSkellington, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Python 3.9 broken installer type: behavior versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 4 19:37:06 2020 From: report at bugs.python.org (JaonHax) Date: Thu, 05 Nov 2020 00:37:06 +0000 Subject: [New-bugs-announce] [issue42268] ./configure failing when --with-memory-sanitizer specified Message-ID: <1604536626.36.0.392712714368.issue42268@roundup.psfhosted.org> Change by JaonHax : ---------- components: Build nosy: JaonHax priority: normal severity: normal status: open title: ./configure failing when --with-memory-sanitizer specified type: behavior versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 5 10:38:14 2020 From: report at bugs.python.org (Eric V. Smith) Date: Thu, 05 Nov 2020 15:38:14 +0000 Subject: [New-bugs-announce] [issue42269] Add ability to set __slots__ in dataclasses Message-ID: <1604590694.08.0.0173517280171.issue42269@roundup.psfhosted.org> New submission from Eric V. Smith : I resisted adding the ability to set __slots__ in the first version of dataclasses, since it requires that instead of modifying an existing class, an entirely new class is returned. But I think this feature would be useful enough that I'm now willing to add it. I have the code ready, I just need to work on tests and documentation. ---------- assignee: eric.smith components: Library (Lib) messages: 380416 nosy: eric.smith priority: normal severity: normal status: open title: Add ability to set __slots__ in dataclasses type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 5 12:52:28 2020 From: report at bugs.python.org (Trevor) Date: Thu, 05 Nov 2020 17:52:28 +0000 Subject: [New-bugs-announce] [issue42270] libregrtest BrokenPipeError on OpenEmbedded builds Message-ID: <1604598748.13.0.380375862374.issue42270@roundup.psfhosted.org> New submission from Trevor : In OpenEmbedded we have a test wrapper for tests such as those in Python, and currently we are experiencing the following error when running them: sed: couldn't flush stdout: Resource temporarily unavailable [37/1846] test test_strftime crashed -- Traceback (most recent call last): File "/usr/lib/python3.9/test/libregrtest/runtest.py", line 270, in _runtest_inner refleak = _runtest_inner2(ns, test_name) File "/usr/lib/python3.9/test/libregrtest/runtest.py", line 234, in _runtest_inner2 test_runner() File "/usr/lib/python3.9/test/libregrtest/runtest.py", line 209, in _test_module support.run_unittest(tests) File "/usr/lib/python3.9/test/support/__init__.py", line 1918, in run_unittest _run_suite(suite) File "/usr/lib/python3.9/test/support/__init__.py", line 1796, in _run_suite result = runner.run(suite) File "/usr/lib/python3.9/unittest/runner.py", line 176, in run test(result) File "/usr/lib/python3.9/unittest/suite.py", line 84, in __call__ return self.run(*args, **kwds) File "/usr/lib/python3.9/unittest/suite.py", line 122, in run test(result) File "/usr/lib/python3.9/unittest/suite.py", line 84, in __call__ return self.run(*args, **kwds) File "/usr/lib/python3.9/unittest/suite.py", line 122, in run test(result) File "/usr/lib/python3.9/unittest/suite.py", line 84, in __call__ return self.run(*args, **kwds) File "/usr/lib/python3.9/unittest/suite.py", line 122, in run test(result) File "/usr/lib/python3.9/unittest/case.py", line 653, in __call__ return self.run(*args, **kwds) File "/usr/lib/python3.9/unittest/case.py", line 566, in run result.startTest(self) File "/usr/lib/python3.9/test/support/testresult.py", line 49, in startTest self.stream.flush() BrokenPipeError: [Errno 32] Broken pipe Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/usr/lib/python3.9/test/__main__.py", line 2, in main() File "/usr/lib/python3.9/test/libregrtest/main.py", line 716, in main Regrtest().main(tests=tests, **kwargs) File "/usr/lib/python3.9/test/libregrtest/main.py", line 638, in main self._main(tests, kwargs) File "/usr/lib/python3.9/test/libregrtest/main.py", line 691, in _main self.run_tests() File "/usr/lib/python3.9/test/libregrtest/main.py", line 518, in run_tests self.run_tests_sequential() File "/usr/lib/python3.9/test/libregrtest/main.py", line 409, in run_tests_sequential self.display_progress(test_index, text) File "/usr/lib/python3.9/test/libregrtest/main.py", line 169, in display_progress self.log(f"[{line}] {text}") File "/usr/lib/python3.9/test/libregrtest/main.py", line 158, in log print(line, flush=True) BrokenPipeError: [Errno 32] Broken pipe Warning -- Unraisable exception Exception ignored in: <_io.TextIOWrapper name=1 mode='w' encoding='utf-8'> BrokenPipeError: [Errno 32] Broken pipe --- I'm looking into it already, but need to document it. ---------- components: Tests messages: 380423 nosy: threexc priority: normal severity: normal status: open title: libregrtest BrokenPipeError on OpenEmbedded builds type: crash versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 5 14:21:47 2020 From: report at bugs.python.org (=?utf-8?q?Bo=C5=A1tjan_Mejak?=) Date: Thu, 05 Nov 2020 19:21:47 +0000 Subject: [New-bugs-announce] [issue42271] Remove the error and the zipfile.ZipFile.BadZipfile aliases Message-ID: <1604604107.76.0.819797887285.issue42271@roundup.psfhosted.org> New submission from Bo?tjan Mejak : Remove the long-forgotten aliases 'error' and 'BadZipfile' in 'zipfile.ZipFile' class which are just pre-3.2 compatibility names. Python 3.10 should finally remove these aliases. ---------- components: Library (Lib) messages: 380428 nosy: PedanticHacker priority: normal pull_requests: 22083 severity: normal status: open title: Remove the error and the zipfile.ZipFile.BadZipfile aliases type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 5 15:06:37 2020 From: report at bugs.python.org (Kevin Locke) Date: Thu, 05 Nov 2020 20:06:37 +0000 Subject: [New-bugs-announce] [issue42272] Warning filter message/module documentation is misleading Message-ID: <1604606797.18.0.328122375746.issue42272@roundup.psfhosted.org> New submission from Kevin Locke : "The Warnings Filter" section of the documentation for the warnings module describes the message and module filters as "a string containing a regular expression". While that is true when they are arguments to the filterwarnings function, it is not true when they appear in -W or $PYTHONWARNINGS where they are matched literally (after stripping any starting/ending whitespace). Additionally, in the "Describing Warning Filters" section, the example "error:::mymodule[.*]" does not behave as described. If it were used as an argument to filterwarnings, where it would be treated as a regular expression, it would match the (invalid) module names mymodule. or mymodule* while it would match mymodule[.*] literally if passed via -W or $PYTHONWARNINGS. ---------- assignee: docs at python components: Documentation messages: 380429 nosy: docs at python, kevinoid priority: normal severity: normal status: open title: Warning filter message/module documentation is misleading type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 5 17:14:23 2020 From: report at bugs.python.org (Kevin Keating) Date: Thu, 05 Nov 2020 22:14:23 +0000 Subject: [New-bugs-announce] [issue42273] Using LazyLoader leads to AttributeError Message-ID: <1604614463.81.0.853919807892.issue42273@roundup.psfhosted.org> New submission from Kevin Keating : Steps to reproduce: Create the following three files (or download the attached zip file, which contains these files): main.py import foo from foo import a from foo import b print(foo.b.my_function()) foo/a.py import importlib.util import sys # implementation copied from https://github.com/python/cpython/blob/master/Doc/library/importlib.rst#implementing-lazy-imports def lazy_import(name): spec = importlib.util.find_spec(name) loader = importlib.util.LazyLoader(spec.loader) spec.loader = loader module = importlib.util.module_from_spec(spec) sys.modules[name] = module loader.exec_module(module) return module b = lazy_import("foo.b") foo/b.py def my_function(): return "my_function" and then run main.py Expected results my_function should be printed to the terminal Actual results The following traceback is printed to the terminal Traceback (most recent call last): File "F:\Documents\lazy_import\main.py", line 6, in print(foo.b.my_function()) AttributeError: module 'foo' has no attribute 'b' If you comment out "from foo import a" from main.py, then the traceback doesn't occur and my_function gets printed. Alternatively, if you move "from foo import a" after "from foo import b", then the traceback doesn't occur and my_function gets printed. Adding "foo.b = b" before "print(foo.b.my_function())" will also fix the traceback. A colleague of mine originally ran into this bug when writing unit tests for lazily imported code, since mock.patch("foo.b.my_function") triggers the same AttributeError. I've reproduced this on Windows using both Python 3.8.3 and Python 3.9.0, and my colleague was using Python 3.8.3 on Mac. ---------- components: Library (Lib) files: lazy_import.zip messages: 380437 nosy: KevKeating priority: normal severity: normal status: open title: Using LazyLoader leads to AttributeError versions: Python 3.8, Python 3.9 Added file: https://bugs.python.org/file49574/lazy_import.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 6 00:10:39 2020 From: report at bugs.python.org (Vrashab Kotian) Date: Fri, 06 Nov 2020 05:10:39 +0000 Subject: [New-bugs-announce] [issue42274] Imaplib hangs up infinitely when performing append operation Message-ID: <1604639439.38.0.466893832242.issue42274@roundup.psfhosted.org> New submission from Vrashab Kotian : Dear all, We are facing an issue while using imaplib's append operation. We are using append function of imaplib to move a mail from inbox to another folder (we are performing this operation on Outlook 365 account). Sometimes, when our process (the process is running Azure linux VM) performs this operation, it gets hangs up at this point infinitely . When this happens there is no response being returned back for the email server. This issue is causing a huge problem. Please analyse this problem and give us some solution or suggestion on the same Thanking you in advance ---------- messages: 380442 nosy: vrashab.kotian priority: normal severity: normal status: open title: Imaplib hangs up infinitely when performing append operation type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 6 04:46:37 2020 From: report at bugs.python.org (shakir_juolay) Date: Fri, 06 Nov 2020 09:46:37 +0000 Subject: [New-bugs-announce] [issue42275] Jupyter Lab Terminals not available (error was No module named 'winpty.cywinpty') Message-ID: <1604655997.12.0.439112752086.issue42275@roundup.psfhosted.org> New submission from shakir_juolay : I get the below message when I run Jupyter Lab D:\Users\sjuolay>jupyter lab [W 12:37:50.862 LabApp] Terminals not available (error was No module named 'winpty.cywinpty') [I 12:37:51.170 LabApp] JupyterLab extension loaded from d:\users\sjuolay\documents\python\python39\lib\site-packages\jupyterlab [I 12:37:51.171 LabApp] JupyterLab application directory is d:\users\sjuolay\documents\python\python39\share\jupyter\lab [I 12:37:51.300 LabApp] Serving notebooks from local directory: D:\Users\sjuolay [I 12:37:51.301 LabApp] Jupyter Notebook 6.1.4 is running at: [I 12:37:51.301 LabApp] http://localhost:8888/?token=9a64c8f9a15b970ecc775090c4e5b8c90677f1456a83a932 [I 12:37:51.301 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 12:37:51.330 LabApp] To access the notebook, open this file in a browser: file:///D:/Users/sjuolay/AppData/Roaming/jupyter/runtime/nbserver-7928-open.html Or copy and paste one of these URLs: http://localhost:8888/?token=9a64c8f9a15b970ecc775090c4e5b8c90677f1456a83a932 [I 12:37:53.917 LabApp] Build is up to date And when I run the below from Python IDLE I get >>> import winpty Traceback (most recent call last): File "", line 1, in import winpty File "D:\Users\sjuolay\Documents\Python\Python39\lib\site-packages\winpty\__init__.py", line 11, in from .ptyprocess import PtyProcess File "D:\Users\sjuolay\Documents\Python\Python39\lib\site-packages\winpty\ptyprocess.py", line 21, in from .winpty_wrapper import PTY, PY2 File "D:\Users\sjuolay\Documents\Python\Python39\lib\site-packages\winpty\winpty_wrapper.py", line 12, in from .cywinpty import Agent ModuleNotFoundError: No module named 'winpty.cywinpty' Software Details Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32 Jupyter Lab 2.2.9 pywinpty 0.5.7 Any idea how much of an impact the error has on Jupyter Lab, since it is launched in browser? How to fix this? ---------- components: Library (Lib) messages: 380443 nosy: shakir_juolay priority: normal severity: normal status: open title: Jupyter Lab Terminals not available (error was No module named 'winpty.cywinpty') type: behavior versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 6 07:44:20 2020 From: report at bugs.python.org (Guo) Date: Fri, 06 Nov 2020 12:44:20 +0000 Subject: [New-bugs-announce] [issue42276] Bug in adfuller test and a suggested fix Message-ID: <1604666660.35.0.85933411244.issue42276@roundup.psfhosted.org> New submission from Guo : from statsmodels.tsa.stattools import adfuller adf = adfuller(x, regression=?c?, autolag=?t-stat?) Sometimes comes error message: UnboundLocalError: local variable ?bestlag? referenced before assignment I found the reason: when using t-stat, bestlag is only assigned, when the last lag becomes significant the first time, so if no lag has a significant t-value, then bestlag is never assigned I fixed this bug this way: open the file stattools.py and find the lines: elif method == ?t-stat?: #stop = stats.norm.ppf(.95) stop = 1.6448536269514722 Then add here following two lines: bestlag = startlag icbest = np.abs(results[startlag].tvalues[-1]) This way, the code won?t crash again and t-stat simply uses no lag when there is no significant value ---------- components: Library (Lib) messages: 380446 nosy: gyllila priority: normal severity: normal status: open title: Bug in adfuller test and a suggested fix type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 6 09:30:19 2020 From: report at bugs.python.org (Jakub Kulik) Date: Fri, 06 Nov 2020 14:30:19 +0000 Subject: [New-bugs-announce] [issue42277] Solaris & PEP 3149: start using ABI version tagged .so files Message-ID: <1604673019.95.0.76532678004.issue42277@roundup.psfhosted.org> New submission from Jakub Kulik : Solaris doesn't have ABI version tagged .so files enabled in upstream CPython yet, but almost every Solaris distribution* patches this functionality in: Oracle Solaris: https://github.com/oracle/solaris-userland/blob/master/components/python/python39/patches/13-SOABI.patch OpenIndiana: https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/python37/patches/13-SOABI.patch OmniOS: https://github.com/omniosorg/omnios-build/blob/master/build/python37/patches/13-SOABI.patch Because of that, I think it should be merged into master. *) The only exception is pkgsrc (used in SmartOS), but they are patching it out for every system, so no change there: https://github.com/joyent/pkgsrc/blob/trunk/lang/python39/patches/patch-configure ---------- components: Build messages: 380449 nosy: kulikjak priority: normal severity: normal status: open title: Solaris & PEP 3149: start using ABI version tagged .so files type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 6 09:57:52 2020 From: report at bugs.python.org (E. Paine) Date: Fri, 06 Nov 2020 14:57:52 +0000 Subject: [New-bugs-announce] [issue42278] Remove usage of tempfile.mktemp in stdlib Message-ID: <1604674672.14.0.368213492276.issue42278@roundup.psfhosted.org> New submission from E. Paine : Currently, there are many uses of `tempfile.mktemp` in the stdlib. I couldn't find an issue where this has already been discussed, but I think the usage of mktemp in the stdlib should be completely reviewed. I grepped the Lib and a slightly filtered version is the following: Lib/asyncio/windows_utils.py:34: address = tempfile.mktemp( Lib/distutils/command/bdist_wininst.py:185: archive_basename = mktemp() Lib/distutils/util.py:386: (script_fd, script_name) = None, mktemp(".py") Lib/msilib/__init__.py:214: filename = mktemp() Lib/multiprocessing/connection.py:81: return tempfile.mktemp(prefix='listener-', dir=util.get_temp_dir()) Lib/multiprocessing/connection.py:83: return tempfile.mktemp(prefix=r'\.\pipe\pyc-%d-%d-' % Lib/pydoc.py:1620: filename = tempfile.mktemp() Lib/test/bisect_cmd.py:75: tmp = tempfile.mktemp() Lib/test/test_bytes.py:1193: tfn = tempfile.mktemp() Lib/test/test_contextlib.py:316: tfn = tempfile.mktemp() Lib/test/test_doctest.py:2724: >>> fn = tempfile.mktemp() Lib/test/test_doctest.py:2734: >>> fn = tempfile.mktemp() Lib/test/test_doctest.py:2744: >>> fn = tempfile.mktemp() Lib/test/test_faulthandler.py:51: filename = tempfile.mktemp() Lib/test/test_shutil.py:1624: filename = tempfile.mktemp(dir=dirname) Lib/test/test_shutil.py:1935: dst_dir = tempfile.mktemp(dir=self.mkdtemp()) Lib/test/test_shutil.py:2309: name = tempfile.mktemp(dir=os.getcwd()) Lib/test/test_shutil.py:272: filename = tempfile.mktemp(dir=self.mkdtemp()) Lib/test/test_shutil.py:677: dst = tempfile.mktemp(dir=self.mkdtemp()) Lib/test/test_socket.py:699: path = tempfile.mktemp(dir=self.dir_path) Lib/test/test_socketserver.py:100: fn = tempfile.mktemp(prefix='unix_socket.', dir=dir) I am hoping this issue will be spotted as I couldn't find who to add to the nosy for this. I think, bearing in mind that use of this method is a security issue, we should reduce this number as low as feasible (though, I am sure that a number of those will have good reasons for using mktemp, and will be doing so in a safe way). ---------- components: Library (Lib) messages: 380450 nosy: epaine priority: normal severity: normal status: open title: Remove usage of tempfile.mktemp in stdlib type: security versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 6 13:37:29 2020 From: report at bugs.python.org (John Dutcher) Date: Fri, 06 Nov 2020 18:37:29 +0000 Subject: [New-bugs-announce] [issue42279] replacements function corrupts file Message-ID: <1604687849.79.0.792944285105.issue42279@roundup.psfhosted.org> New submission from John Dutcher : If the file below 0f 239 records is processed by the code below it throws no errors and writes the output...but the output has 615 records instead of 239 seemingly having written any revised ones three times instead of only once. replacements = {'/1':'/01', '9/':'09/', '7/':'07/'} file2 = open(r"c:\users\liddvdp\desktop\IBC CAP OUT.txt", "w") with open(r"c:\users\liddvdp\desktop\IBC CAP.txt", "r") as reader: for line in reader: for src, target in replacements.items(): line = line.replace(src, target) file2.write(line) ---------- assignee: terry.reedy components: IDLE files: IBC CAP.txt messages: 380466 nosy: dutch58, terry.reedy priority: normal severity: normal status: open title: replacements function corrupts file type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file49576/IBC CAP.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 6 13:49:58 2020 From: report at bugs.python.org (jack1142) Date: Fri, 06 Nov 2020 18:49:58 +0000 Subject: [New-bugs-announce] [issue42280] The list of standard generic collections is incomplete Message-ID: <1604688598.04.0.446732481114.issue42280@roundup.psfhosted.org> New submission from jack1142 : It looks like the documentation lists standard library collections that support parameterized generics[1] however, it seems to only feature a part of all the collections that support parametrizing (I'm going by the list that was produced by Ethan Smith[2], it could be slightly inaccurate now, but that can be cross-checked when making the contribution). I would be interested in making a PR adding these if/when this issue gets accepted. [1] https://docs.python.org/3.10/library/stdtypes.html#standard-generic-collections [2] https://github.com/gvanrossum/cpython/pull/1#issuecomment-582781121 ---------- assignee: docs at python components: Documentation messages: 380467 nosy: docs at python, jack1142 priority: normal severity: normal status: open title: The list of standard generic collections is incomplete type: enhancement versions: Python 3.10, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 6 19:19:51 2020 From: report at bugs.python.org (Mustafa Quraish) Date: Sat, 07 Nov 2020 00:19:51 +0000 Subject: [New-bugs-announce] [issue42281] Inconsistent ProcessPoolExecutor behaviour on macOS between 3.7 and 3.8/9 Message-ID: <1604708391.55.0.212848791362.issue42281@roundup.psfhosted.org> New submission from Mustafa Quraish : The code attached produces weird behaviour on macOS (Catalina at least) on Python3.8 / Python3.9. Issue has been reproduced on at least one other mac belonging to a friend. Does not occur on Linux as far as I have tested. I have simplified the code as much as I can, so the example attached does not actually need to use parallelism. Code description: Read text from a file, change directory using `os.chdir`, spawn 5 processes and pass the `print` function as the handler along with the text. Expectation: File contents should be printed 5 times Result: Code tries to load (again) the file in each thread, but fails since the directory was changed. Precondition: Have `file.txt` in the same directory containing some text Output when run on Python3.7, I get the following (expected output): ``` Reading file... Text loaded was: 'file contents' file contents file contents file contents file contents file contents ``` When running on 3.8 / 3.9 (on a mac) I get the following: ``` Reading file... Text loaded was: 'file contents' Error: /Users/mustafa/dev/ptest/test_dir/file.txt does not exist. Error: /Users/mustafa/dev/ptest/test_dir/file.txt does not exist. Error: /Users/mustafa/dev/ptest/test_dir/file.txt does not exist. ``` It seems to me that even opened `file.txt` is loaded in the main thread and text is read from it, this value isn't passed into the spawned processes and they are calling `load()` again (which is where the error message is produced). ---------- components: macOS files: test.py messages: 380483 nosy: bquinlan, mustafaquraish, ned.deily, pitrou, ronaldoussoren priority: normal severity: normal status: open title: Inconsistent ProcessPoolExecutor behaviour on macOS between 3.7 and 3.8/9 type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49579/test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 7 01:59:44 2020 From: report at bugs.python.org (Nick Coghlan) Date: Sat, 07 Nov 2020 06:59:44 +0000 Subject: [New-bugs-announce] [issue42282] Constant folding is skipped in named expressions Message-ID: <1604732384.87.0.434481078008.issue42282@roundup.psfhosted.org> New submission from Nick Coghlan : While working on the PEP 642 reference implementation I removed the "default:" case from the switch statement in astfold_expr as part of making sure the new SkippedBinding node was being handled everywhere it needed to be. This change picked up that NamedExpr_kind wasn't being handled either, and a check with the dis module confirmed that using the walrus operator turns off constant folding: ``` [ncoghlan at thechalk cpython]$ ./python Python 3.10.0a2+ (heads/pep-642-constraint-patterns-dirty:4db2fbd609, Nov 7 2020, 16:42:19) [GCC 10.2.1 20201016 (Red Hat 10.2.1-6)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import dis >>> dis.dis("1 + 1") 1 0 LOAD_CONST 0 (2) 2 RETURN_VALUE >>> dis.dis("(x := 1 + 1)") 1 0 LOAD_CONST 0 (1) 2 LOAD_CONST 0 (1) 4 BINARY_ADD 6 DUP_TOP 8 STORE_NAME 0 (x) 10 RETURN_VALUE >>> ``` The missing switch statement entry is just: ``` case NamedExpr_kind: CALL(astfold_expr, expr_ty, node_->v.NamedExpr.value); break; ``` Which gives the expected result: ``` [ncoghlan at thechalk cpython]$ ./python -c "import dis; dis.dis('(x := 1 +1)')" 1 0 LOAD_CONST 0 (2) 2 DUP_TOP 4 STORE_NAME 0 (x) 6 RETURN_VALUE ``` ---------- messages: 380494 nosy: ncoghlan priority: normal severity: normal stage: needs patch status: open title: Constant folding is skipped in named expressions type: performance versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 7 05:40:49 2020 From: report at bugs.python.org (Ronald Oussoren) Date: Sat, 07 Nov 2020 10:40:49 +0000 Subject: [New-bugs-announce] [issue42283] test_idle is interactive Message-ID: <1604745649.01.0.730939254492.issue42283@roundup.psfhosted.org> New submission from Ronald Oussoren : I noticed this on a macOS 11.0.1 box: When I run "python -m test.regrtest -uall" the IDLE testsuite is run ('test_idle'), and those tests pop up windows and won't make progress until I close those windows. ---------- assignee: terry.reedy components: IDLE messages: 380501 nosy: ronaldoussoren, terry.reedy priority: normal severity: normal status: open title: test_idle is interactive versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 7 06:03:31 2020 From: report at bugs.python.org (Xinmeng Xia) Date: Sat, 07 Nov 2020 11:03:31 +0000 Subject: [New-bugs-announce] [issue42284] The grammar specification is inconsistent with the implementation of Python parser. Message-ID: <1604747011.11.0.528857391956.issue42284@roundup.psfhosted.org> New submission from Xinmeng Xia : In full grammar specification of Python 3.6 official documentation (Python 3.6 official documentation: https://docs.python.org/3.6/reference/grammar.html ), we can find a very clear definition on the grammar about the usage of 'break'. According to the definition, we can find the following derivation, which indicates the keyword 'break' can appear in the block of if statement without being nested into a loop block: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # Start symbols for the grammar: # single_input is a single interactive statement; single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | nonlocal_stmt | assert_stmt) flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt break_stmt: 'break' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% However, the implementation of the Python parser requires the 'break' can only be embedded into a loop statement. See the following example: Example A(without loop): >>> compile("if True:break",'','exec') Traceback (most recent call last): File "", line 1, in File "", line 1 SyntaxError: 'break' outside loop Example B(with a loop): >>> compile("while True:\n\tif True:break",'','exec') at 0x7f5f4de90b70, file "", line 1> Similar problems exist between if-statement and keywords: 'continue', 'yield', 'return', 'nonlocal' in Python 3.6 and later versions. ---------- assignee: docs at python components: Documentation messages: 380502 nosy: docs at python, xxm priority: normal severity: normal status: open title: The grammar specification is inconsistent with the implementation of Python parser. type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 7 14:01:51 2020 From: report at bugs.python.org (=?utf-8?q?Jakub_Moli=C5=84ski?=) Date: Sat, 07 Nov 2020 19:01:51 +0000 Subject: [New-bugs-announce] [issue42285] Missing spaces in list literals in Tutorial/Data Structures Message-ID: <1604775711.75.0.283349948173.issue42285@roundup.psfhosted.org> New submission from Jakub Moli?ski : In the Data Structures section of the Tutorial there are examples of nested list comprehensions that include list literals where elements are written without spaces after commas (`[1,2,3]` instead `[1, 2, 3]`). This is a trivial problem but since this is a tutorial for newcomers (and one of the previous parts of this tutorial explicitly says that the spaces should be present after commas, and in other parts of the tutorial they are consistently put there) I think this deserves to be fixed. ---------- assignee: docs at python components: Documentation messages: 380514 nosy: docs at python, jakub.molinski priority: normal severity: normal status: open title: Missing spaces in list literals in Tutorial/Data Structures type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 7 17:19:52 2020 From: report at bugs.python.org (Cornelius Krupp) Date: Sat, 07 Nov 2020 22:19:52 +0000 Subject: [New-bugs-announce] [issue42286] f_trace gets call on different lines each loop Message-ID: <1604787592.98.0.058051292798.issue42286@roundup.psfhosted.org> New submission from Cornelius Krupp : When using a local trace function, sometimes the line event is issued at the wrong time. As can be seen from the example file `f_trace_wrong_line.py`, each loop iteration we get either 24 or 23, apparently in a fixed rhythm. While this might seem harmless, it appears that the line event for 23 (In this example) is issued at a time where the state of the stack is not valid to switch line. I noticed this because I wanted to implement a context manager that skips to a specific line, but this broken with mysterious error message `TypeError: 'NoneType' object is not callable` which I think is caused by the `with`-line not being fully executed and the stack still having the return value of `__enter__` on it. Here the intro line of the interpreter: Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32 ---------- components: Interpreter Core files: f_trace_wrong_line.py messages: 380527 nosy: trampchamp priority: normal severity: normal status: open title: f_trace gets call on different lines each loop type: behavior versions: Python 3.9 Added file: https://bugs.python.org/file49580/f_trace_wrong_line.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 7 19:31:36 2020 From: report at bugs.python.org (Yonatan Goldschmidt) Date: Sun, 08 Nov 2020 00:31:36 +0000 Subject: [New-bugs-announce] [issue42287] Use Py_NewRef & Py_XNewRef where applicable Message-ID: <1604795496.29.0.677062594524.issue42287@roundup.psfhosted.org> New submission from Yonatan Goldschmidt : Following https://bugs.python.org/issue42262, I think it'd be nice to convert existing C code to use the more concise Py_NewRef() and Py_XNewRef() where possible. Increases readability and less bug prone. Opening this new issue to track the conversion. ---------- components: Interpreter Core messages: 380531 nosy: Yonatan Goldschmidt, vstinner priority: normal severity: normal status: open title: Use Py_NewRef & Py_XNewRef where applicable type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 7 23:51:22 2020 From: report at bugs.python.org (Komiya Takeshi) Date: Sun, 08 Nov 2020 04:51:22 +0000 Subject: [New-bugs-announce] [issue42288] typing.get_type_hints() returns Optional[Any] if the default value of the argument is None Message-ID: <1604811082.57.0.115992838782.issue42288@roundup.psfhosted.org> New submission from Komiya Takeshi : I noticed `typing.get_type_hints()` returns Optional[Any] as a type hints if the default value of the argument is None: ``` $ python Python 3.9.0 (default, Oct 24 2020, 15:41:29) [Clang 11.0.3 (clang-1103.0.32.59)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from typing import Any, get_type_hints >>> def hello(name: Any = None): ... pass ... >>> get_type_hints(hello) {'name': typing.Optional[typing.Any]} ``` I know typing.get_type_hints() wraps the user's type annotation with Optional when the default value of the argument is None. But it is needless to wrap Any with Optional because Any already contains None. It would be better not to wrap it with Optional when the user's annotation is Any. ---------- messages: 380532 nosy: i.tkomiya priority: normal severity: normal status: open title: typing.get_type_hints() returns Optional[Any] if the default value of the argument is None versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 8 00:27:08 2020 From: report at bugs.python.org (Krrish Dhaneja) Date: Sun, 08 Nov 2020 05:27:08 +0000 Subject: [New-bugs-announce] [issue42289] Found a secret/private key in code. Message-ID: <1604813228.45.0.0225910221233.issue42289@roundup.psfhosted.org> New submission from Krrish Dhaneja : Found a private key in commit 9ae9ad8 in https://github.com/python/cpython . ---------- messages: 380533 nosy: Krrishdhaneja priority: normal severity: normal status: open title: Found a secret/private key in code. type: security versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 8 00:51:50 2020 From: report at bugs.python.org (Xinmeng Xia) Date: Sun, 08 Nov 2020 05:51:50 +0000 Subject: [New-bugs-announce] [issue42290] Unicode inconsistent display after concencated Message-ID: <1604814710.97.0.934662336836.issue42290@roundup.psfhosted.org> New submission from Xinmeng Xia : When printing an assignment expression with unicode ? ( \U+072F) on the command line, we get an unexpected result. Example A: >>> print(chr(1839)+" = 1") ? = 1 Similar problems exist in plenty of characters of unicode. ---------- components: Unicode messages: 380534 nosy: ezio.melotti, vstinner, xxm priority: normal severity: normal status: open title: Unicode inconsistent display after concencated type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 8 05:38:14 2020 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 08 Nov 2020 10:38:14 +0000 Subject: [New-bugs-announce] [issue42291] Incorrect signature of CodeType.replace() Message-ID: <1604831894.32.0.00722269509991.issue42291@roundup.psfhosted.org> New submission from Serhiy Storchaka : Currently the signature of types.CodeType.replace() is replace(self, /, *, co_argcount=-1, co_posonlyargcount=-1, co_kwonlyargcount=-1, co_nlocals=-1, co_stacksize=-1, co_flags=-1, co_firstlineno=-1, co_code=None, co_consts=None, co_names=None, co_varnames=None, co_freevars=None, co_cellvars=None, co_filename=None, co_name=None, co_lnotab=None) But -1 and None are incorrect values for many parameters, and even if they would be correct, they are not default values. By default, if you do not specify some argument, the value of the corresponding attribute would not be changed. Argument Clinic and the inspect module do not support this case. ---------- components: Argument Clinic, Library (Lib) messages: 380545 nosy: larry, serhiy.storchaka, vstinner, yselivanov priority: normal severity: normal status: open title: Incorrect signature of CodeType.replace() type: behavior versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 8 13:21:38 2020 From: report at bugs.python.org (igo95862) Date: Sun, 08 Nov 2020 18:21:38 +0000 Subject: [New-bugs-announce] [issue42292] C API: Allocating Objects on the Heap. Misleading documentation. Message-ID: <1604859698.6.0.558793144076.issue42292@roundup.psfhosted.org> New submission from igo95862 : The issue is that the function names are too similar to other function that do completely different things. `PyObject_Init` this function does not use `__init__` at all. What it does is sets the already allocated object pointer to the specific type and increments its reference. `PyObject_New` this function has nothing to do with `__new__`. It mallocs the new object and when calls `PyObject_Init` to set its type and increment reference. Most importantly neither function actually calls `__init__`. You need to do it manually otherwise you might get garbage in your object data from residual memory. I think there should be a small example showing how to allocate objects on heap and initialize them. This is what I do (ignore the names): ``` SdBusMessageObject *message_object = PyObject_NEW(SdBusMessageObject, &SdBusMessageType); SdBusMessageType.tp_init((PyObject *)message_object, NULL, NULL); ``` ---------- assignee: docs at python components: Documentation messages: 380558 nosy: docs at python, igo95862 priority: normal severity: normal status: open title: C API: Allocating Objects on the Heap. Misleading documentation. versions: Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 8 18:29:57 2020 From: report at bugs.python.org (giomach) Date: Sun, 08 Nov 2020 23:29:57 +0000 Subject: [New-bugs-announce] [issue42293] Installation of pyinstaller in Windows fails with utf8 error Message-ID: <1604878197.58.0.426662721479.issue42293@roundup.psfhosted.org> New submission from giomach : Python 3.9 freshly installed in Windows 10 to C:\Program Files\Python39, everything done as administrator, installed for all users, added to PATH. Installation of pyinstaller fails with message "SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data (sitecustomize.py, line 21)" (attachment) This may be due to the character ? in my Windows username (0xe1 in ANSI, which is my default 8-bit codepage) being misinterpreted as being in utf8 instead of ANSI. There is no sitecustomize.py in my file system. ---------- components: Installation files: pyinstaller.txt messages: 380564 nosy: giomach priority: normal severity: normal status: open title: Installation of pyinstaller in Windows fails with utf8 error type: crash versions: Python 3.9 Added file: https://bugs.python.org/file49582/pyinstaller.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 9 04:42:14 2020 From: report at bugs.python.org (STINNER Victor) Date: Mon, 09 Nov 2020 09:42:14 +0000 Subject: [New-bugs-announce] [issue42294] [C API] Add new C functions with more regular reference counting like PyTuple_GetItemRef() Message-ID: <1604914934.45.0.492738703952.issue42294@roundup.psfhosted.org> New submission from STINNER Victor : The C API of Python uses and abuses borrowed references and stealing references for performance. When such function is used in some very specific code for best performances, problems arise when they are the only way to access objects. Reference counting in C is error prone, most people, even experimented core developers, get it wrong. Examples of issues: * Reference leaks: objects are never deleted causing memory leaks. For example, an error handling code which forgets to call Py_DECREF() on a newly create object. * Unsafe borrowed references: call arbitrary Python code can delete the referenced objects, and so the borrowed reference becomes a dangling pointer. Most developers are confident that a function call cannot run arbitrary Python code, whereas a single Py_DECREF() can trigger a GC collection which runs finalizers which can be arbitrary Python code. Many functions have been fixed manually by adding Py_INCREF() and Py_DECREF() around "unsafe" function calls. Borrowed references and stealing references make reference counting code special, even more complex to review. I propose to use new function to make refecence counting code more regular, simpler to review, and so less error prone. Examples: * Add PyTuple_GetItem(): similar to PyTuple_GetItem() but returns a strong reference (or NULL if the tuple item is not set) * Add PyTuple_SetItemRef(): similar to PyTuple_SetItem() but don't steal a reference to the new item The C API has a long list of functions using borrowed references, so I'm not sure where we should stop. I propose to start with the most common functions: PyDict, PyTuple, PyList, and see how it goes. -- PyTuple_GetItem() is a function call which checks arguments: raise an exception if arguments are invalid. For best performances, PyTuple_GET_ITEM() macro is providing to skip these checks. This macro also returns a borrowed reference. I'm not if a new PyTuple_GET_ITEM_REF() macro should be added: similar to PyTuple_GET_ITEM() but returns a strong reference. Same open question abut PyTuple_SET_ITEM(tuple, index, item) macro which is also special: * Don't call Py_XINCREF(item) * Don't call Py_XDECREF() on the old item If a new PyTuple_SET_ITEM_REF() macro is added, I would prefer to make the function more "regular" in term of reference counting, and so call Py_XDECREF() on the old item. When used on a newly created tuple, it would add an useless Py_XDECREF(NULL), compared to PyTuple_SET_ITEM(). Again, my idea here is to provide functions with a less surprising behavior and more regular reference counting. There are alternatives to build a new tuple without the useless Py_XDECREF(NULL), like Py_BuildValue(). Code which requires best performance could continue to use PyTuple_SET_ITEM() which is not deprecated, and handle reference counting manually. -- An alternative is to use abstract functions like: * PyTuple_GetItem() => PySequence_GetItem() * PyDict_GetItem() => PyObject_GetItem() * etc. I propose to keep specialized functions per type to avoid the overhead of indirection. For example, PySequence_GetItem(obj, index) calls Py_TYPE(obj)->tp_as_sequence->sq_item(obj, index) which implies multiple indirection: * Get the object type from PyObject.ob_type * Dereference *type to get PyTypeObject.tp_as_sequence * Dereference *PyTypeObject.tp_as_sequence to get PySequenceMethods.sq_item -- I don't plan to get rid of borrowed references. Sometimes, they are safe and replacing them with strong references would require explicit reference counting code which is again easy to get wrong. For example, Py_TYPE() returns a borrowed reference to an object type. The function is commonly used to access immediately to a type member, with no risk of calling arbitrary Python code between the Py_TYPE() call and the read of the type attribute. For example, the following code is perfectly safe: PyErr_Format(PyExc_TypeError, "exec() globals must be a dict, not %.100s", Py_TYPE(globals)->tp_name); -- See also bpo-42262 where I added Py_NewRef() and Py_XNewRef() functions. See https://pythoncapi.readthedocs.io/bad_api.html#borrowed-references for details about issues caused by borrowed references and a list of functions using borrowed references. ---------- components: C API messages: 380578 nosy: vstinner priority: normal severity: normal status: open title: [C API] Add new C functions with more regular reference counting like PyTuple_GetItemRef() versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 9 05:48:14 2020 From: report at bugs.python.org (John Zalewski) Date: Mon, 09 Nov 2020 10:48:14 +0000 Subject: [New-bugs-announce] [issue42295] Error should be flagged if Walrus operator is used for multiple assigment Message-ID: <1604918894.59.0.15180711596.issue42295@roundup.psfhosted.org> New submission from John Zalewski : #The 'Walrus' operator does not support multiple assignment but does not #flag an attempt to make a multiple assigment as an error #This results in unexpected behavior at execution time: a, b = 100, 200 print (a, b) #result is #100 200 if (a, b := 3, 4): #this should be flagged as an error but is not print ("found true") else: print ("found false") print (a, b) #result is #100 3 but if multiple assigment were allowed this would be '3, 4' ---------------------------------------------------------------------- Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> = RESTART: C:\Users\John PC 2017\AppData\Local\Programs\Python\Python38-32\walrustest.py 100 200 found true 100 3 >>> ---------- files: walrustest.py messages: 380580 nosy: JohnPie priority: normal severity: normal status: open title: Error should be flagged if Walrus operator is used for multiple assigment type: compile error versions: Python 3.9 Added file: https://bugs.python.org/file49583/walrustest.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 9 12:25:59 2020 From: report at bugs.python.org (Jake Hunsaker) Date: Mon, 09 Nov 2020 17:25:59 +0000 Subject: [New-bugs-announce] [issue42297] [argparse] Bad error message formatting when using custom usage text Message-ID: <1604942759.08.0.272256214563.issue42297@roundup.psfhosted.org> New submission from Jake Hunsaker : In the sos project, we build a custom `usage` string for our argparser parser, and have noticed that doing so causes error messages from argparse to be badly formatted. For example if a bad option value is given, the error message is mangled into the last line of our usage string: ``` # python3 bin/sos report --all-logs=on usage: sos report [options] sos [options] [..snip...] collect, collector Collect an sos report from multiple nodes simultaneously report: error: argument --all-logs: ignored explicit argument 'on' ``` This is especially strange since we build the usage string with a trailing newline character: ``` for com in self._components: aliases = self._components[com][1] aliases.insert(0, com) _com = ', '.join(aliases) desc = self._components[com][0].desc _com_string += ( "\t{com:<30}{desc}\n".format(com=_com, desc=desc) ) usage_string = ("%(prog)s [options]\n\n" "Available components:\n") usage_string = usage_string + _com_string epilog = ("See `sos --help` for more information") self.parser = ArgumentParser(usage=usage_string, epilog=epilog) ``` So it appears the trailing newlines are being stripped (in our case, unintentionally?). As expected, removing the trailing newline when passing `usage_string` to our parse does not change this behavior. However, if we don't set the usage string at all when instantiating our parser, the error message is properly formatted beginning on a new line. Slightly interesting is that without the usage_string being passed, the error message is prefixed with "sos: report:" as expected for %(prog)s expansion, but when the error message is mangled `%(prog)s` is left out as well. A little more context is available here: https://github.com/sosreport/sos/issues/2285 ---------- components: Library (Lib) messages: 380598 nosy: TurboTurtle priority: normal severity: normal status: open title: [argparse] Bad error message formatting when using custom usage text type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 9 12:25:49 2020 From: report at bugs.python.org (Guido van Rossum) Date: Mon, 09 Nov 2020 17:25:49 +0000 Subject: [New-bugs-announce] [issue42296] Infinite loop uninterruptable on Windows in 3.10 Message-ID: <1604942749.77.0.840146962275.issue42296@roundup.psfhosted.org> New submission from Guido van Rossum : This code cannot be interrupted with ^C on Windows (e.g. in the REPL) while True: pass This seems to be a regression, it works in earlier versions. ---------- messages: 380597 nosy: Mark.Shannon, gvanrossum, steve.dower priority: normal severity: normal status: open title: Infinite loop uninterruptable on Windows in 3.10 versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 9 12:51:42 2020 From: report at bugs.python.org (pkerling) Date: Mon, 09 Nov 2020 17:51:42 +0000 Subject: [New-bugs-announce] [issue42298] Documented interaction of single-stage init and sub-interpreters inaccurate Message-ID: <1604944302.05.0.57186129659.issue42298@roundup.psfhosted.org> New submission from pkerling <9b6ab161 at casix.org>: The C API documentation says this about single-phase initialization and sub-interpreters: "[T]he first time a particular extension is imported, it is initialized normally, and a (shallow) copy of its module?s dictionary is squirreled away. When the same extension is imported by another (sub-)interpreter, a new module is initialized and filled with the contents of this copy; the extension?s init function is not called." - from https://docs.python.org/3.10/c-api/init.html#c.Py_NewInterpreter I was investigating crashes relating to the _datetime module and sub-interpreters and from my observations, this does not seem to be true. I have tracked this functionality down to the m_base.m_copy dictionary of the PyModuleDef of an extension and the functions _PyImport_FixupExtensionObject and _PyImport_FindExtensionObject in Python/import.c. However, modules are only ever added to the `extensions` global when imported in the main interpreter, see https://github.com/python/cpython/blob/1f73c320e2921605c4963e202f6bdac1ef18f2ce/Python/import.c#L480 Furthermore, even if they were added and m_base.m_copy was set, it would be cleared again on sub-interpreter shutdown here: https://github.com/python/cpython/blob/1f73c320e2921605c4963e202f6bdac1ef18f2ce/Python/pystate.c#L796 - implying that the module will be loaded and initialized again next time due to this check: https://github.com/python/cpython/blob/1f73c320e2921605c4963e202f6bdac1ef18f2ce/Python/import.c#L556 These observations are supported by the fact that in my tests, if "import _datetime" is ran subsequently in two different sub-interpreters, PyInit__datetime is indeed called twice. Test code - set a breakpoint on PyInit__datetime to observe the behavior: #include #include int main() { Py_Initialize(); for (int i = 0; i < 100; ++i) { PyThreadState* ts = Py_NewInterpreter(); assert(ts); int result = PyRun_SimpleString("import _datetime"); assert(result == 0); Py_EndInterpreter(ts); } return 0; } In summary, it seems to me that the documented behavior is not accurate (any more?) - so either the docs or the implementation should change. ---------- assignee: docs at python components: Documentation messages: 380602 nosy: docs at python, pkerling priority: normal severity: normal status: open title: Documented interaction of single-stage init and sub-interpreters inaccurate versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 9 18:41:26 2020 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 09 Nov 2020 23:41:26 +0000 Subject: [New-bugs-announce] [issue42299] Add test_formatter (or remove deprecated formatter module?) Message-ID: <1604965286.22.0.755561980419.issue42299@roundup.psfhosted.org> New submission from Terry J. Reedy : #14019 has a patch, unrelated to the issue, that adds test.test_formatter. There still is no such file, so I open this issue to move the patch here. It is the second version, responding to review by Ezio Melotti. But formatter has been deprecated since 3.4. It was originally scheduled to be removed in 3.6, but we decided to delay such removals until after 2.7 EOL. That is now past. Do we add tests for a deprecated module? If so, the patch, aDo we still want to remove formatter? If so, when? ---------- messages: 380623 nosy: terry.reedy priority: normal severity: normal stage: patch review status: open title: Add test_formatter (or remove deprecated formatter module?) type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 9 20:30:18 2020 From: report at bugs.python.org (Ronan Soares) Date: Tue, 10 Nov 2020 01:30:18 +0000 Subject: [New-bugs-announce] [issue42300] Typo in translation to portuguese Message-ID: <1604971818.8.0.290636952844.issue42300@roundup.psfhosted.org> New submission from Ronan Soares : Change "m?ltiplo menos comum" to "menor m?ltiplo comum" in the portuguese section of the what changed in python 3.9 ---------- assignee: docs at python components: Documentation messages: 380626 nosy: docs at python, ronan.soares priority: normal severity: normal status: open title: Typo in translation to portuguese type: enhancement versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 9 22:36:08 2020 From: report at bugs.python.org (Sam Yan) Date: Tue, 10 Nov 2020 03:36:08 +0000 Subject: [New-bugs-announce] [issue42301] Lack function to track index of an element in heapq Message-ID: <1604979368.73.0.815196542676.issue42301@roundup.psfhosted.org> New submission from Sam Yan : Github PR #23204: For a given element in a heap, we can leverage the fact that we can search this element quicker thinking of the property of a heap. Therefore out of h.index(x) that a list linear search uses, I propose to use a special written index method to look for an index of a heap element.This issue has been proposed on Github (with my changes to heapq also put there). Open a discussion under suggestion of Karthikeyan Singaravelan (tirkarthi). ---------- components: Extension Modules hgrepos: 393 messages: 380628 nosy: SamUnimelb priority: normal pull_requests: 22110 severity: normal status: open title: Lack function to track index of an element in heapq type: behavior versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 00:13:01 2020 From: report at bugs.python.org (Ravi Chityala) Date: Tue, 10 Nov 2020 05:13:01 +0000 Subject: [New-bugs-announce] [issue42302] [Turtle] Add clockwise and anticlockwise method as alias to right and left Message-ID: <1604985181.19.0.385851397848.issue42302@roundup.psfhosted.org> New submission from Ravi Chityala : The current implementation of turtle.py has right and left method for rotation. Another approach to view rotation is either clockwise or anticlockwise. These two methods can be an alias to right and left respectively. ---------- components: Library (Lib) messages: 380631 nosy: zenr priority: normal severity: normal status: open title: [Turtle] Add clockwise and anticlockwise method as alias to right and left type: enhancement versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 02:11:01 2020 From: report at bugs.python.org (DongwonTTuna) Date: Tue, 10 Nov 2020 07:11:01 +0000 Subject: [New-bugs-announce] [issue42303] I found a bug while checking string with find() Message-ID: <1604992261.99.0.682298337507.issue42303@roundup.psfhosted.org> New submission from DongwonTTuna : USED THE PYTHON-BINANCE MODULE FOR THIS ------------------------------------------------ from binance.client import Client from binance.exceptions import * client = Client(api_key='Your_Public_Apikey', api_secret='Your_Secret_Apikey') def buy_limit_test(coin, amount): client.create_test_order( symbol=coin + 'USDT', side=Client.SIDE_BUY, type=Client.ORDER_TYPE_MARKET, quantity=amount) try: buy_limit_test(coin='HOT', amount=-19298.0) except BinanceAPIException as E: print(E.message.find("'quaaantity'; legal range is")) if E.message.find("'quantity'; legal range is"): print(E.message) else: print("yes") ------------------------------------------------ And the parameters. ------------------------------------------------ E.message.find("'quantity'; legal range is") = 38 E.message = "Illegal characters found in parameter 'quantity'; legal range is '^([0-9]{1,20})(\.[0-9]{1,20})?$'." ------------------------------------------------ If I run with this if E.message.find("'quaaaaaaaaaaaaaaaaaaaaaaaaanatity'; legal range is"): It should be run with print("yes"), but It shows print(E.message). But If I run with if E.message.find("'quaaaaaaaaaaaaaaaaaaaaaaaaanatity'; legal range is") == True: It's now run with print("yes") not the print(E.message). I think it's a bug ---------- files: ?????????? 2020-11-10 16.02.46.png messages: 380636 nosy: DongwonTTuna priority: normal severity: normal status: open title: I found a bug while checking string with find() type: behavior versions: Python 3.9 Added file: https://bugs.python.org/file49585/?????????? 2020-11-10 16.02.46.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 02:33:14 2020 From: report at bugs.python.org (Ma Lin) Date: Tue, 10 Nov 2020 07:33:14 +0000 Subject: [New-bugs-announce] [issue42304] [easy C] long type performance waste in 64-bit Windows build Message-ID: <1604993594.99.0.772982766539.issue42304@roundup.psfhosted.org> New submission from Ma Lin : C type `long` is 4-byte integer in 64-bit Windows build (MSVC behavior). [1] In other compilers, `long` is 8-byte integer in 64-bit build. This leads to a bit unnecessary performance waste, issue38252 fixed this problem in a situation. Search `SIZEOF_LONG` in CPython code, there's still a few long type waste. Novices are welcome to try contribution. [1] https://stackoverflow.com/questions/384502 ---------- components: Windows messages: 380638 nosy: malin, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: [easy C] long type performance waste in 64-bit Windows build type: performance versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 02:51:05 2020 From: report at bugs.python.org (Mechtron 750) Date: Tue, 10 Nov 2020 07:51:05 +0000 Subject: [New-bugs-announce] [issue42305] Added Auto_Complete DropBox Suggestion For Tkinter Message-ID: <1604994665.25.0.506754536493.issue42305@roundup.psfhosted.org> New submission from Mechtron 750 : # This is auto complete drop box suggestion wiget for tkinter # Tkinter Autocomplete Text autocompletion provides relevant real-time results to users. Because tkinter does not provide a widget for adding autocompletion to GUIs out of the box, I decided to make one myself. This utility is compatible with and has been tested on Python 2.7.1 and Python 3.6.0. ### Structure ###### NOTE: The `Tkinter` library for Python 2 and `tkinter` library for Python 3 will from now on be referred to as `tk`. The `AutocompleteEntry` class (which can be found [here](https://github.com/RajvirSingh1313/Tkinter_Autocomplete_DropBox/blob/master/main.py)) derives from `tk.Frame` and is a container used to group a `tk.Entry` and `tk.Listbox` widget. Should you need to modify the widgets, they can be accessed as (respectively) `AutocompleteEntry` s `entry` and `listbox` attributes.
The entry widget acts like a normal textbox. When activated, it binds `` to a private method which will update the list of suggestions. The listbox widget contains the suggestions themselves. When activated, it binds `<>` to a private method which sets the entry widget to whatever value was selected.
Since an instance of `AutocompleteEntry` is a `tk.Frame` instance too, you can place it by calling its `pack` or `grid` methods with their respective arguments. ### Quickstart ###### NOTE: These examples will only run under Python 3. To make them Python 2-compatible, replace `tkinter` with `Tkinter`. To add a new autocompletion frame to our interface, first initialize one: ```python import tkinter as tk from tkinter import auto_complete root = tk.Tk() frame = tk.Frame(root) frame.pack() entry = auto_complete.AutocompleteEntry(frame) # You can pass additional parameters to further customize the window; # all parameters that you can pass to tk.Frame, are valid here too. ``` Now you need to configure the instance by passing it an iterable containing all autocompletion entries.
Do this by calling its `build` method: ```python ENTRIES = ( "Foo", "Bar" ) entry.build(ENTRIES) ``` You can pass additional arguments to `build`: * `max_entries` (integer):
The maximum number of entries to display at once. This value directly corresponds to the listbox widget's `height` attribute. Defaults to `5`. * `case_sensitive` (boolean):
If `True`, only autocomplete entries that enforce the same capitalization as the current entry will be displayed.
If `False`, all autocomplete entries that match with the current entry will be displayed.
Defaults to `False`. * `no_results_message` (string or `None`):
The message to display if no suggestions could be found for the current entry.
This argument may include a formatting identifier (`{}`) which, at runtime, gets formatted as the current entry. If `None` is specified, the listbox will instead be hidden until the next `` event. Let's play around with these arguments: ```python entry.build( entries=ENTRIES, no_results_message="< No results found for '{}' >" # Note that this is formatted at runtime ) ``` ###### NOTE: You may call the `build` method multiple times on an instance of `AutocompleteEntry`, to dynamically change the available suggestions. With that out of the way, you can display `entry`: ```python entry.pack() ``` Now, each time a user presses a key while the entry widget has focus, a list of suggestions will display below it. --- ### Additional options By default, the `tk.Listbox` widget has a width of `25` pixels and a height of `5` (items). The `tk.Entry` widget also has a default width of `25` pixels. These settings can be modified through the following class attributes: * `auto_complete.AutocompleteEntry.LISTBOX_HEIGHT`: The height to specify when creating the `tk.Listbox` widget. There's no need to modify this, since the maximum number of entries to be displayed can be passed as an argument to `build`. * `auto_complete.AutocompleteEntry.LISTBOX_WIDTH`: The width to specify when creating the `tk.Listbox` widget. Any positive integer is valid. * `auto_complete.AutocompleteEntry.ENTRY_WIDTH`: The width to specify when creating the `tk.Entry` widget. Any positive integer is valid. ###### NOTE: You almost always want to keep the 1:1 `LISTBOX_WIDTH`:`ENTRY_WIDTH` ratio. You can retrieve the current entry by accessing the instance's `text` attribute (which is a `tk.StringVar` instance): ```python text = entry.text.get() ``` To further customize the entry widget, you may set its font options, for example: ```python entry.entry["font"] = (, , ) ``` Or to change the background color for the listbox widget: ```python entry.listbox["background"] = "#cfeff9" # Light blue ``` ## This the demo ```python try: import tkinter as tk from tkinter import ttk from tkinter import auto_complete except ImportError: # Python 2 import Tkinter as tk import ttk from Tkinter import auto_complete COUNTRIES = ['Australia','Switzerland','India','Canada','Japan','Germany','United Kingdom','United States','Sweden','Netherlands','Norway'] class Application(tk.Frame, object): def __init__(self, *args, **kwargs): super(Application, self).__init__(*args, **kwargs) label = tk.Label(self, text="Select a country: ") label.pack() self.entry = auto_complete.AutocompleteEntry(self) self.build(case_sensitive=False, no_results_message=auto_complete.NO_RESULTS_MESSAGE) self.entry.pack(after=label) self.nr = tk.StringVar() tk.Label( self, text="\n\nAlternative message ( to set): " ).pack() nr = tk.Entry(self, textvariable=self.nr) nr.pack() nr.bind("", self._update) self.cs = tk.StringVar() cb = tk.Checkbutton( self, text="Case sensitive", variable=self.cs, state="normal", command=self._update ) cb.deselect() cb.pack() def _update(self, *args): case_sensitive = False if self.cs.get() == "1": case_sensitive = True no_results_message = self.nr.get() self.build( case_sensitive=case_sensitive, no_results_message=no_results_message ) def build(self, *args, **kwargs): self.entry.build( COUNTRIES, kwargs["case_sensitive"], kwargs["no_results_message"] ) if __name__ == "__main__": root = tk.Tk() root.title("DEMO") root.resizable(False, False) root.tk_setPalette("white") application = Application(root) application.pack() root.mainloop() ``` ### This the repo [here](https://github.com/RajvirSingh1313/Tkinter_Autocomplete_DropBox) ---------- components: Tkinter files: auto_complete.py messages: 380639 nosy: RajvirSingh1313 priority: normal pull_requests: 22114 severity: normal status: open title: Added Auto_Complete DropBox Suggestion For Tkinter type: enhancement versions: Python 3.7 Added file: https://bugs.python.org/file49587/auto_complete.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 03:00:09 2020 From: report at bugs.python.org (Alex Alex) Date: Tue, 10 Nov 2020 08:00:09 +0000 Subject: [New-bugs-announce] [issue42306] wrong exception handling in case asyncio.shiled usage Message-ID: <1604995209.89.0.967807993148.issue42306@roundup.psfhosted.org> New submission from Alex Alex : There is not any message about exception from try block. See attach. ---------- components: asyncio files: scratch_31.py messages: 380640 nosy: Alex Alex, asvetlov, yselivanov priority: normal severity: normal status: open title: wrong exception handling in case asyncio.shiled usage type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file49588/scratch_31.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 05:49:40 2020 From: report at bugs.python.org (STINNER Victor) Date: Tue, 10 Nov 2020 10:49:40 +0000 Subject: [New-bugs-announce] [issue42307] make install must not copy python.o into $prefix/lib/python3.10/config-3.10-x86_64-linux-gnu/ Message-ID: <1605005380.13.0.93741295392.issue42307@roundup.psfhosted.org> New submission from STINNER Victor : Commands reproduce the issue: cd /path/to/python/source/ ./configure --prefix /opt/pymaster CFLAGS="-O0" make make install make install copies python.o: $ find /opt/pymaster/ -name "*.o" /opt/pymaster/lib/python3.10/config-3.10-x86_64-linux-gnu/python.o This file is useless and must not be installed by make install. The issue was first discovered in Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1894462 ---------- components: Build messages: 380650 nosy: vstinner priority: normal severity: normal status: open title: make install must not copy python.o into $prefix/lib/python3.10/config-3.10-x86_64-linux-gnu/ versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 06:09:01 2020 From: report at bugs.python.org (Mario Corchero) Date: Tue, 10 Nov 2020 11:09:01 +0000 Subject: [New-bugs-announce] [issue42308] Add threading.__excepthook__ similar to sys.__excepthook__ Message-ID: <1605006541.53.0.440753194072.issue42308@roundup.psfhosted.org> New submission from Mario Corchero : The sys module contains __excepthook__ to recover sys.excepthook if necessary. The same is not present in the threading module, even if threading.excepthook is exposed. ---------- components: Library (Lib) messages: 380651 nosy: mariocj89, vstinner priority: normal severity: normal status: open title: Add threading.__excepthook__ similar to sys.__excepthook__ versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 06:44:55 2020 From: report at bugs.python.org (Michael Felt) Date: Tue, 10 Nov 2020 11:44:55 +0000 Subject: [New-bugs-announce] [issue42309] BUILD: AIX-64-bit segmentation fault Message-ID: <1605008695.96.0.78391537773.issue42309@roundup.psfhosted.org> New submission from Michael Felt : Successfully built and packaged the Python-3.9.0 distribution tar archive without modification - as 32-bit. Repeating the same process with the following environment change: # export OBJECT_MODE=64 fails with a segmentation fault by the "first-phase" python executable: ``` ../src/py39-3.9.0/Modules/makexp_aix Modules/python.exp "." libpython3.9.a xlc_r -Wl,-bE:Modules/python.exp -lld -o python Programs/python.o libpython3.9.a -lintl -ldl -lm -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 /bin/sh: 6291700 Segmentation fault(coredump) make: 1254-004 The error code from the last command is 139. Stop. root at x066:[/data/prj/python/py39-3.9.0]./python -E -S -m sysconfig --generate-posix-vars Segmentation fault(coredump) root at x066:[/data/prj/python/py39-3.9.0]./python Segmentation fault(coredump) ``` Will try to duplicate in a second environment. ---------- components: Build messages: 380654 nosy: Michael.Felt priority: normal severity: normal status: open title: BUILD: AIX-64-bit segmentation fault type: crash versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 08:39:42 2020 From: report at bugs.python.org (Sandro Barnabishvili) Date: Tue, 10 Nov 2020 13:39:42 +0000 Subject: [New-bugs-announce] [issue42310] for loop creates element in defaultdict Message-ID: <1605015582.35.0.628227429995.issue42310@roundup.psfhosted.org> New submission from Sandro Barnabishvili : from collections import defaultdict d = defaultdict(list) for _ in d['a']: pass print(d.keys()) For loop creates element with key 'a'. Is it expected behavior? ---------- components: Argument Clinic messages: 380661 nosy: larry, sandrobarna priority: normal severity: normal status: open title: for loop creates element in defaultdict type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 10:17:16 2020 From: report at bugs.python.org (Taekab Park) Date: Tue, 10 Nov 2020 15:17:16 +0000 Subject: [New-bugs-announce] [issue42311] It seems like ctypes code makes truncated pointer values in x64(access violations) Message-ID: <1605021436.76.0.434693997514.issue42311@roundup.psfhosted.org> New submission from Taekab Park : It seems like ctypes code makes truncated pointer values in x64(access violations) windows10 x64 options : __cdecl(/Gd) tested : python(x64) 3.2, 3.4, 3.6, 3.9 dll build with vc++2015 The test code is simple. Simply loaded TestDll and called function and checked return void* value. result actual void* : 0x00007FFDA4322018 <-> python void* : 0xFFFFFFFFA4322018 == C code == void* GetPointer(); SetPointer(void* value); INT64 GetPointer1(); void SetPointer1(INT64 obj); == python == import ctypes print(ctypes.sizeof(ctypes.c_void_p)) _testdll = ctypes.CDLL(r"TestDll.dll") def tohex(val, nbits): return hex((val + (1 << nbits)) % (1 << nbits)) result = _testdll.GetPointer() print(tohex(result, 64)) _testdll.SetPointer(result) result = _testdll.GetPointer1() print(tohex(result, 64)) _testdll.SetPointer1(result) ---------- components: ctypes files: example.zip messages: 380676 nosy: sh4dow priority: normal severity: normal status: open title: It seems like ctypes code makes truncated pointer values in x64(access violations) type: crash versions: Python 3.6, Python 3.9 Added file: https://bugs.python.org/file49589/example.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 10:20:27 2020 From: report at bugs.python.org (Michael Ferguson) Date: Tue, 10 Nov 2020 15:20:27 +0000 Subject: [New-bugs-announce] [issue42312] sys.prefix is set incorrectly on Mac OS X Message-ID: <1605021627.33.0.143648905308.issue42312@roundup.psfhosted.org> New submission from Michael Ferguson : I have been trying to create a wrapper script for `python3` in a venv that behaves similarly to a symbolic link. I am able to use `exec -a` in bash to run `python3` with `argv[0]` set to the wrapper script. This allows it to function similarly to the symbolic link in a venv. However, this approach does not work on Mac OS X with a homebrew installation. I think this is a bug. Here are the simple steps to reproduce (assuming bash shell): ``` cd /tmp python3 -m venv test-venv (exec -a test-venv/python3 python3 -c 'import sys; print(sys.executable); print (sys.prefix);') ``` ### Good output (Ubuntu 20.04) /tmp/test-venv/python-wrapper /tmp ### Bad output (Homebrew on Mac OS X) /usr/local/opt/python at 3.9/bin/python3.9 /usr/local/Cellar/python at 3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9 Here are some things that might be related: * the Mac OS X framework launcher and how it uses `realpath` (and issue22490) * `site.py` code in `def venv` and the conditional on `__PYVENV_LAUNCHER__`. The `if` branch is not being run in this configuration. * setting the environment variable `PYTHONEXECUTABLE` (e.g. `export PYTHONEXECUTABLE=test-venv/python3` before the other commands) causes the `if` branch in the conditional on `__PYVENV_LAUNCHER__` in `site.py` `def venv` to be run. This allows `sys.executable` to be set as expected but `sys.prefix` is still wrong. If you are interested in something closer to the use case, the below explains how to get a more user-facing reproducer: $ python3 -m venv test-venv -- put this into test-venv/python-wrapper -- #!/usr/bin/env bash # remove path component to prevent infinite loop export PATH=${PATH//test-venv/missing} # Now run the real python3 interpreter but tell it that it # is being launched at the current path, so it can # correctly find dependencies in the venv exec -a "$0" python3 "$@" $ chmod a+x test-venv/python-wrapper $ ./test-venv/python-wrapper -c 'import sys; print(sys.executable); print (sys.prefix);' (and with this script the problematic behavior is exactly the same as the exec commands above) ---------- components: macOS messages: 380677 nosy: mppf, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: sys.prefix is set incorrectly on Mac OS X type: behavior versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 10:31:08 2020 From: report at bugs.python.org (Athul R) Date: Tue, 10 Nov 2020 15:31:08 +0000 Subject: [New-bugs-announce] [issue42313] rstrip removes the trailing `e`s. Message-ID: <1605022268.82.0.95951478559.issue42313@roundup.psfhosted.org> New submission from Athul R : rstrip removes the trailing `e`s. i = "external_eeeeeeeee_object" i = i.rstrip('_object') print(i) """ It should have printed `external_eeeeeeeee` but it prints only `external_`. """ It happens only when I user rstrip("_object") not for other strings. # ======================================================= # it works fine in the below case. i = "external_eeeeeeeee_trail" i = i.rstrip('_trail') print(i) """ It should have prints `external_eeeeeeeee` """ ---------- components: Library (Lib) files: python-bug.py messages: 380678 nosy: Athul-R priority: normal severity: normal status: open title: rstrip removes the trailing `e`s. type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49590/python-bug.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 11:06:25 2020 From: report at bugs.python.org (Adrien) Date: Tue, 10 Nov 2020 16:06:25 +0000 Subject: [New-bugs-announce] [issue42314] Incorrect documentation entry for venv Message-ID: <1605024385.28.0.0225045754789.issue42314@roundup.psfhosted.org> New submission from Adrien : Hello, I am reading the venv official documentation available here: https://docs.python.org/3/library/venv.html If I pick English - 3.9.0, it's stated: "Changed in version 3.8: Add --upgrade-deps option to upgrade pip + setuptools to the latest on PyPI" When I run this my laptop: $ python3 --version Python 3.8.5 $ python3 -m venv venv-myproject --clear --upgrade-deps usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear] [--upgrade] [--without-pip] [--prompt PROMPT] ENV_DIR [ENV_DIR ...] venv: error: unrecognized arguments: --upgrade-deps If I pick English - 3.8(.6), I (correctly) don't see the option in the documentation. Please fix the documentation of 3.9 to indicates that this option was changed (added) in 3.9 and not 3.8 Thanks! Adrien ---------- assignee: docs at python components: Documentation messages: 380684 nosy: ari75, docs at python priority: normal severity: normal status: open title: Incorrect documentation entry for venv type: enhancement versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 11:52:44 2020 From: report at bugs.python.org (William Schwartz) Date: Tue, 10 Nov 2020 16:52:44 +0000 Subject: [New-bugs-announce] [issue42315] `python -m` semantics conflict with `__file__`'s being optional Message-ID: <1605027164.09.0.889081991316.issue42315@roundup.psfhosted.org> New submission from William Schwartz : `python -m mod` sets `sys.argv[0]` to the `mod.__file__` according to https://docs.python.org/3.9/using/cmdline.html#cmdoption-m > If ["-m"] is given, the first element of sys.argv will be the full path to the module file (while the module file is being located, the first element will be set to "-m"). But `__file__` may not exist according to https://docs.python.org/3.9/reference/import.html#__file__ > __file__ is optional. If set, this attribute?s value must be a string. The import system may opt to leave __file__ unset if it has no semantic meaning (e.g. a module loaded from a database). More technically, `__spec__.origin` is the source of `__file__`, and the former may be `None`, according to https://docs.python.org/3.9/library/importlib.html#importlib.machinery.ModuleSpec.origin > (__file__) > > Name of the place from which the module is loaded, e.g. ?builtin? for built-in modules and the filename for modules loaded from source. Normally ?origin? should be set, but it may be None (the default) which indicates it is unspecified (e.g. for namespace packages). `python -m mod` sets sys.argv[0] to `mod.__spec__.origin` at 3.9/Lib/runpy.py:196 It seems clear to me that the code is doing the right thing relative to the documentation for `-m`. But as #26388 and https://github.com/indygreg/PyOxidizer/issues/307 show, embedded Python runs into the semantic conflict with the documented behavior of `__spec__.origin` and `__file__`. My proposed resolution of this contradiction is to set `sys.argv[0] = sys.orig_argv[0]` or, even better, `sys.argv[0] = sys.executable` when `PyConfig.run_module` is set but the named module's `__spec__.origin` is `None`. ---------- components: Interpreter Core, Library (Lib) messages: 380689 nosy: William.Schwartz, brett.cannon, eric.snow, ncoghlan priority: normal severity: normal status: open title: `python -m` semantics conflict with `__file__`'s being optional type: behavior versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 12:28:35 2020 From: report at bugs.python.org (Brandon) Date: Tue, 10 Nov 2020 17:28:35 +0000 Subject: [New-bugs-announce] [issue42316] Walrus Operator in list index Message-ID: <1605029315.25.0.963262062958.issue42316@roundup.psfhosted.org> New submission from Brandon : Reading the PEP 572 document I don't see anything stating that Walrus operator in list indexes must be enclosed in parenthesis. Minimal Example: ''' In [1]: a = list(range(10)) In [2]: idx = -1 In [3]: a[idx := idx +1] File "", line 1 a[idx := idx +1] ^ SyntaxError: invalid syntax ''' If you enclose in parenthesis it works as expected: ''' In [4]: a[(idx := idx +1)] Out[4]: 0 In [5]: a[(idx := idx +1)] Out[5]: 1 In [6]: a[(idx := idx +1)] Out[6]: 2 ''' Is this a bug or am I misreading the PEP 572 document somewhere? It's not a top-level assignment nor is it a list comprehension so I would expect it to work in the first example. ---------- components: asyncio messages: 380691 nosy: Brando753, asvetlov, yselivanov priority: normal severity: normal status: open title: Walrus Operator in list index versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 14:35:37 2020 From: report at bugs.python.org (Dominik V.) Date: Tue, 10 Nov 2020 19:35:37 +0000 Subject: [New-bugs-announce] [issue42317] Docs of `typing.get_args`: Mention that due to caching of typing generics the order of arguments for Unions can be different from the one of the returned tuple Message-ID: <1605036937.3.0.364895182043.issue42317@roundup.psfhosted.org> New submission from Dominik V. : Due to caching of `__getitem__` for generic types, the order of arguments as returned by `get_args` might be different for Union: ```python >>> from typing import List, Union, get_args >>> get_args(get_args(List[Union[int, str]])[0]) (, ) >>> get_args(get_args(List[Union[str, int]])[0]) (, ) ``` This is because `List[Union[int, str]] is List[Union[str, int]]`. I understand that caching is useful to reduce the memory footprint of type hints, so I suggest to update the documentation of `get_args`. At the moment it reads: > For a typing object of the form X[Y, Z, ...] these functions return X and (Y, Z, ...). This seems to imply that the returned objects are identical to the ones in the form `X[Y, Z, ...]`. However that's not the case: ```python >>> U1 = Union[int, str] >>> U2 = Union[str, int] >>> get_args(List[U1])[0] is U1 True >>> get_args(List[U2])[0] is U2 False ``` I'm not so much concerned about the identity, but the fact that a subsequent call to `get_args` on the Union returns a different type seems to be relevant. So I propose to add the following sentence to the `get_args` docs: > [...], it gets normalized to the original class. > If `X` is a `Union`, the order of `(Y, Z, ...)` can be different from the one of the original arguments `[Y, Z, ...]`. Or alternatively: > [...], it gets normalized to the original class. > If `X` is a `Union`, the order of `(Y, Z, ...)` is arbitrary. The second version is shorter but it's not completely accurate (since the order is actually not arbitrary). ---------- assignee: docs at python components: Documentation messages: 380699 nosy: Dominik V., docs at python priority: normal severity: normal status: open title: Docs of `typing.get_args`: Mention that due to caching of typing generics the order of arguments for Unions can be different from the one of the returned tuple type: enhancement versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Nov 10 16:22:18 2020 From: report at bugs.python.org (Ronald Oussoren) Date: Tue, 10 Nov 2020 21:22:18 +0000 Subject: [New-bugs-announce] [issue42318] [tkinter] surrogate pairs in Tcl/Tk string when pasting an emoji in a text widget Message-ID: <1605043338.18.0.398355808071.issue42318@roundup.psfhosted.org> New submission from Ronald Oussoren : As mentioned in msg380552: I get an SyntaxError with message "utf-8' codec can't encode characters in position 7-12: surrogates not allowed." when I paste a smiley emoji in an IDLE interactive shell and try to execute that line, for example using: >>> print("?") The error is likely due to a surrogate pair being present in the UTF-8 representation of a Tcl/Tk string. It should be possible to work around this in _tkinter.c:unicodeFromTclStringAndSize by merging surrogate pairs. This is with: - Python 3.10 - macOS 11 (arm64) - Tk 8.6.10 With Tk 8.6.8 (as included in the macOS installers on python.org) printing won't work at all, as mentioned in bpo-42225. ---------- components: Tkinter, macOS messages: 380715 nosy: ned.deily, ronaldoussoren priority: normal severity: normal stage: needs patch status: open title: [tkinter] surrogate pairs in Tcl/Tk string when pasting an emoji in a text widget type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 02:59:55 2020 From: report at bugs.python.org (hongweipeng) Date: Wed, 11 Nov 2020 07:59:55 +0000 Subject: [New-bugs-announce] [issue42319] The `functools.singledispatchmethod` example in the document cannot run Message-ID: <1605081595.15.0.657429202369.issue42319@roundup.psfhosted.org> New submission from hongweipeng : https://docs.python.org/zh-cn/3.8/library/functools.html#functools.singledispatchmethod as the code: ``` from functools import singledispatchmethod class Negator: @singledispatchmethod @classmethod def neg(cls, arg): raise NotImplementedError("Cannot negate a") @neg.register @classmethod def _(cls, arg: int): return -arg @neg.register @classmethod def _(cls, arg: bool): return not arg ``` File "/root/.pyenv/versions/3.8.5/lib/python3.8/functools.py", line 907, in register return self.dispatcher.register(cls, func=method) File "/root/.pyenv/versions/3.8.5/lib/python3.8/functools.py", line 849, in register raise TypeError( TypeError: Invalid first argument to `register()`: . Use either `@register(some_class)` or plain `@register` on an annotated function. ---------- assignee: docs at python components: Documentation messages: 380741 nosy: docs at python, hongweipeng priority: normal severity: normal status: open title: The `functools.singledispatchmethod` example in the document cannot run versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 03:54:28 2020 From: report at bugs.python.org (Pierre van de Laar) Date: Wed, 11 Nov 2020 08:54:28 +0000 Subject: [New-bugs-announce] [issue42320] unexpected difference between map and list Message-ID: <1605084868.75.0.599724554356.issue42320@roundup.psfhosted.org> New submission from Pierre van de Laar : On windows, with python 3.9, with unittests, My test case fails when I use the following lines of code ``` result = map(lambda x: self.substitute_in_expression(x), sequence.sequence) ``` It works fine with ``` result = list() for x in sequence.sequence: result.append(self.substitute_in_expression(x)) ``` Note that result is used as input for an inherited class instantiation: ``` sequence_type = type(sequence) return sequence_type(result) ``` The classes are constructed using the dataclass decorator! I have unfortunately not have time to make a small reproducer. So I just send the whole project. ---------- files: bug.zip messages: 380742 nosy: Pierre van de Laar priority: normal severity: normal status: open title: unexpected difference between map and list type: behavior versions: Python 3.9 Added file: https://bugs.python.org/file49591/bug.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 06:09:04 2020 From: report at bugs.python.org (Maarten) Date: Wed, 11 Nov 2020 11:09:04 +0000 Subject: [New-bugs-announce] [issue42321] Limitations of building a static python library on Windows (MSVC) Message-ID: <1605092944.99.0.846170667375.issue42321@roundup.psfhosted.org> New submission from Maarten : `PCbuild/readme.txt` contains a little paragraph about how to build a static python library. The resulting static `python.lib` library contains all python C API functions. Windows DLL's don't allow missing symbols, so C extensions modules must link with a library containing the python C API symbols. When a C extension links to the static python library, it will contain a copy of all python symbols. This means that python C symbols are used twice: once by a static python.exe executable, and once for each C extension (_extension.pyw). Is there a way to use C extensions with a static Windows python.exe wuch that the python symbols are used only once? Does a statically built Windows python.exe support C extension modules at all? Thanks I'm currently working on a conan build recipe for cpython at https://github.com/conan-io/conan-center-index/pull/1510 Fow now, I'm disabling extensions on a static MSVC build. ---------- components: Windows messages: 380747 nosy: maarten, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Limitations of building a static python library on Windows (MSVC) versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 06:19:11 2020 From: report at bugs.python.org (Amir Naseredini) Date: Wed, 11 Nov 2020 11:19:11 +0000 Subject: [New-bugs-announce] [issue42322] Spectre mitigations in CPython interpreter Message-ID: <1605093551.24.0.524478744349.issue42322@roundup.psfhosted.org> New submission from Amir Naseredini : I was looking up everywhere and could not find any mitigations for Spectre attack by a Python interpreter(CPython)! I don't know if my question is correct or how feasible it is, but does anyone know if there are any mitigations for different variants of Spectre attacks Specter v1 (Spectre-PHT), v2 (Spectre-BTB), v4 (Spectre-STL) and v5 (Spectre-RSB) at the interpreter level for Python? Looking forward to hearing from you guys :) ---------- components: Interpreter Core messages: 380748 nosy: sahnaseredini priority: normal severity: normal status: open title: Spectre mitigations in CPython interpreter type: security versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 06:34:58 2020 From: report at bugs.python.org (STINNER Victor) Date: Wed, 11 Nov 2020 11:34:58 +0000 Subject: [New-bugs-announce] [issue42323] [AIX] test_math: test_nextafter(float('nan'), 1.0) does not return a NaN on AIX Message-ID: <1605094498.01.0.809514320528.issue42323@roundup.psfhosted.org> New submission from STINNER Victor : https://buildbot.python.org/all/#/builders/302/builds/338 FAIL: test_nextafter (test.test_math.MathTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/aixtools/buildarea/3.9.aixtools-aix-power6/build/Lib/test/test_math.py", line 1968, in test_nextafter self.assertIsNaN(math.nextafter(NAN, 1.0)) File "/home/aixtools/buildarea/3.9.aixtools-aix-power6/build/Lib/test/test_math.py", line 2015, in assertIsNaN self.fail("Expected a NaN, got {!r}.".format(value)) AssertionError: Expected a NaN, got 1.0. The test: # NaN self.assertIsNaN(math.nextafter(NAN, 1.0)) # <=== HERE self.assertIsNaN(math.nextafter(1.0, NAN)) self.assertIsNaN(math.nextafter(NAN, NAN)) The Linux manual page says: "If x or y is a NaN, a NaN is returned." https://man7.org/linux/man-pages/man3/nextafter.3.html But it seems like the AIX libc doesn't implement this rule. Should we implement this rule in Python on AIX? The strange thing is that it worked previously. test.python of build 338: platform.platform: AIX-2-00F9C1964C00-powerpc-32bit sysconfig[HOST_GNU_TYPE]: powerpc-ibm-aix7.2.4.0 platform.architecture: 32bit The latest green build is built 347. test.pythoninfo of build 347: platform.architecture: 32bit platform.platform: AIX-2-00F9C1964C00-powerpc-32bit sysconfig[HOST_GNU_TYPE]: powerpc-ibm-aix7.2.0.0 Was the machine updated two days ago (2020-11-09), between build 338 and build 347? ---------- components: Tests messages: 380751 nosy: lemburg, mark.dickinson, rhettinger, stutzbach, vstinner priority: normal severity: normal status: open title: [AIX] test_math: test_nextafter(float('nan'), 1.0) does not return a NaN on AIX versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 06:57:50 2020 From: report at bugs.python.org (Konrad Schwarz) Date: Wed, 11 Nov 2020 11:57:50 +0000 Subject: [New-bugs-announce] [issue42324] Doctest: directives Message-ID: <1605095870.49.0.104658534517.issue42324@roundup.psfhosted.org> New submission from Konrad Schwarz : In both PDF and HTML, the examples for Doctest directives don't actually show the directives themselves, perhaps because they syntactically start with a #. ---------- assignee: docs at python components: Documentation messages: 380752 nosy: docs at python, konrad.schwarz priority: normal severity: normal status: open title: Doctest: directives type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 08:57:47 2020 From: report at bugs.python.org (Skip Montanaro) Date: Wed, 11 Nov 2020 13:57:47 +0000 Subject: [New-bugs-announce] [issue42325] UnicodeDecodeError executing ./setup.py during build Message-ID: <1605103067.76.0.762518596297.issue42325@roundup.psfhosted.org> New submission from Skip Montanaro : I recently replaced Ubuntu 20.04 with Manjaro 20.2. In the process my Python builds broke in the sharedmods target of the Makefile. The tail end of the traceback is: ? File "/home/skip/src/python/cpython/./setup.py", line 246, in grep_headers_for ? ? if function in f.read(): ? File "/home/skip/src/python/cpython/Lib/codecs.py", line 322, in decode ? ? (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb4 in position 1600: invalid start byte The grep_headers_for() function in setup.py appeared to be the culprit, so I added a print statement to its loop: def grep_headers_for(function, headers): ? ? for header in headers: ? ? ? ? print("***", header, file=sys.stderr) ? ? ? ? with open(header, 'r') as f: ? ? ? ? ? ? if function in f.read(): ? ? ? ? ? ? ? ? return True ? ? return False which printed these lines: *** /usr/include/umfpack_report_perm.h *** /usr/include/dbstl_dbc.h *** /usr/include/itclTclIntStubsFcn.h *** /usr/include/dbstl_vector.h *** /usr/include/cholmod_blas.h *** /usr/include/amd.h *** /usr/include/m17n-X.h Sure enough, that m17n-X.h file (attached) doesn't contain utf-8 (my environment's encoding). According to the Emacs coding cookie at the end, the file is euc-japan encoded. Would simply catching the exception in grep_headers_for() be the correct way to deal with this? ---------- components: Build files: m17n-X.h messages: 380761 nosy: skip.montanaro priority: normal severity: normal status: open title: UnicodeDecodeError executing ./setup.py during build versions: Python 3.10 Added file: https://bugs.python.org/file49593/m17n-X.h _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 12:17:51 2020 From: report at bugs.python.org (MineRobber___T) Date: Wed, 11 Nov 2020 17:17:51 +0000 Subject: [New-bugs-announce] [issue42326] Add verify_callback hook capability to the SSL lib Message-ID: <1605115071.16.0.0518797822596.issue42326@roundup.psfhosted.org> New submission from MineRobber___T : The SSL library currently lacks the ability to accept a client certificate without attempting to verify it. To alleviate this issue, I was thinking that an attribute could be added to the ssl.SSLContext class along the lines of `verify_callback` (similar to how the SNI callback is handled) which would allow the implementation of custom cert verification. I'd be willing to help work on this, if I knew where to even begin. ---------- assignee: christian.heimes components: SSL messages: 380776 nosy: MineRobber9000, alex, christian.heimes, dstufft, janssen priority: normal severity: normal status: open title: Add verify_callback hook capability to the SSL lib type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 15:35:14 2020 From: report at bugs.python.org (Serhiy Storchaka) Date: Wed, 11 Nov 2020 20:35:14 +0000 Subject: [New-bugs-announce] [issue42327] Add PyModule_Add() Message-ID: <1605126914.46.0.774673816158.issue42327@roundup.psfhosted.org> New submission from Serhiy Storchaka : There is a design flaw in PyModule_AddObject(). It steals reference of its value only if the result is success. To avoid leaks it should be used in the following form: PyObject *tmp = ; if (PyModule_AddObject(name, name, tmp) < 0) { Py_XDECREF(tmp); goto error; } It is inconvenient and many code forgot to use a temporary variable and call Py_XDECREF(). It was not intention, but it is too late to change this behavior now, because some code calls Py_XDECREF() if PyModule_AddObject() fails. Fixing PyModule_AddObject() now will break hard such code. There was an idea to make the change gradual, controlled by a special macro (see issue26871). But it still has significant risk. I propose to add new function PyModule_Add() which always steals reference to its argument. It is more convenient and allows to get rid of temporary variable: if (PyModule_Add(name, name, ) < 0) { goto error; } I choose name PyModule_Add because it is short, and allow to write the call in one line with moderately long expression (like PyFloat_FromDouble(...) or PyLong_FromUnsignedLong(...)). ---------- components: C API messages: 380794 nosy: serhiy.storchaka, vstinner priority: normal severity: normal status: open title: Add PyModule_Add() type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 19:27:54 2020 From: report at bugs.python.org (Pat Thoyts) Date: Thu, 12 Nov 2020 00:27:54 +0000 Subject: [New-bugs-announce] [issue42328] ttk style.map function incorrectly handles the default state for element options. Message-ID: <1605140874.05.0.0614253934034.issue42328@roundup.psfhosted.org> New submission from Pat Thoyts : When cloning a ttk style it is useful to copy an existing style and make changes. We can copy the configuration and layout using: style.layout('Custom.TEntry', **style.layout('TEntry')) style.configure('Custom.TEntry', **style.configure('TEntry)) However, doing this with style.map can result in an exception. An example of this occurs for any style that has a defined default state in the map eg the TNotebook.Tab in the clam theme: >>> style.map('TNotebook.Tab','background') [('selected', '#dcdad5'), ('#bab5ab',)] However, calling Tk directly: >>> style.tk.call(style._name,"map","TNotebook.Tab","-background") (, '#dcdad5', , '#bab5ab') The second pair is defining the default state ('') to use color #bab5ab but this is being mangled by the code that converts this into pythons response. The culprit is ttk._list_from_statespec which treats the statespec with the empty string as None and drops it and then returns the value in place of the state and then puts in an empty value. ---------- components: Tkinter messages: 380798 nosy: patthoyts priority: normal severity: normal status: open title: ttk style.map function incorrectly handles the default state for element options. type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 21:23:03 2020 From: report at bugs.python.org (Gregory P. Smith) Date: Thu, 12 Nov 2020 02:23:03 +0000 Subject: [New-bugs-announce] [issue42329] typing classes do not have __name__ attributes in 3.7+ Message-ID: <1605147783.95.0.972217346071.issue42329@roundup.psfhosted.org> New submission from Gregory P. Smith : Python 3.7-3.10a1: ``` >>> List.__name__ Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.8/typing.py", line 760, in __getattr__ raise AttributeError(attr) AttributeError: __name__ >>> type(List) >>> type(List[int]) ``` Python 3.6: ``` >>> from typing import List >>> List.__name__ 'List' >>> type(List) >>> type(List[int]) ``` Is this lack of common meta attributes intentional? It makes the typing types unusual. We just saw it trip up some code that was expecting everything to have a `__name__` attribute while moving beyond 3.6. Judging by that `__getattr__` implementation it should happen on other common `__` attributes as mentioned in https://docs.python.org/3/library/stdtypes.html?highlight=__name__#special-attributes as well. ---------- components: Library (Lib) messages: 380801 nosy: gregory.p.smith priority: normal severity: normal stage: needs patch status: open title: typing classes do not have __name__ attributes in 3.7+ type: behavior versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Nov 11 22:57:13 2020 From: report at bugs.python.org (Saiansh Singh) Date: Thu, 12 Nov 2020 03:57:13 +0000 Subject: [New-bugs-announce] [issue42330] Add browsh in the webbrowser module Message-ID: <1605153434.0.0.062281491373.issue42330@roundup.psfhosted.org> New submission from Saiansh Singh : The webbrowser module is a module used to create a new tab or window inside browsers. It is currently built into python. It supports multiple terminal-based browsers but yet doesn't support browsh. Here is the documentation for browsh for more information: brow.sh. The repository is at: github.com/browsh-org/browsh. It runs firefox on headless and displays the websites inside the terminal. Happy to make a PR! ? ---------- components: Library (Lib) messages: 380802 nosy: saiansh2525 priority: normal severity: normal status: open title: Add browsh in the webbrowser module type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 12 02:08:49 2020 From: report at bugs.python.org (michalis aggela) Date: Thu, 12 Nov 2020 07:08:49 +0000 Subject: [New-bugs-announce] [issue42331] 'base64' has no attribute 'decodestring' Message-ID: <1605164929.5.0.192767282489.issue42331@roundup.psfhosted.org> New submission from michalis aggela : File "/Users/michaelmouchametai/Downloads/google-cloud-sdk/platform/gsutil/gslib/utils/encryption_helper.py", line 152, in Base64Sha256FromBase64EncryptionKey decoded_bytes = base64.decodestring(csek_encryption_key) AttributeError: module 'base64' has no attribute 'decodestring' ---------- components: Build messages: 380805 nosy: michalisaggela priority: normal severity: normal status: open title: 'base64' has no attribute 'decodestring' type: crash versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 12 07:04:09 2020 From: report at bugs.python.org (=?utf-8?q?Tin_Tvrtkovi=C4=87?=) Date: Thu, 12 Nov 2020 12:04:09 +0000 Subject: [New-bugs-announce] [issue42332] add __weakref__ to types.GenericAlias Message-ID: <1605182649.58.0.535979406085.issue42332@roundup.psfhosted.org> New submission from Tin Tvrtkovi? : For example, dict[int, int] cannot be used with singledispatch because types.GenericAlias doesn't support weak references. I'm an author of a third party library (https://github.com/Tinche/cattrs) for which this functionality would be useful. Here's a similar issue in typing (note that this issue is for *types*.GenericAlias) that was fixed: https://github.com/python/typing/issues/345 ---------- messages: 380816 nosy: gvanrossum, tinchester priority: normal severity: normal status: open title: add __weakref__ to types.GenericAlias type: enhancement versions: Python 3.10, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 12 12:19:18 2020 From: report at bugs.python.org (Christian Heimes) Date: Thu, 12 Nov 2020 17:19:18 +0000 Subject: [New-bugs-announce] [issue42333] Port ssl module to heap types and module state (PEP 573) Message-ID: <1605201558.44.0.0361525548575.issue42333@roundup.psfhosted.org> New submission from Christian Heimes : Move all objects to module state. Convert all types and extensions to heap types. ---------- messages: 380837 nosy: christian.heimes priority: normal severity: normal stage: patch review status: open title: Port ssl module to heap types and module state (PEP 573) type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 12 13:23:57 2020 From: report at bugs.python.org (autospamfighter) Date: Thu, 12 Nov 2020 18:23:57 +0000 Subject: [New-bugs-announce] [issue42334] Subclassing int and complex with keyword arguments weird Message-ID: <1605205437.83.0.0876606558976.issue42334@roundup.psfhosted.org> New submission from autospamfighter : I was trying to make a custom complex class that looked something like this and it failed. I replaced complex with int and it also failed, but I tried float and it worked. ---fail class A(complex): def __init__(self, test): super().__init__() A(test=5) ---fail class A(int): def __init__(self, test): super().__init__() A(test=5) ---work class A(float): def __init__(self, test): super().__init__() A(test=5) ---------- components: Library (Lib) messages: 380840 nosy: autospamfighter priority: normal severity: normal status: open title: Subclassing int and complex with keyword arguments weird versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 12 14:56:42 2020 From: report at bugs.python.org (Charles Staton) Date: Thu, 12 Nov 2020 19:56:42 +0000 Subject: [New-bugs-announce] [issue42335] Python Crashes Exception code 0xc0000374 ntdll.dll Message-ID: <1605211002.39.0.559634487384.issue42335@roundup.psfhosted.org> New submission from Charles Staton : Hello, I am experiencing crashes of Python 3.8.5 (32 bit) on multiple identical Windows 10 x64 (Enterprise 2016 LTSB) machines. The Crashes are of the sort with the Windows popup "Python has stopped working" and there is no traceback. The crashes occur sporadically. My program might run several days or just an hour, but invariably Python will crash if you wait long enough. I have attached a zip file containing all of the information provided by Windows in Application Logs, as well as some AppVerifier logs. I do not believe the AppVerifier logs are relevant however, as running my program with AppVerifier turned on causes Python to crash immediately upon startup and the information provided by Windows in Application Logs seems to indicate that it's AppVerifier crashing, not Python. My program is quite large and is importing several libraries. It has a PyQt5 GUI, and I'm using PyQt5's QThreadpool() to run several threads concurrently which do various things like: communicate with a web API (rauth, requests), communicate with a PLC (pyModbusTCP), communicate with another PLC (python-Snap7), communicate with an RS485 printer (pySerial), write CSV logs to a network drive, et. al. I'm running this program in a venv setup by PyCharm. The full information is in the attached zip file but here's an excerpt: Faulting application name: python.exe, version: 3.8.5150.1013, time stamp: 0x5f15bc04 Faulting module name: ntdll.dll, version: 10.0.14393.206, time stamp: 0x57dacde1 Exception code: 0xc0000374 Fault offset: 0x000d9841 Faulting process id: 0x1550 Faulting application start time: 0x01d6b839c684e37d Faulting application path: C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\python.exe Faulting module path: C:\Windows\SYSTEM32\ntdll.dll Report Id: 24636ab4-7c06-4cd6-b8f8-4e20bfc59dce Googling various clues has given me a vague clue that this is caused by Python attempting to access memory that it shouldn't. I have no idea how that happens or why. I'm clueless as to how I should go about troubleshooting this. If anyone can help I will be very grateful. ---------- components: Interpreter Core, Library (Lib), ctypes files: Python Crash Data.zip messages: 380847 nosy: strantor priority: normal severity: normal status: open title: Python Crashes Exception code 0xc0000374 ntdll.dll versions: Python 3.8 Added file: https://bugs.python.org/file49594/Python Crash Data.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 12 17:56:01 2020 From: report at bugs.python.org (Steve Dower) Date: Thu, 12 Nov 2020 22:56:01 +0000 Subject: [New-bugs-announce] [issue42337] Skip building web installers on Windows Message-ID: <1605221761.11.0.317239545027.issue42337@roundup.psfhosted.org> New submission from Steve Dower : In future releases, we won't be advertising the web-based installers anymore. They never got much use, and the shorter list of downloads will be more beneficial to users than saving 10-20MB worth of bandwidth. The web site change has already been made, and depending on when RMs pick up the newer script might impact any future release. For 3.10, at least, we can stop producing and uploading the web-based installer. It won't hurt to keep doing it, and the *_pdb.msi and *_d.msi files will remain (as those are always download on demand), but it can eventually stop being produced (should just be in Tools/msi/buildrelease.bat, IIRC). ---------- assignee: steve.dower components: Build, Windows messages: 380859 nosy: paul.moore, steve.dower, tim.golden, zach.ware priority: low severity: normal status: open title: Skip building web installers on Windows versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 12 18:06:15 2020 From: report at bugs.python.org (Jeff Moguillansky) Date: Thu, 12 Nov 2020 23:06:15 +0000 Subject: [New-bugs-announce] [issue42338] Enable Debug Build For Python Native Modules in Windows, with Visual Studio Toolchain Message-ID: <1605222375.66.0.305564714258.issue42338@roundup.psfhosted.org> New submission from Jeff Moguillansky : Hi, We developed a Python module that interfaces with native code via Cython. We currently build on Windows with Visual Studio Toolchain. We encounter the following issues when trying to build a debug version: 1) 3rd party modules installed via PIP are Release mode, but Visual Studio toolchain doesn't allow to mix Debug and Release libs. To workaround this issue, we build our module in "Release" mode, with debug symbols enabled, and with compiled optimization disabled (essentially a hack). 2) To build our module we currently use the following hack: step 1: run python.exe setup.py build --compiler=msvc step 2: extract the output step 3: change /Ox to /Od (disable compiler optimization) add /Zi flag to compiler flags (enable debug symbols) add /DEBUG flag to linker flags Please advise what is the best solution? ---------- components: Build messages: 380861 nosy: jmoguill2 priority: normal severity: normal status: open title: Enable Debug Build For Python Native Modules in Windows, with Visual Studio Toolchain type: compile error versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 12 21:19:41 2020 From: report at bugs.python.org (Jelle Geerts) Date: Fri, 13 Nov 2020 02:19:41 +0000 Subject: [New-bugs-announce] [issue42339] official embedded Python fails to import certain modules Message-ID: <1605233981.71.0.0380654118097.issue42339@roundup.psfhosted.org> New submission from Jelle Geerts : This problem happened with 'python-3.8.6-embed-amd64.zip' when trying to import certain modules. Note that this problem does NOT happen with Python from 'python-3.7.9-embed-amd64.zip' (its output is also attached below). It happened with 'import socket', 'import ctypes', and so on (see below). Platform: Windows 7 SP1 64-bit (also KB2999226 was installed) Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AM D64)] on win32 >>> import lzma Traceback (most recent call last): File "", line 1, in File "", line 259, in load_module File "lzma.py", line 27, in ImportError: DLL load failed while importing _lzma: De parameter is onjuist. >>> import socket Traceback (most recent call last): File "", line 1, in File "", line 259, in load_module File "socket.py", line 49, in ImportError: DLL load failed while importing _socket: De parameter is onjuist. >>> import ctypes Traceback (most recent call last): File "", line 1, in File "", line 259, in load_module File "ctypes\__init__.py", line 7, in ImportError: DLL load failed while importing _ctypes: De parameter is onjuist. >>> import bz2 Traceback (most recent call last): File "", line 1, in File "", line 259, in load_module File "bz2.py", line 19, in ImportError: DLL load failed while importing _bz2: De parameter is onjuist. >>> For comparison, with Python from 'python-3.7.9-embed-amd64.zip' it does work: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32 >>> import lzma >>> import socket >>> import ctypes >>> import bz2 >>> ---------- components: Installation messages: 380867 nosy: bughunter2 priority: normal severity: normal status: open title: official embedded Python fails to import certain modules type: crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Nov 12 21:20:05 2020 From: report at bugs.python.org (Benjamin Fogle) Date: Fri, 13 Nov 2020 02:20:05 +0000 Subject: [New-bugs-announce] [issue42340] KeyboardInterrupt should come with a warning Message-ID: <1605234005.33.0.891581452406.issue42340@roundup.psfhosted.org> New submission from Benjamin Fogle : This is related to bpo-29988, and I'm happy to move this to there. I made this a separate issue because this is a workaround, not a fix as was being discussed there. Also unlike bpo-29988, this is not restricted to context managers or finally blocks. TL;DR: Raising exceptions from interrupt handlers (most notably KeyboardInterrupt) can wreak havoc in ways that are impossible to fix. This should be noted in the documentation, with a workaround. I've attached a few example scripts that cause various strange behavior on Linux when a KeyboardInterrupt is raised at just the right time. There are likely many, many more possible examples: - sigint_condition_1.py: Cause a deadlock with threading.Condition - sigint_condition_2.py: Cause a double-release and/or notify on unacquired threading.Condition - sigint_tempfile.py: Cause NamedTemporaryFiles to not be deleted - sigint_zipfile.py: Cause ZipExtFile to corrupt its state When a user presses Ctrl+C, a KeyboardInterrupt will be raised on the main thread at some later time. This exception may be raised after any bytecode, and most Python code, including the standard library, is not designed to handle exceptions that spring up from nowhere. As a simple example, consider threading.Condition: def __enter__(self): return self._lock.__enter__() The KeyboardInterrupt could be raised just prior to return. In this case, __exit__ will never be called, and the underlying lock will remain acquired. A similar problem occurs if KeyboardInterrupt occurs at the start of __exit__. This can be mitigated by attempting to catch a KeyboardInterrupt *absolutely everywhere*, but even then, it can't be fixed completely. def __enter__(self): try: # it could happen here, in which case we should not unlock ret = self._lock.__enter__() # it could happen here, in which case we must unlock except KeyboardInterrupt: # it could, in theory, happen again right here ... raise return ret # it could happen here, which is the same problem we had before This is not restricted to context handlers or try/finally blocks. The zipfile module is a good example of code that is almost certain to enter an inconsistent state if a KeyboardInterrupt is raised while it's doing work: class ZipExtFile: ... def read1(self, n): ... self._readbuffer = b'' # what happens if KeyboardInterrupt happens here? self._offset = 0 ... Due to how widespread this is, it's not worth "fixing". (And honestly, it seems to be a rare problem in practice.) I believe that it would be better to clearly document that KeyboardInterrupt (or any exception propagated from a signal handler) may leave the system in an inconsistent state. Complex or high reliability applications should avoid catching KeyboardInterrupt as a way of gracefully shutting down, and should prefer registering their own SIGINT handler. They should also avoid raising exceptions from signal handlers at all. ---------- assignee: docs at python components: Documentation messages: 380868 nosy: benfogle, docs at python priority: normal severity: normal status: open title: KeyboardInterrupt should come with a warning type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 01:22:54 2020 From: report at bugs.python.org (Mike Frysinger) Date: Fri, 13 Nov 2020 06:22:54 +0000 Subject: [New-bugs-announce] [issue42341] xml.dom.minidom parsing omits Text nodes in top level Message-ID: <1605248574.32.0.904298964211.issue42341@roundup.psfhosted.org> New submission from Mike Frysinger : $ python3 Python 3.8.5 (default, Aug 2 2020, 15:09:07) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from xml.dom import minidom # Lets parse a simple XML file with comment & text nodes in the top level. >>> dom = minidom.parseString('\n\n\n
\n\n\n
\n') # Where did those newlines get to outside of
? >>> dom.toxml() '
\n\n\n
' # No Text nodes in the root list :(. >>> dom.childNodes [, , ] # But they all exist fine under
. >>> dom.childNodes[2].childNodes [, , , , ] ---------- components: XML messages: 380872 nosy: vapier priority: normal severity: normal status: open title: xml.dom.minidom parsing omits Text nodes in top level versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 05:23:37 2020 From: report at bugs.python.org (Ed Catmur) Date: Fri, 13 Nov 2020 10:23:37 +0000 Subject: [New-bugs-announce] [issue42342] asyncio.open_connection(local_addr=('localhost', port)) fails with TypeError: AF_INET address must be a pair (host, port) Message-ID: <1605263017.45.0.821115077968.issue42342@roundup.psfhosted.org> New submission from Ed Catmur : Context: CentOS 7.8.2003, Python 3.8 from SCL. localhost has IPv4 and IPv6 bindings, IPv6 first: $ python -c "import socket;print(socket.getaddrinfo('localhost',0,type=socket.SOCK_STREAM))" [(, , 6, '', ('::1', 0, 0, 0)), (, , 6, '', ('127.0.0.1', 0))] import asyncio async def main(): await asyncio.open_connection('localhost', 9990, local_addr=('localhost', 9991)) asyncio.run(main()) Traceback (most recent call last): File "async.py", line 4, in asyncio.run(main()) File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/runners.py", line 43, in run return loop.run_until_complete(main) File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/base_events.py", line 608, in run_until_complete return future.result() File "async.py", line 3, in main await asyncio.open_connection('10.10.10.10', 9990, local_addr=('localhost', 9991)) File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/streams.py", line 52, in open_connection transport, _ = await loop.create_connection( File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/base_events.py", line 1002, in create_connection sock = await self._connect_sock( File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/base_events.py", line 904, in _connect_sock sock.bind(laddr) TypeError: AF_INET address must be a pair (host, port) It looks like this has a similar root cause to issue 35302 - we should be filtering local addrinfos by family for valid combinations. ---------- components: asyncio messages: 380874 nosy: asvetlov, ecatmur2, yselivanov priority: normal severity: normal status: open title: asyncio.open_connection(local_addr=('localhost', port)) fails with TypeError: AF_INET address must be a pair (host, port) type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 06:17:53 2020 From: report at bugs.python.org (Antti Haapala) Date: Fri, 13 Nov 2020 11:17:53 +0000 Subject: [New-bugs-announce] [issue42343] threading.local documentation should be on the net... Message-ID: <1605266273.51.0.273989729799.issue42343@roundup.psfhosted.org> New submission from Antti Haapala : The current documentation of `thread.local` is ---- Thread-Local Data Thread-local data is data whose values are thread specific. To manage thread-local data, just create an instance of local (or a subclass) and store attributes on it: mydata = threading.local() mydata.x = 1 The instance?s values will be different for separate threads. class threading.local A class that represents thread-local data. For more details and extensive examples, see the documentation string of the _threading_local module. ---- There is no link to the `_threading_local` module docs in the documentation and none of the content from the modules docstrings appear anywhere on docs.python.org website. This is rather annoying because the docstring contains completely non-trivial information including that threading.local can be subclassed and that the __init__ will be run once for each thread for each instance where attributes are accessed. ---------- assignee: docs at python components: Documentation messages: 380875 nosy: docs at python, ztane priority: normal severity: normal status: open title: threading.local documentation should be on the net... type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 08:42:06 2020 From: report at bugs.python.org (=?utf-8?q?J=C3=BCrgen_Gmach?=) Date: Fri, 13 Nov 2020 13:42:06 +0000 Subject: [New-bugs-announce] [issue42344] SimpleNamespace: update documentation regarding comparison Message-ID: <1605274926.75.0.147847269171.issue42344@roundup.psfhosted.org> New submission from J?rgen Gmach : When tinkering around with `SimpleNamespace` I tried to figure out the reasons for using it over just the `class NS: pass` alternative. One reason is the comparison, which is not a plain `id` comparison, but an attribute comparison. When looking at the documentation of the imaginary python implementation, where only dicts are compared, the reader (me) could think you can compare it to classes. https://docs.python.org/3/library/types.html?highlight=simplenamespace#types.SimpleNamespace ``` >>> from types import SimpleNamespace >>> simple_ns = SimpleNamespace(a=1, b="two") >>> class NS: pass >>> class_ns = NS() >>> class_ns.a = 1 >>> class_ns.b = "two" >>> simple_ns == class_ns >>> False ``` Actually, the C implementation compares the types, too. https://github.com/python/cpython/blob/bc777047833256bc6b10b2c7b46cce9e9e6f956c/Objects/namespaceobject.c#L163-L171 While the documentation says the Python impl is "roughly equivalent", I's still suggest to update the documentation. If there is some agreement, I'd create a pull request. ---------- messages: 380882 nosy: jugmac00 priority: normal severity: normal status: open title: SimpleNamespace: update documentation regarding comparison _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 09:11:55 2020 From: report at bugs.python.org (Dominik V.) Date: Fri, 13 Nov 2020 14:11:55 +0000 Subject: [New-bugs-announce] [issue42345] Equality of typing.Literal depends on the order of arguments Message-ID: <1605276715.65.0.853257843244.issue42345@roundup.psfhosted.org> New submission from Dominik V. : [PEP 586](https://www.python.org/dev/peps/pep-0586/#shortening-unions-of-literals) specifies that Literal[v1, v2, v3] is equivalent to Union[Literal[v1], Literal[v2], Literal[v3]] Since the equality of Unions doesn't take into account the order of arguments, Literals parametrized with multiple arguments should not be order dependent either. However they seem to: >>> Literal[1, 2] == Literal[2, 1] False Compare with the equivalent form: >>> Union[Literal[1], Literal[2]] == Union[Literal[2], Literal[1]] True In addition to that, the PEP specifies that nested Literals should be equivalent to the flattened version (https://www.python.org/dev/peps/pep-0586/#legal-parameters-for-literal-at-type-check-time). This section is titled "Legal parameters for Literal at type check time" but since the PEP doesn't specify runtime behavior differently, I think it makes sense to assume it is the same. It seems to be different though: >>> Literal[Literal[1, 2], 3] typing.Literal[typing.Literal[1, 2], 3] >>> Literal[Literal[1, 2], 3] == Literal[1, 2, 3] False Also the flattening follows from the above definition `Literal[v1, v2, v3] == Union[Literal[v1], Literal[v2], Literal[v3]]` and the fact that Unions are flattened. ---------- messages: 380888 nosy: Dominik V. priority: normal severity: normal status: open title: Equality of typing.Literal depends on the order of arguments type: behavior versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 09:23:09 2020 From: report at bugs.python.org (STINNER Victor) Date: Fri, 13 Nov 2020 14:23:09 +0000 Subject: [New-bugs-announce] [issue42346] [subinterpreters] Deny os.fork() in subinterpreters? Message-ID: <1605277389.1.0.366726177524.issue42346@roundup.psfhosted.org> New submission from STINNER Victor : _PyInterpreterState_DeleteExceptMain() contains the following check: PyThreadState *tstate = _PyThreadState_Swap(gilstate, NULL); if (tstate != NULL && tstate->interp != runtime->interpreters->main) { return _PyStatus_ERR("not main interpreter"); } os.fork() is allow in subinterpreters and PyOS_AfterFork_Child() doesn't seem to update runtime->interpreters->main. Either we should update runtime->interpreters->main after fork in the child process, or os.fork() should be denied in subinterpreters. In bpo-37266, I denied the creation of daemon threads in subinterpreters. But I had to revert this change: see bpo-40234. ---------- components: Subinterpreters messages: 380891 nosy: vstinner priority: normal severity: normal status: open title: [subinterpreters] Deny os.fork() in subinterpreters? versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 09:54:33 2020 From: report at bugs.python.org (Ash Holland) Date: Fri, 13 Nov 2020 14:54:33 +0000 Subject: [New-bugs-announce] [issue42347] loop.call_exception_handler documentation is lacking Message-ID: <1605279273.64.0.105745281435.issue42347@roundup.psfhosted.org> New submission from Ash Holland : The call_exception_handler documentation lists seven permissible context keys, but the docstring lists nine, and there are two keys referred to in the default_exception_handler implementation that aren't listed in either. The docstring (but not the documentation) mentions "task" ("Task instance") and "asyncgen" ("Asynchronous generator that caused the exception."), though at least "asyncgen" doesn't appear to be used in any exception handler in stdlib as far as I can tell. No documentation mentions "source_traceback" or "handle_traceback", but they're used by the default exception handler and are also provided by e.g. aiohttp: https://github.com/aio-libs/aiohttp/blob/a8d9ec3f1667463e80545b1cacc7833d1ff305e9/aiohttp/client_reqrep.py#L750 ---------- assignee: docs at python components: Documentation, asyncio messages: 380895 nosy: asvetlov, docs at python, sorrel, yselivanov priority: normal severity: normal status: open title: loop.call_exception_handler documentation is lacking type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 10:38:16 2020 From: report at bugs.python.org (Batuhan Taskaya) Date: Fri, 13 Nov 2020 15:38:16 +0000 Subject: [New-bugs-announce] [issue42348] Language Reference: Set items Message-ID: <1605281896.65.0.701198414223.issue42348@roundup.psfhosted.org> New submission from Batuhan Taskaya : The data types section of the language reference (https://docs.python.org/3.10/reference/datamodel.html#the-standard-type-hierarchy) has this description directly under the Set type (which has 2 childs, set and frozenset). > These represent unordered, finite sets of unique, immutable objects. I feel like this wording is a bit confusing, considering the items doesn't have to be immutable at all. Can we replace this with hashable? ---------- messages: 380901 nosy: BTaskaya priority: normal severity: normal status: open title: Language Reference: Set items _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 12:23:56 2020 From: report at bugs.python.org (Mark Shannon) Date: Fri, 13 Nov 2020 17:23:56 +0000 Subject: [New-bugs-announce] [issue42349] Compiler front-end produces a broken CFG Message-ID: <1605288236.63.0.535930114151.issue42349@roundup.psfhosted.org> New submission from Mark Shannon : The front-end of the bytecode compiler produces a broken CFG. A number of "basic-block"s have terminators before their end. This makes the back-end optimizations unsafe as they rely of a well-formed CFG. The fix is simple. Insert a check that the CFG is well-formed before doing any optimizations, then fix up the front-end. Once done, we can be more aggressive with optimizations without worrying that things will break for no apparent reason. ---------- assignee: Mark.Shannon messages: 380911 nosy: BTaskaya, Mark.Shannon, pablogsal, yselivanov priority: normal severity: normal status: open title: Compiler front-end produces a broken CFG type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 12:51:36 2020 From: report at bugs.python.org (STINNER Victor) Date: Fri, 13 Nov 2020 17:51:36 +0000 Subject: [New-bugs-announce] [issue42350] Calling os.fork() at Python exit logs: AttributeError: 'NoneType' object has no attribute '_at_fork_reinit' Message-ID: <1605289896.09.0.326897860295.issue42350@roundup.psfhosted.org> New submission from STINNER Victor : The following code logs an error: --- Exception ignored in: Traceback (most recent call last): File "/home/vstinner/python/master/Lib/threading.py", line 1508, in _after_fork thread._reset_internal_locks(True) File "/home/vstinner/python/master/Lib/threading.py", line 847, in _reset_internal_locks self._tstate_lock._at_fork_reinit() AttributeError: 'NoneType' object has no attribute '_at_fork_reinit' --- Code: --- #!/usr/bin/python3 import atexit import subprocess def preexec(): pass def exit_handler(): proc = subprocess.Popen( ["pwd"], preexec_fn=preexec, ) proc.communicate() if __name__ == "__main__": atexit.register(exit_handler) --- It is a regression caused by the following bpo-40089 fix: commit 87255be6964979b5abdc4b9dcf81cdcfdad6e753 Author: Victor Stinner Date: Tue Apr 7 23:11:49 2020 +0200 bpo-40089: Add _at_fork_reinit() method to locks (GH-19195) ---------- components: Library (Lib) messages: 380912 nosy: vstinner priority: normal severity: normal status: open title: Calling os.fork() at Python exit logs: AttributeError: 'NoneType' object has no attribute '_at_fork_reinit' versions: Python 3.10, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 12:59:24 2020 From: report at bugs.python.org (E. Paine) Date: Fri, 13 Nov 2020 17:59:24 +0000 Subject: [New-bugs-announce] [issue42351] Setup.py: UnicodeDecodeError in grep_headers_for Message-ID: <1605290364.26.0.484718067569.issue42351@roundup.psfhosted.org> New submission from E. Paine : When compiling the master branch (i.e. running 'make'), I get a UnicodeDecodeError as follows: Traceback (most recent call last): File "/home/elisha/Documents/Python/cp0/cpython/./setup.py", line 2619, in main() File "/home/elisha/Documents/Python/cp0/cpython/./setup.py", line 2589, in main setup(# PyPI Metadata (PEP 301) File "/home/elisha/Documents/Python/cp0/cpython/Lib/distutils/core.py", line 148, in setup dist.run_commands() File "/home/elisha/Documents/Python/cp0/cpython/Lib/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/home/elisha/Documents/Python/cp0/cpython/Lib/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/elisha/Documents/Python/cp0/cpython/Lib/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/home/elisha/Documents/Python/cp0/cpython/Lib/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/elisha/Documents/Python/cp0/cpython/Lib/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/elisha/Documents/Python/cp0/cpython/Lib/distutils/command/build_ext.py", line 340, in run self.build_extensions() File "/home/elisha/Documents/Python/cp0/cpython/./setup.py", line 471, in build_extensions self.detect_modules() File "/home/elisha/Documents/Python/cp0/cpython/./setup.py", line 1825, in detect_modules self.detect_ctypes() File "/home/elisha/Documents/Python/cp0/cpython/./setup.py", line 2205, in detect_ctypes if grep_headers_for('ffi_prep_cif_var', ffi_headers): File "/home/elisha/Documents/Python/cp0/cpython/./setup.py", line 246, in grep_headers_for if function in f.read(): File "/home/elisha/Documents/Python/cp0/cpython/Lib/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 4210: invalid start byte The problematic file it is trying to read is /usr/include/OMX_Other.h which is part of the libomxil-bellagio package (a copy of this package can be downloaded from https://www.archlinux.org/packages/extra/x86_64/libomxil-bellagio/download/). More specifically, there are several characters in the comments which cannot be decoded correctly (the first of these is on line 93). The fix is a very simple one and is just to add errors='replace' to line 244 of setup.py (I cannot see this having any ill-effects). I couldn't find who to nosy for this so apologies about that. ---------- components: Build messages: 380913 nosy: epaine priority: normal severity: normal status: open title: Setup.py: UnicodeDecodeError in grep_headers_for type: compile error versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 13:47:56 2020 From: report at bugs.python.org (Ross Barnowski) Date: Fri, 13 Nov 2020 18:47:56 +0000 Subject: [New-bugs-announce] [issue42352] A string representation of slice objects with colon syntax Message-ID: <1605293276.23.0.88839506976.issue42352@roundup.psfhosted.org> New submission from Ross Barnowski : It would be nice if there were a way to get a string representation of a slice object in extended indexing syntax, e.g. ``` >>> myslice = slice(None, None, 2) >>> print(myslice) '::2' ``` One motivating use-case is in descriptive error messages, e.g. ``` TypeError(f"Can't slice {myobj}, try list({myobj})[{myslice}]") ``` In this case, it is much more natural for `myslice` to use the extended indexing syntax than the slice str/repr. Perhaps this could be done via __str__, or if that is too big a change, maybe via __format__ e.g. `f"{myslice:asidx}"` It's simple enough to write a conversion function, but this feels like a feature that would fit best upstream. I searched the issue tracker, PRs on GitHub, and the Python documentation and didn't see any related issues/PRs/articles. xref: https://github.com/networkx/networkx/pull/4304 ---------- messages: 380921 nosy: rossbar priority: normal severity: normal status: open title: A string representation of slice objects with colon syntax type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 14:27:03 2020 From: report at bugs.python.org (Gregory P. Smith) Date: Fri, 13 Nov 2020 19:27:03 +0000 Subject: [New-bugs-announce] [issue42353] Proposal: re.prefixmatch method (alias for re.match) Message-ID: <1605295623.12.0.914188426549.issue42353@roundup.psfhosted.org> New submission from Gregory P. Smith : A well known anti-pattern in Python is use of re.match when you meant to use re.search. re.fullmatch was added in 3.4 via https://bugs.python.org/issue16203 for similar reasons. re.prefixmatch would be similar: we want the re.match behavior, but want the code to be obvious about its intent. This documents the implicit ^ in the name. The goal would be to allow linters to ultimately flag re.match as the anti-pattern when in 3.10+ mode. Asking people to use re.prefixmatch or re.search instead. This would help avoid bugs where people mean re.search but write re.match. The implementation is trivial. This is **not** a decision to deprecate the widely used in 25 years worth of code's re.match name. That'd be painful and is unlikely to be worth doing without spreading it over a 8+ year timeline. ---------- components: Library (Lib) messages: 380928 nosy: gregory.p.smith priority: normal severity: normal stage: needs patch status: open title: Proposal: re.prefixmatch method (alias for re.match) type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Nov 13 15:00:30 2020 From: report at bugs.python.org (Trey Hunner) Date: Fri, 13 Nov 2020 20:00:30 +0000 Subject: [New-bugs-announce] [issue42354] Tuple unpacking with * causes SyntaxError in with ... as ... Message-ID: <1605297630.46.0.898037335486.issue42354@roundup.psfhosted.org> New submission from Trey Hunner : The below code worked on Python 3.5, 3.6, 3.7, and 3.8, but it now crashes on Python 3.9. from contextlib import contextmanager @contextmanager def open_files(names): yield names # This would actually return file objects with open_files(['file1.txt', 'file2.txt']) as (first, *rest): print(first, rest) The error shown is: with open_files(['file1.txt', 'file2.txt']) as (first, *rest): ^ SyntaxError: invalid syntax ---------- messages: 380932 nosy: trey priority: normal severity: normal status: open title: Tuple unpacking with * causes SyntaxError in with ... as ... type: behavior versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 14 05:27:36 2020 From: report at bugs.python.org (Batuhan Taskaya) Date: Sat, 14 Nov 2020 10:27:36 +0000 Subject: [New-bugs-announce] [issue42355] symtable: get_namespace doesn't check whether if there are multiple namespaces or no namespaces at all Message-ID: <1605349656.21.0.301673967264.issue42355@roundup.psfhosted.org> New submission from Batuhan Taskaya : >>> table = symtable.symtable("A = 1", "", "exec") >>> table.lookup("A") >>> table.lookup("A").get_namespace() Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.10/symtable.py", line 312, in get_namespace raise ValueError("name is bound to multiple namespaces") ValueError: name is bound to multiple namespaces >>> table.lookup("A").get_namespaces() () ---------- assignee: BTaskaya components: Library (Lib) messages: 380969 nosy: BTaskaya, benjamin.peterson priority: normal severity: normal status: open title: symtable: get_namespace doesn't check whether if there are multiple namespaces or no namespaces at all versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 14 06:36:46 2020 From: report at bugs.python.org (Tomek H) Date: Sat, 14 Nov 2020 11:36:46 +0000 Subject: [New-bugs-announce] [issue42356] Dict inline manipulations Message-ID: <1605353806.22.0.174145034354.issue42356@roundup.psfhosted.org> New submission from Tomek H : With Python3.9 there is a great feature for merging `dict`s: {1: 'a'} | {2: 'b'} => {1: 'a', 2: 'b'} It would be very handy to filter out a dict with a similar fashion (for example & operator with a list/tuple/frozenset of keys you want to get back): {1: 'a', 2: 'b', 3: 'c'} & [1, 3, 4] == {1: 'a', 3: 'c'} {1: 'a', 2: 'b', 3: 'c'} & {1, 3, 4} == {1: 'a', 3: 'c'} Also, omitting specified keys (for example - operator with a list/tuple/frozenset of keys you want to suppress): {1: 'a', 2: 'b', 3: 'c'} - [3, 4] == {1: 'a', 2: 'b'} {1: 'a', 2: 'b', 3: 'c'} - {3, 4} == {1: 'a', 2: 'b'} Regards! ---------- components: Interpreter Core messages: 380972 nosy: tomek.hlawiczka priority: normal severity: normal status: open title: Dict inline manipulations type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 14 10:36:37 2020 From: report at bugs.python.org (Maiyun Zhang) Date: Sat, 14 Nov 2020 15:36:37 +0000 Subject: [New-bugs-announce] [issue42357] Wrong Availability for signal.SIGCHLD Message-ID: <1605368197.47.0.575674573541.issue42357@roundup.psfhosted.org> New submission from Maiyun Zhang : The availability for `signal.SIGCHLD` is not correct. This seems to be present since Python 3.7 ---------- assignee: docs at python components: Documentation messages: 380981 nosy: docs at python, myzhang1029 priority: normal severity: normal status: open title: Wrong Availability for signal.SIGCHLD versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 14 15:01:41 2020 From: report at bugs.python.org (Dennis Clarke) Date: Sat, 14 Nov 2020 20:01:41 +0000 Subject: [New-bugs-announce] [issue42358] Python 3.9.0 unable to detect ax_cv_c_float_words_bigendian value on nigendan system Message-ID: <1605384101.77.0.568061256015.issue42358@roundup.psfhosted.org> New submission from Dennis Clarke : Seems related to issue42173 where the idea on the table was, simply to drop Solaris support and to quote Mr Stinner to "let the code slowly die". Regardless of this sort of neglect there are people who do try to use Python on big endian risc systems such as Solaris or Debian Linux in fact. Wherein a trivial configure reveals : alpha$ ../Python-3.9.0/configure --prefix=/opt/bw \ > --enable-shared --disable-optimizations \ > --enable-loadable-sqlite-extensions \ > --enable-ipv6 --with-pydebug --without-dtrace \ > --with-openssl=/opt/bw --with-ssl-default-suites=openssl \ > --without-gcc configure: WARNING: unrecognized options: --without-gcc checking build system type... sparc-sun-solaris2.10 checking host system type... sparc-sun-solaris2.10 checking for python3.9... no checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... "sunos5" checking for gcc... /opt/developerstudio12.6/bin/cc -std=iso9899:2011 -m64 -xarch=sparc -g -errfmt=error -errshort=full -xstrconst -xildoff -xmemalign=8s -xnolibmil -xcode=pic32 -xregs=no%appl -xlibmieee -mc -ftrap=%none -xbuiltin=%none -xunroll=1 -xs -xdebugformat=dwarf -errtags=yes -errwarn=%none -erroff=%none -L/opt/bw/lib -R/opt/bw/lib checking whether the C compiler works... yes . . . checking for __fpu_control... no checking for __fpu_control in -lieee... no checking for --with-libm=STRING... default LIBM="-lm" checking for --with-libc=STRING... default LIBC="" checking for x64 gcc inline assembler... no checking whether float word ordering is bigendian... unknown configure: error: Unknown float word ordering. You need to manually preset ax_cv_c_float_words_bigendian=no (or yes) according to your system. So it seems that the m4/ax_c_float_words_bigendian.m4 needs to be manually hacked or the configure script itself is at fault. I will give this a try on big endian IBM Power and also IBM Power9 ppc64le as well as FreeBSD running in RISC-V rv64imafdc little endian and see what happens. I suspect that the little endian systems will be no great concern as the bulk of Python devs seem to have never seen anything else other than little endian systems running Red Hat. To hack around this floating point endian test with blunt force : alpha$ alpha$ diff -u configure.orig configure --- configure.orig Mon Oct 5 15:07:58 2020 +++ configure Sat Nov 14 19:37:13 2020 @@ -14425,7 +14425,7 @@ else -ax_cv_c_float_words_bigendian=unknown +ax_cv_c_float_words_bigendian=yes cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14442,9 +14442,9 @@ fi if $GREP seesnoon conftest.$ac_objext >/dev/null ; then if test "$ax_cv_c_float_words_bigendian" = unknown; then - ax_cv_c_float_words_bigendian=no + ax_cv_c_float_words_bigendian=yes else - ax_cv_c_float_words_bigendian=unknown + ax_cv_c_float_words_bigendian=yes fi fi alpha$ alpha$ diff -u m4/ax_c_float_words_bigendian.m4.orig m4/ax_c_float_words_bigendian.m4 --- m4/ax_c_float_words_bigendian.m4.orig Mon Oct 5 15:07:58 2020 +++ m4/ax_c_float_words_bigendian.m4 Sat Nov 14 19:35:44 2020 @@ -42,7 +42,7 @@ [AC_CACHE_CHECK(whether float word ordering is bigendian, ax_cv_c_float_words_bigendian, [ -ax_cv_c_float_words_bigendian=unknown +ax_cv_c_float_words_bigendian=yes AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0; @@ -54,9 +54,9 @@ fi if $GREP seesnoon conftest.$ac_objext >/dev/null ; then if test "$ax_cv_c_float_words_bigendian" = unknown; then - ax_cv_c_float_words_bigendian=no + ax_cv_c_float_words_bigendian=yes else - ax_cv_c_float_words_bigendian=unknown + ax_cv_c_float_words_bigendian=yes fi fi alpha$ This is a hack of course and it gets past the endian test sickness. Shortly thereafter the compile fails due to a trivial C99 code problem : /opt/developerstudio12.6/bin/cc -std=iso9899:2011 -m64 -xarch=sparc -g -errfmt=error -errshort=full -xstrconst -xildoff -xmemalign=8s -xnolibmil -xcode=pic32 -xregs=no%appl -xlibmieee -mc -ftrap=%none -xbuiltin=%none -xunroll=1 -xs -xdebugformat=dwarf -errtags=yes -errwarn=%none -erroff=%none -L/opt/bw/lib -R/opt/bw/lib -c -O -std=iso9899:2011 -m64 -xarch=sparc -g -errfmt=error -errshort=full -xstrconst -xildoff -xmemalign=8s -xnolibmil -xcode=pic32 -xregs=no%appl -xlibmieee -mc -ftrap=%none -xbuiltin=%none -xunroll=1 -xs -xdebugformat=dwarf -errtags=yes -errwarn=%none -erroff=%none -L/opt/bw/lib -R/opt/bw/lib -D_REENTRANT -std=iso9899:2011 -m64 -xarch=sparc -g -errfmt=error -errshort=full -xstrconst -xildoff -xmemalign=8s -xnolibmil -xcode=pic32 -xregs=no%appl -xlibmieee -mc -ftrap=%none -xbuiltin=%none -xunroll=1 -xs -xdebugformat=dwarf -errtags=yes -errwarn=%none -erroff=%none -L/opt/bw/lib -R/opt/bw/lib -I../Python-3.9.0/Include/internal -IObjects -IInclude -IPython -I. -I../Python-3.9.0/Include -I/opt/bw/include -D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -I/opt/bw/include -D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -xcode=pic32 -DPy_BUILD_CORE -o Objects/exceptions.o ../Python-3.9.0/Objects/exceptions.c "../Python-3.9.0/Objects/exceptions.c", line 2313: error: void function cannot return value cc: acomp failed for ../Python-3.9.0/Objects/exceptions.c gmake: *** [Makefile:1781: Objects/exceptions.o] Error 2 However that is a separate issue that has been around for at least a year or so. 2313 return Py_TYPE(self)->tp_free((PyObject *)self); ??? Why try to return anything here ? Why can we not do the same as line 2319 ? 2306 2307 static void 2308 MemoryError_dealloc(PyBaseExceptionObject *self) 2309 { 2310 BaseException_clear(self); 2311 2312 if (!Py_IS_TYPE(self, (PyTypeObject *) PyExc_MemoryError)) { 2313 Py_TYPE(self)->tp_free((PyObject *)self); 2314 } 2315 2316 _PyObject_GC_UNTRACK(self); 2317 2318 if (memerrors_numfree >= MEMERRORS_SAVE) 2319 Py_TYPE(self)->tp_free((PyObject *)self); 2320 else { 2321 self->dict = (PyObject *) memerrors_freelist; 2322 memerrors_freelist = self; 2323 memerrors_numfree++; 2324 } 2325 } 2326 The compile may then continue but eventually a bucket of tests fail. Perhaps an Oracle/Fujitsu SPARC based built bot or site would help here? -- Dennis Clarke RISC-V/SPARC/PPC/ARM/CISC UNIX and Linux spoken GreyBeard and suspenders optional ---------- components: Installation messages: 380987 nosy: blastwave priority: normal severity: normal status: open title: Python 3.9.0 unable to detect ax_cv_c_float_words_bigendian value on nigendan system versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Nov 14 20:20:28 2020 From: report at bugs.python.org (Andy Harrington) Date: Sun, 15 Nov 2020 01:20:28 +0000 Subject: [New-bugs-announce] [issue42359] tutorial: list is a class Message-ID: <1605403228.0.0.0141370845785.issue42359@roundup.psfhosted.org> New submission from Andy Harrington : Documentation in Tutorial section 9.3.3 seems to be stuck in Python 2: "In Python, the term method is not unique to class instances: other object types can have methods as well. For example, list objects have methods called append, insert, remove, sort, and so on." In Python 3 built-in types are derived from Object, so list is now a class, right? ---------- assignee: docs at python components: Documentation messages: 380997 nosy: andyharrington, docs at python priority: normal severity: normal status: open title: tutorial: list is a class versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 15 04:14:25 2020 From: report at bugs.python.org (Alejandro Gonzalez) Date: Sun, 15 Nov 2020 09:14:25 +0000 Subject: [New-bugs-announce] [issue42360] In the namedtuple documentation, mention that typename should match the variable name for the class to be pickle-able Message-ID: <1605431665.76.0.57179948955.issue42360@roundup.psfhosted.org> New submission from Alejandro Gonzalez : I think the namedtuple documentation should mention that, for classes created with it to be pickle-able, the typename argument must match the name of the variable the class is being assigned to. Otherwise you get an error like this: ---------------------------------------------- >>> Foo = namedtuple("Bar", "x,y") >>> pickle.dumps(Foo(1, 2)) Traceback (most recent call last): File "", line 1, in _pickle.PicklingError: Can't pickle : attribute lookup Bar on __main__ failed ---------------------------------------------- While it is indeed odd to do such naming in the first place, it should be admissible in other circumstances not involving pickling, and it is not obvious that pickling won't work if you do so. The pickle documentation does mention this, though: [...]Similarly, classes are pickled by named reference, so the same restrictions in the unpickling environment apply.[...] but for someone who encounters this error it might be difficult to figure it out from that passage. The added documentation in namedtuple could include a pointer to that section of pickle's documentation. ---------- assignee: docs at python components: Documentation messages: 381007 nosy: alegonz, docs at python priority: normal severity: normal status: open title: In the namedtuple documentation, mention that typename should match the variable name for the class to be pickle-able type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 15 07:29:16 2020 From: report at bugs.python.org (Ronald Oussoren) Date: Sun, 15 Nov 2020 12:29:16 +0000 Subject: [New-bugs-announce] [issue42361] Use Tcl/Tk 8.6.10 in build-installer.py when building on recent macOS Message-ID: <1605443356.85.0.637246166587.issue42361@roundup.psfhosted.org> New submission from Ronald Oussoren : As discussed before we want to switch to Tcl/Tk 8.6.10 when building the installer on a recent version of macOS. The build on macOS 10.9 should continue to use 8.6.8 due to build issues. PR is forthcoming (currently running tests) ---------- assignee: ronaldoussoren components: Tkinter, macOS messages: 381014 nosy: ned.deily, ronaldoussoren priority: normal severity: normal stage: needs patch status: open title: Use Tcl/Tk 8.6.10 in build-installer.py when building on recent macOS type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 15 09:39:28 2020 From: report at bugs.python.org (Ronald Oussoren) Date: Sun, 15 Nov 2020 14:39:28 +0000 Subject: [New-bugs-announce] [issue42362] Switch to clang as default compiler in build-installer.py Message-ID: <1605451168.78.0.88186037593.issue42362@roundup.psfhosted.org> New submission from Ronald Oussoren : build-installer.py still defaults to gcc as the default compiler, even though clang has been the system compiler for ages (and gcc is an alias in anything remotely recent). PR is forthcoming ---------- assignee: ronaldoussoren components: macOS messages: 381015 nosy: ned.deily, ronaldoussoren priority: normal severity: normal stage: needs patch status: open title: Switch to clang as default compiler in build-installer.py type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 15 10:51:14 2020 From: report at bugs.python.org (Jim Lin) Date: Sun, 15 Nov 2020 15:51:14 +0000 Subject: [New-bugs-announce] [issue42363] I think it will be better to output self._state for debugging Message-ID: <1605455474.5.0.172346256047.issue42363@roundup.psfhosted.org> New submission from Jim Lin : I think the exception "raise ValueError("Pool not running")" is not easy for a programmer to quickly know the problem of their code. Therefore, I add the value of self._state when throwing the ValueError. ---------- components: Library (Lib) messages: 381016 nosy: jimlinntu priority: normal severity: normal status: open title: I think it will be better to output self._state for debugging versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 15 18:14:56 2020 From: report at bugs.python.org (Mathias MICHEL) Date: Sun, 15 Nov 2020 23:14:56 +0000 Subject: [New-bugs-announce] [issue42364] Typo in french doc translation Message-ID: <1605482096.39.0.136403894956.issue42364@roundup.psfhosted.org> New submission from Mathias MICHEL : In https://docs.python.org/fr/3/tutorial/inputoutput.html, ? 7.1.3. Formatage de cha?nes ? la main After the code block the sentence between () should replace `donc` by `dont`: (Remarquez que l'espace s?parant les colonnes vient de la mani?re dont print() fonctionne : il ajoute toujours des espaces entre ses arguments.) ---------- assignee: docs at python components: Documentation messages: 381043 nosy: docs at python, matm priority: normal severity: normal status: open title: Typo in french doc translation type: compile error versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Nov 15 20:02:01 2020 From: report at bugs.python.org (Guido van Rossum) Date: Mon, 16 Nov 2020 01:02:01 +0000 Subject: [New-bugs-announce] [issue42365] Python launcher: sort order in "Installed versions" off with 3.10 Message-ID: <1605488521.14.0.00117878681965.issue42365@roundup.psfhosted.org> New submission from Guido van Rossum : I installed Python 3.10 on Windows and now the sort order of the versions printed by `py -0` is kind of weird: ``` Installed Pythons found by C:\WINDOWS\py.exe Launcher for Windows -3.9-64 * -3.8-64 -3.7-64 -3.6-64 -3.5-64 -3.10-64 ``` I'm guessing we're going to have to parse the versions... (I accidentally first reported this in https://github.com/brettcannon/python-launcher/issues/42.) ---------- components: Windows messages: 381049 nosy: gvanrossum, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Python launcher: sort order in "Installed versions" off with 3.10 type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 16 03:14:55 2020 From: report at bugs.python.org (Ma Lin) Date: Mon, 16 Nov 2020 08:14:55 +0000 Subject: [New-bugs-announce] [issue42366] Use MSVC2019 and /Ob3 option to compile Windows builds Message-ID: <1605514495.3.0.110639328789.issue42366@roundup.psfhosted.org> New submission from Ma Lin : MSVC2019 has a new option `/Ob3`, it specifies more aggressive inlining than /Ob2: https://docs.microsoft.com/en-us/cpp/build/reference/ob-inline-function-expansion?view=msvc-160 If use this option in MSVC2017, it will emit a warning: cl : Command line warning D9002 : ignoring unknown option '/Ob3' Just apply `Ob3.diff`, get this improvement: (Python 3.9 branch, No PGO, build.bat -p X64) +-------------------------+----------+------------------------------+ | Benchmark | baseline | ob3 | +=========================+==========+==============================+ | 2to3 | 563 ms | 552 ms: 1.02x faster (-2%) | +-------------------------+----------+------------------------------+ | chameleon | 16.5 ms | 16.1 ms: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | chaos | 200 ms | 197 ms: 1.02x faster (-2%) | +-------------------------+----------+------------------------------+ | crypto_pyaes | 186 ms | 184 ms: 1.01x faster (-1%) | +-------------------------+----------+------------------------------+ | deltablue | 13.0 ms | 12.6 ms: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | dulwich_log | 94.5 ms | 93.9 ms: 1.01x faster (-1%) | +-------------------------+----------+------------------------------+ | fannkuch | 806 ms | 761 ms: 1.06x faster (-6%) | +-------------------------+----------+------------------------------+ | float | 211 ms | 199 ms: 1.06x faster (-6%) | +-------------------------+----------+------------------------------+ | genshi_text | 48.3 ms | 47.7 ms: 1.01x faster (-1%) | +-------------------------+----------+------------------------------+ | go | 446 ms | 437 ms: 1.02x faster (-2%) | +-------------------------+----------+------------------------------+ | hexiom | 16.6 ms | 15.9 ms: 1.04x faster (-4%) | +-------------------------+----------+------------------------------+ | json_dumps | 19.9 ms | 19.3 ms: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | json_loads | 45.5 us | 43.9 us: 1.04x faster (-3%) | +-------------------------+----------+------------------------------+ | logging_format | 21.4 us | 20.7 us: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | logging_silent | 343 ns | 319 ns: 1.07x faster (-7%) | +-------------------------+----------+------------------------------+ | mako | 29.0 ms | 27.6 ms: 1.05x faster (-5%) | +-------------------------+----------+------------------------------+ | meteor_contest | 168 ms | 162 ms: 1.04x faster (-3%) | +-------------------------+----------+------------------------------+ | nbody | 256 ms | 244 ms: 1.05x faster (-5%) | +-------------------------+----------+------------------------------+ | nqueens | 168 ms | 162 ms: 1.04x faster (-4%) | +-------------------------+----------+------------------------------+ | pathlib | 175 ms | 168 ms: 1.04x faster (-4%) | +-------------------------+----------+------------------------------+ | pickle | 17.9 us | 17.3 us: 1.04x faster (-4%) | +-------------------------+----------+------------------------------+ | pickle_dict | 41.0 us | 33.2 us: 1.24x faster (-19%) | +-------------------------+----------+------------------------------+ | pickle_list | 6.73 us | 5.89 us: 1.14x faster (-12%) | +-------------------------+----------+------------------------------+ | pickle_pure_python | 829 us | 793 us: 1.05x faster (-4%) | +-------------------------+----------+------------------------------+ | pidigits | 243 ms | 243 ms: 1.00x faster (-0%) | +-------------------------+----------+------------------------------+ | pyflate | 1.21 sec | 1.18 sec: 1.03x faster (-2%) | +-------------------------+----------+------------------------------+ | raytrace | 947 ms | 915 ms: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | regex_compile | 291 ms | 284 ms: 1.03x faster (-2%) | +-------------------------+----------+------------------------------+ | regex_dna | 217 ms | 222 ms: 1.02x slower (+2%) | +-------------------------+----------+------------------------------+ | regex_effbot | 3.97 ms | 4.13 ms: 1.04x slower (+4%) | +-------------------------+----------+------------------------------+ | regex_v8 | 35.2 ms | 34.6 ms: 1.02x faster (-2%) | +-------------------------+----------+------------------------------+ | richards | 134 ms | 131 ms: 1.02x faster (-2%) | +-------------------------+----------+------------------------------+ | scimark_fft | 616 ms | 599 ms: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | scimark_lu | 248 ms | 241 ms: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | scimark_monte_carlo | 187 ms | 179 ms: 1.04x faster (-4%) | +-------------------------+----------+------------------------------+ | scimark_sor | 361 ms | 343 ms: 1.05x faster (-5%) | +-------------------------+----------+------------------------------+ | scimark_sparse_mat_mult | 7.71 ms | 7.04 ms: 1.10x faster (-9%) | +-------------------------+----------+------------------------------+ | spectral_norm | 249 ms | 245 ms: 1.02x faster (-2%) | +-------------------------+----------+------------------------------+ | sqlalchemy_declarative | 237 ms | 246 ms: 1.04x slower (+4%) | +-------------------------+----------+------------------------------+ | sqlalchemy_imperative | 40.6 ms | 41.2 ms: 1.02x slower (+2%) | +-------------------------+----------+------------------------------+ | sqlite_synth | 4.64 us | 5.47 us: 1.18x slower (+18%) | +-------------------------+----------+------------------------------+ | sympy_expand | 738 ms | 718 ms: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | sympy_integrate | 35.6 ms | 34.7 ms: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | sympy_sum | 298 ms | 295 ms: 1.01x faster (-1%) | +-------------------------+----------+------------------------------+ | sympy_str | 484 ms | 471 ms: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | telco | 11.3 ms | 9.76 ms: 1.16x faster (-14%) | +-------------------------+----------+------------------------------+ | tornado_http | 256 ms | 254 ms: 1.01x faster (-1%) | +-------------------------+----------+------------------------------+ | unpack_sequence | 94.3 ns | 90.5 ns: 1.04x faster (-4%) | +-------------------------+----------+------------------------------+ | unpickle | 23.6 us | 22.6 us: 1.05x faster (-5%) | +-------------------------+----------+------------------------------+ | unpickle_list | 6.63 us | 6.17 us: 1.07x faster (-7%) | +-------------------------+----------+------------------------------+ | unpickle_pure_python | 589 us | 560 us: 1.05x faster (-5%) | +-------------------------+----------+------------------------------+ | xml_etree_parse | 213 ms | 209 ms: 1.02x faster (-2%) | +-------------------------+----------+------------------------------+ | xml_etree_iterparse | 155 ms | 149 ms: 1.04x faster (-4%) | +-------------------------+----------+------------------------------+ | xml_etree_generate | 149 ms | 145 ms: 1.03x faster (-3%) | +-------------------------+----------+------------------------------+ | xml_etree_process | 117 ms | 115 ms: 1.01x faster (-1%) | +-------------------------+----------+------------------------------+ Not significant (5): django_template; genshi_xml; logging_simple; python_startup; python_startup_no_site ---------- components: Windows files: Ob3.diff keywords: patch messages: 381076 nosy: malin, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Use MSVC2019 and /Ob3 option to compile Windows builds type: performance versions: Python 3.10 Added file: https://bugs.python.org/file49600/Ob3.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 16 04:54:11 2020 From: report at bugs.python.org (Gregory P. Smith) Date: Mon, 16 Nov 2020 09:54:11 +0000 Subject: [New-bugs-announce] [issue42367] Restore os.makedirs ability to apply mode to all directories created Message-ID: <1605520451.51.0.153670810596.issue42367@roundup.psfhosted.org> New submission from Gregory P. Smith : os.makedirs used to pass its mode argument on down recursively so that every level of directory it created would have the specified permissions. That was removed in Python 3.7 as https://bugs.python.org/issue19930 as if it were a mis-feature. Maybe it was in one situation, but it was also a desirable *feature*. It wasn't a bug. We've got 15 year old code depending on that and the only solution for it to work on Python 3.7-3.9 is to reimplement recursive directory creation. :( This feature needs to be brought back. Rather than flip flop on the API, adding an flag to indicate if the permissions should be applied recursively or not seems like the best way forward. The "workaround" documented in the above bug is invalid. umask cannot be used to control the intermediate directory creation permissions as that is a process wide global that would impact other threads or signal handlers. umask also cannot be used as umask does not allow setting of special bits such as stat.S_ISVTX. result: Our old os.makedirs() code that tried to set the sticky bit (ISVTX) on all directories now fails to set it at all levels. ---------- components: Library (Lib) keywords: 3.7regression messages: 381082 nosy: gregory.p.smith, serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: Restore os.makedirs ability to apply mode to all directories created type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 16 05:42:46 2020 From: report at bugs.python.org (Dan Gheorghe Haiduc) Date: Mon, 16 Nov 2020 10:42:46 +0000 Subject: [New-bugs-announce] [issue42368] Make set ordered Message-ID: <1605523366.24.0.798043055827.issue42368@roundup.psfhosted.org> New submission from Dan Gheorghe Haiduc : Now that dicts are ordered[1], would it by any chance make sense to also order sets? A use case that I ran into is trying to reproducibly get a random.choice from a set (after calling random.seed). At first I did not need reproducibility, and I just called random.choice(list(my_set)). Later when I did need it, it was difficult to find out what was wrong. Then I realized that sets are unordered, and that order is not dependent on random.seed. It seems there are also some other confused newbies out there.[2][3] Thank you for the powerful language that is Python! [1] https://www.python.org/dev/peps/pep-0468 [2] https://stackoverflow.com/q/11929701/235463 [3] https://stackoverflow.com/q/36317520/235463 ---------- components: Interpreter Core messages: 381088 nosy: danuker priority: normal severity: normal status: open title: Make set ordered type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 16 06:07:51 2020 From: report at bugs.python.org (Thomas) Date: Mon, 16 Nov 2020 11:07:51 +0000 Subject: [New-bugs-announce] [issue42369] Reading ZipFile not thread-safe Message-ID: <1605524871.74.0.395089652548.issue42369@roundup.psfhosted.org> New submission from Thomas : According to https://docs.python.org/3.5/whatsnew/changelog.html#id108 bpo-14099, reading multiple ZipExtFiles should be thread-safe, but it is not. I created a small example where two threads try to read files from the same ZipFile simultaneously, which crashes with a Bad CRC-32 error. This is especially surprising since all files in the ZipFile only contain 0-bytes and have the same CRC. My use case is a ZipFile with 82000 files. Creating multiple ZipFiles from the same "physical" zip file is not a satisfactory workaround because it takes several seconds each time. Instead, I open it only once and clone it for each thread: with zipfile.ZipFile("/tmp/dummy.zip", "w") as dummy: pass def clone_zipfile(z): z_cloned = zipfile.ZipFile("/tmp/dummy.zip") z_cloned.NameToInfo = z.NameToInfo z_cloned.fp = open(z.fp.name, "rb") return z_cloned This is a much better solution for my use case than locking. I am using multiple threads because I want to finish my task faster, but locking defeats that purpose. However, this cloning is somewhat of a dirty hack and will break when the file is not a real file but rather a file-like object. Unfortunately, I do not have a solution for the general case. ---------- files: test.py messages: 381090 nosy: Thomas priority: normal severity: normal status: open title: Reading ZipFile not thread-safe versions: Python 3.7, Python 3.8 Added file: https://bugs.python.org/file49601/test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 16 09:56:27 2020 From: report at bugs.python.org (STINNER Victor) Date: Mon, 16 Nov 2020 14:56:27 +0000 Subject: [New-bugs-announce] [issue42370] test_ttk_guionly: test_to() fails on the GitHub Ubuntu job Message-ID: <1605538587.9.0.222465124321.issue42370@roundup.psfhosted.org> New submission from STINNER Victor : Seen on the Ubuntu job on a GitHub PR: https://github.com/python/cpython/pull/23315/checks?check_run_id=1406797840 ====================================================================== FAIL: test_to (tkinter.test.test_ttk.test_widgets.SpinboxTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/runner/work/cpython/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 1175, in test_to self.assertEqual(self.spin.get(), '5') AssertionError: '4' != '5' - 4 + 5 ---------- components: Tests, Tkinter messages: 381101 nosy: vstinner priority: normal severity: normal status: open title: test_ttk_guionly: test_to() fails on the GitHub Ubuntu job versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Nov 16 10:00:17 2020 From: report at bugs.python.org (=?utf-8?q?Bengt_L=C3=BCers?=) Date: Mon, 16 Nov 2020 15:00:17 +0000 Subject: [New-bugs-announce] [issue42371] Missing colon in timezone suffix raises ValueError Message-ID: <1605538817.4.0.335687964648.issue42371@roundup.psfhosted.org> New submission from Bengt L?ers : I am trying to parse ISO8601-formatted datetime strings with timezones. This works fine when there is a colon separating the hour and minute digits: >>> import datetime >>> datetime.datetime.fromisoformat('2020-11-16T11:00:00+00:00') >>> datetime.datetime(2020, 11, 16, 11, 0, tzinfo=datetime.timezone.utc) However this fails when there is no colon between the hour and the minute digits: >>> import datetime >>> datetime.datetime.fromisoformat('2020-11-16T11:00:00+0000') Traceback (most recent call last): File "", line 1, in ValueError: Invalid isoformat string: '2020-11-16T11:00:00+0000' This behavior is unexpected, as the ISO8601 standard allows omitting the colon in the string and defining the timezone as "