From report at bugs.python.org Sat Aug 1 01:37:36 2020 From: report at bugs.python.org (Zackery Spytz) Date: Sat, 01 Aug 2020 05:37:36 +0000 Subject: [New-bugs-announce] [issue41453] A possible reference leak in _locale.localeconv() Message-ID: <1596260256.93.0.581733214467.issue41453@roundup.psfhosted.org> New submission from Zackery Spytz : If the _Py_GetLocaleconvNumeric() call fails in _locale_localeconv_impl(), "decimal_point" may be leaked. ---------- components: Extension Modules messages: 374655 nosy: ZackerySpytz priority: normal severity: normal status: open title: A possible reference leak in _locale.localeconv() versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 1 09:16:15 2020 From: report at bugs.python.org (Dexter Ramos) Date: Sat, 01 Aug 2020 13:16:15 +0000 Subject: [New-bugs-announce] [issue41454] while loop bug on list Message-ID: <1596287775.85.0.902720236195.issue41454@roundup.psfhosted.org> New submission from Dexter Ramos : The output should have no duplicates but it has. When I added another "5" on the list it goes okay and is still okay if I add more. But when there is only two 5's it won't do its job. ---------- components: Windows files: app.py messages: 374661 nosy: Dexter Ramos, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: while loop bug on list type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49356/app.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 1 13:58:11 2020 From: report at bugs.python.org (Yaroslac) Date: Sat, 01 Aug 2020 17:58:11 +0000 Subject: [New-bugs-announce] [issue41455] Python Devguide differs from python docs Message-ID: <1596304691.88.0.58289993883.issue41455@roundup.psfhosted.org> New submission from Yaroslac : As I can see here https://github.com/python/devguide/blob/master/garbage_collector.rst#collecting-the-oldest-generation > the GC only triggers a full collection of the oldest generation if the ratio long_lived_pending / long_lived_total is above a given value (hardwired to 25%) But in the python docs here https://docs.python.org/3.10/library/gc.html#gc.set_threshold > When the number of allocations minus the number of deallocations exceeds threshold0, collection starts. Initially only generation 0 is examined. If generation 0 has been examined more than threshold1 times since generation 1 has been examined, then generation 1 is examined as well. Similarly, threshold2 controls the number of collections of generation 1 before collecting generation 2. So, which one is correct? ---------- assignee: docs at python components: Documentation messages: 374665 nosy: Yaroslav, docs at python priority: normal severity: normal status: open title: Python Devguide differs from python docs type: resource usage versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 2 02:40:35 2020 From: report at bugs.python.org (Guo Xiyong) Date: Sun, 02 Aug 2020 06:40:35 +0000 Subject: [New-bugs-announce] [issue41456] loop.run_in_executor creat thread but not destory it after the task run over Message-ID: <1596350435.61.0.637126528224.issue41456@roundup.psfhosted.org> New submission from Guo Xiyong : code like this: import asyncio import time import threading def sync_test(): time.sleep(1) async def run_test(): loop = asyncio.get_event_loop() for _ in range(10): # r = await loop.getaddrinfo('wq.io', 443) # print(r) loop.run_in_executor(None, sync_test) for t in threading.enumerate(): print(t) while True: await asyncio.sleep(1) asyncio.run(run_test()) after run, the 10 thread will always exist ---------- components: asyncio messages: 374679 nosy: asvetlov, cielpy, yselivanov priority: normal severity: normal status: open title: loop.run_in_executor creat thread but not destory it after the task run over versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 2 05:50:11 2020 From: report at bugs.python.org (Ram Rachum) Date: Sun, 02 Aug 2020 09:50:11 +0000 Subject: [New-bugs-announce] [issue41457] Implement random.shuffled Message-ID: <1596361811.95.0.711891724377.issue41457@roundup.psfhosted.org> New submission from Ram Rachum : Writing the patch now. Thread: https://mail.python.org/archives/list/python-ideas at python.org/thread/OHLXVKIBMNSQO6BCFK6LEHSYNXDB6OQJ/ ---------- components: Library (Lib) messages: 374683 nosy: cool-RR priority: normal severity: normal status: open title: Implement random.shuffled type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 2 16:03:18 2020 From: report at bugs.python.org (Raymond Hettinger) Date: Sun, 02 Aug 2020 20:03:18 +0000 Subject: [New-bugs-announce] [issue41458] Avoid overflow/underflow in math.prod() Message-ID: <1596398598.74.0.852327933948.issue41458@roundup.psfhosted.org> New submission from Raymond Hettinger : For float inputs, the math.prod() function could be made smarter about avoiding overflow() and underflow(). That would also improve commutativity as well. Other tools like math.hypot() already take measures to avoid overflow/underflow and to improve commutativity. This makes them nicer to use than n?ive implementations. The recipe that I've been using for years is shown below. It certainly isn't the best way, but it is O(n) and always avoids overflow and underflow when possible. It has made for a nice primitive when implementing other functions that need to be as robust as possible. For example, in the quadratic formula, the ?(b?-4ac) factors to b?(1-4ac/b?) and the rightmost term gets implemented in Python as product([4.0, a, c, 1.0/b, 1.0/b]). >>> from math import prod, fabs >>> from collections import deque >>> from itertools import permutations >>> def product(seq): s = deque() for x in seq: s.appendleft(x) if fabs(x) < 1.0 else s.append(x) while len(s) > 1: x = s.popleft() * s.pop() s.appendleft(x) if fabs(x) < 1.0 else s.append(x) return s[0] if s else 1.0 >>> data = [2e300, 2e200, 0.5e-150, 0.5e-175] >>> for factors in permutations(data): print(product(factors), prod(factors), sep='\t') 1e+175 inf 1.0000000000000001e+175 inf 1e+175 inf 1e+175 1e+175 1.0000000000000001e+175 inf 1.0000000000000001e+175 1.0000000000000001e+175 1.0000000000000001e+175 inf 1e+175 inf 1.0000000000000001e+175 inf 1.0000000000000001e+175 1.0000000000000001e+175 1e+175 inf 1e+175 1e+175 1e+175 inf 1e+175 1e+175 1.0000000000000001e+175 inf 1.0000000000000001e+175 1.0000000000000001e+175 1e+175 0.0 1.0000000000000001e+175 0.0 1.0000000000000001e+175 inf 1.0000000000000001e+175 1.0000000000000001e+175 1e+175 inf 1e+175 1e+175 1.0000000000000001e+175 0.0 1e+175 0.0 For math.prod(), I think a better implementation would be to run normally until an underflow or overflow is detected, then back up a step and switch-over to pairing low and high magnitude values. Since this is fallback code, it would only affect speed to the extent that we test for overflow or underflow at every step. Given how branch prediction works, the extra tests might even be free or at least very cheap. The math module functions usually go the extra mile to be more robust (and often faster) than a n?ive implementation. These are the primary reasons we teach people to prefer sqrt() over x**2, log1p(x) over log(1+x), prod(seq) over reduce(mul, seq, 1.0), log2(x) over log(x, 2), fsum(seq) over sum(seq), and hypot(x,y) over sqrt(x**2 + y**2). In each case, the library function is some combination of more robust, more accurate, more commutative, and/or faster than a user can easily create for themselves. ---------- components: Library (Lib) messages: 374693 nosy: mark.dickinson, pablogsal, rhettinger, tim.peters priority: normal severity: normal status: open title: Avoid overflow/underflow in math.prod() type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 2 16:56:15 2020 From: report at bugs.python.org (Guillaume) Date: Sun, 02 Aug 2020 20:56:15 +0000 Subject: [New-bugs-announce] [issue41459] pickle.load raises SystemError on malformed input Message-ID: <1596401775.19.0.63803368162.issue41459@roundup.psfhosted.org> New submission from Guillaume : pickle.load() raises a criptic SystemError with malformed input, whereas I would have expected an UnpicklingError. "SystemError: deallocated bytearray object has exported buffers" Because pickle is not meant for use on untrusted input, this likely would not be considered a servere issue. Reproducing: import pickle f = open("crash-95c0cb965cb66f5eebc778a1d2304eaffb72f1aa", "rb") d = pickle.load(f) ---------- components: Argument Clinic files: crash-95c0cb965cb66f5eebc778a1d2304eaffb72f1aa messages: 374695 nosy: Guillaume, larry priority: normal severity: normal status: open title: pickle.load raises SystemError on malformed input versions: Python 3.8 Added file: https://bugs.python.org/file49358/crash-95c0cb965cb66f5eebc778a1d2304eaffb72f1aa _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 3 00:18:09 2020 From: report at bugs.python.org (=?utf-8?b?5p2O5Yaw?=) Date: Mon, 03 Aug 2020 04:18:09 +0000 Subject: [New-bugs-announce] [issue41460] Translation Error in in Functional Programming HOWTO page Message-ID: <1596428289.44.0.783644077267.issue41460@roundup.psfhosted.org> New submission from ?? : There seems a translation error in Python Documentation in Functional Programming HOWTO page. The page's English version's url is https://docs.python.org/3/howto/functional.html And the Japanese version's url is https://docs.python.org/ja/3/howto/functional.html. In English version, there is a paragraph: "In declarative languages, you write a specification that describes the problem to be solved, and the language implementation figures out how to perform the computation efficiently. SQL is the declarative language you?re most likely to be familiar with; a SQL query describes the data set you want to retrieve, and the SQL engine decides whether to scan tables or use indexes, which subclauses should be performed first, etc." The corresponding Japanses translation is this: "??? ???????????????????????????????????????????????????????????SQL ????????????????????; SQL ??????????????????????????????????????????????????????????????????????? SQL ?????????" In the above paragraph, I think the translator translate the word "subclauses" to "??????", which is wrong. In Japanese, ?? means sub and ???? means close, so it is just "subclose", not "subclause". That is all. Thank you. ---------- messages: 374713 nosy: mydairyyao priority: normal severity: normal status: open title: Translation Error in in Functional Programming HOWTO page type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 3 03:06:46 2020 From: report at bugs.python.org (Michael Felt) Date: Mon, 03 Aug 2020 07:06:46 +0000 Subject: [New-bugs-announce] [issue41461] test_pathlib assumes underlying filesystem permits creation with world-write permissions Message-ID: <1596438406.32.0.128608739111.issue41461@roundup.psfhosted.org> New submission from Michael Felt : Two tests in test_pathlib test that the files created have mode o666 (rw-rw-rw). However, on a filesystem (in my case NFS) configured to never permit global write - the test will always fail. Is this something to be concerned about? I can think of a few possible ways to react to an exception such as this, e.g., rather than 'FAIL' outright, try umask(2). ++++++++ ====================================================================== FAIL: test_open_mode (test.test_pathlib.PosixPathTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/data/prj/python/src/py38-3.8.5/Lib/test/test_pathlib.py", line 2210, in test_open_mode self.assertEqual(stat.S_IMODE(st.st_mode), 0o666) AssertionError: 436 != 438 ====================================================================== FAIL: test_touch_mode (test.test_pathlib.PosixPathTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/data/prj/python/src/py38-3.8.5/Lib/test/test_pathlib.py", line 2223, in test_touch_mode self.assertEqual(stat.S_IMODE(st.st_mode), 0o666) AssertionError: 436 != 438 ---------------------------------------------------------------------- ++++++++ Just to verify it does work when on a 'local' filesystem. cp -rp build /tmp/build mv build build.nfs ln -s /tmp/build build == Tests result: SUCCESS == 1 test OK. Total duration: 7.8 sec Tests result: SUCCESS ---------- components: Tests messages: 374725 nosy: Michael.Felt priority: normal severity: normal status: open title: test_pathlib assumes underlying filesystem permits creation with world-write permissions type: behavior versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 3 05:53:47 2020 From: report at bugs.python.org (Peixing Xin) Date: Mon, 03 Aug 2020 09:53:47 +0000 Subject: [New-bugs-announce] [issue41462] os.set_blocking() raises OSError on VxWorks RTOS Message-ID: <1596448427.12.0.91446561871.issue41462@roundup.psfhosted.org> New submission from Peixing Xin : os.set_blocking() always raise OSError exception on VxWorks RTOS. See below for details. [vxWorks *]# python3 -m unittest -v test.test_os.BlockingTests.test_blocking Launching process 'python3' ... Process 'python3' (process Id = 0x405808010) launched. test_blocking (test.test_os.BlockingTests) ... ERROR ====================================================================== ERROR: test_blocking (test.test_os.BlockingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3.8/test/test_os.py", line 3640, in test_blocking os.set_blocking(fd, False) OSError: [Errno 35] not supported ---------- components: Library (Lib) messages: 374732 nosy: pxinwr priority: normal severity: normal status: open title: os.set_blocking() raises OSError on VxWorks RTOS type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 3 07:00:15 2020 From: report at bugs.python.org (Mark Shannon) Date: Mon, 03 Aug 2020 11:00:15 +0000 Subject: [New-bugs-announce] [issue41463] Avoid duplicating jump information from opcode.py in compile.c Message-ID: <1596452415.91.0.969194719265.issue41463@roundup.psfhosted.org> New submission from Mark Shannon : opcode.py declares which jumps are relative and which are absolute. We duplicate that information in compile.c We should generate lookup tables in opcodes.h and to repeating that information in compile.c ---------- messages: 374735 nosy: Mark.Shannon priority: normal severity: normal status: open title: Avoid duplicating jump information from opcode.py in compile.c type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 3 13:01:32 2020 From: report at bugs.python.org (Irit Katriel) Date: Mon, 03 Aug 2020 17:01:32 +0000 Subject: [New-bugs-announce] [issue41464] Increase Code Coverage for operator.py Message-ID: <1596474092.62.0.0191656863895.issue41464@roundup.psfhosted.org> New submission from Irit Katriel : Lib\operator.py currently missing coverage for not_, index and error cases of length_hint and iconcat. ---------- components: Tests messages: 374742 nosy: iritkatriel priority: normal severity: normal status: open title: Increase Code Coverage for operator.py versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 3 14:29:12 2020 From: report at bugs.python.org (=?utf-8?q?Walter_D=C3=B6rwald?=) Date: Mon, 03 Aug 2020 18:29:12 +0000 Subject: [New-bugs-announce] [issue41465] io.TextIOWrapper.errors not writable Message-ID: <1596479352.95.0.492861771572.issue41465@roundup.psfhosted.org> New submission from Walter D?rwald : PEP 293 states the following: """ For stream readers/writers the errors attribute must be changeable to be able to switch between different error handling methods during the lifetime of the stream reader/writer. This is currently the case for codecs.StreamReader and codecs.StreamWriter and all their subclasses. All core codecs and probably most of the third party codecs (e.g. JapaneseCodecs) derive their stream readers/writers from these classes so this already works, but the attribute errors should be documented as a requirement. """ However for io.TextIOWrapper, the errors attribute can not be changed: Python 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import io >>> s = io.TextIOWrapper(io.BytesIO()) >>> s.errors = 'replace' Traceback (most recent call last): File "", line 1, in AttributeError: attribute 'errors' of '_io.TextIOWrapper' objects is not writable So the errors attribute of io.TextIOWrapper should be made writable. ---------- components: IO messages: 374751 nosy: doerwalter priority: normal severity: normal status: open title: io.TextIOWrapper.errors not writable type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 3 15:58:25 2020 From: report at bugs.python.org (cotree) Date: Mon, 03 Aug 2020 19:58:25 +0000 Subject: [New-bugs-announce] [issue41466] Windows installer: "Add to PATH" should be checked by default Message-ID: <1596484705.61.0.378501501688.issue41466@roundup.psfhosted.org> New submission from cotree : In the Windows installer, "Add Python 3.x to PATH" is unchecked by default: https://docs.python.org/3/_images/win_installer.png If it's unchecked, then "python", "pip", and any other commands from installed packages (like django-admin, etc) will not work, which is quite important functionality. Searching on Google shows that "'python' is not recognized..." is a commonly asked about error. Many users leave that box unchecked because they don't know what PATH is and they tend to stick with the defaults recommended by the installer. On the other hand, I think not wanting Python on your PATH is more of an advanced use case. The people who opt for this are more likely to know what PATH is in the first place, so it's reasonable to ask them to decide to uncheck it. ---------- components: Windows messages: 374752 nosy: cotree, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Windows installer: "Add to PATH" should be checked by default type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 3 18:19:49 2020 From: report at bugs.python.org (STINNER Victor) Date: Mon, 03 Aug 2020 22:19:49 +0000 Subject: [New-bugs-announce] [issue41467] asyncio: recv_into() must not return b'' if the socket/pipe is closed Message-ID: <1596493189.98.0.797069593692.issue41467@roundup.psfhosted.org> New submission from STINNER Victor : The proactor event loop of asyncio returns b'' on recv_into() if the socket/pipe is closed: def recv_into(self, conn, buf, flags=0): ... try: ... except BrokenPipeError: return self._result(b'') ... But a socket recv_into() must always return a number: the number of written bytes. Example with socket.socket.recv_into() method: https://docs.python.org/3/library/socket.html#socket.socket.recv_into IMHO zero must be returned here. This bug may be the root cause of bpo-38912 bug. Attached PR fix the issue. ---------- components: asyncio messages: 374760 nosy: asvetlov, vstinner, yselivanov priority: normal severity: normal status: open title: asyncio: recv_into() must not return b'' if the socket/pipe is closed versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 3 19:03:19 2020 From: report at bugs.python.org (Albert Francis) Date: Mon, 03 Aug 2020 23:03:19 +0000 Subject: [New-bugs-announce] [issue41468] Unrecoverable server exiting Message-ID: <1596495799.45.0.151372385389.issue41468@roundup.psfhosted.org> New submission from Albert Francis : How to solve unrecoverable server exiting in IDLE ---------- assignee: terry.reedy components: IDLE messages: 374766 nosy: albertpython, terry.reedy priority: normal severity: normal status: open title: Unrecoverable server exiting type: behavior versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 3 22:46:30 2020 From: report at bugs.python.org (Jose Gabriel) Date: Tue, 04 Aug 2020 02:46:30 +0000 Subject: [New-bugs-announce] [issue41469] Problem with serial communication Message-ID: <1596509190.34.0.229885984319.issue41469@roundup.psfhosted.org> New submission from Jose Gabriel : I was doing a small serial communication system using pyserial. when I done the script on a .py file, it not worked. but when I opened the python console and writed line by line the same code of the .py file, it worked. the .py file: import serial ser = serial.Serial('com5') ser.write('L'.encode()) ser.close() it not worked. on the python console: python>> import serial python>> ser = serial.Serial('com5') python>> ser.write('L'.encode()) python>> ser.close() It worked. PySerial 3.4 ---------- messages: 374788 nosy: JDev priority: normal severity: normal status: open title: Problem with serial communication type: resource usage versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 05:39:24 2020 From: report at bugs.python.org (Peter Stokes) Date: Tue, 04 Aug 2020 09:39:24 +0000 Subject: [New-bugs-announce] [issue41470] smtplib.SMTP should reset internal 'helo' and 'ehlo' state within 'connect()' Message-ID: <1596533964.11.0.390064699106.issue41470@roundup.psfhosted.org> New submission from Peter Stokes : Attempting to reuse an instance of 'smtplib.SMTP', via invocation of the 'smtplib.SMTP.connect(?)' function, results in an invalid SMTP command sequence being issued to the connected server: ``` import smtplib smtp = smtplib.SMTP() smtp.connect('smtp.gmail.com') smtp.ehlo_or_helo_if_needed() smtp.close() try: smtp.quit() except smtplib.SMTPServerDisconnected: pass smtp.connect('smtp.gmail.com') print(smtp.mail('user at example.com')) ``` results in "(503, b'5.5.1 EHLO/HELO first. ? - gsmtp')" The values stored in 'self.helo_resp' and 'self.ehlo_resp', as considered within 'smtplib.SMTP.ehlo_or_helo_if_needed()' [1], should be reset to a value of 'None' upon successfully establishing a new connection to a server. The correct sentiment is expressed within 'smtplib.SMTP.quit()' [2] but this resetting of state should be performed upon establishing a new connection rather than termination of an old connection. Whilst the simplified example provided is arguably an invalid use of the 'smtplib.SMTP' library the scenario can occur, specifically when the initial connection is unilaterally terminated by the server, which makes the reset logic provided in 'smtplib.SMTP.quit()' inaccessible due to the 'smtplib.SMTPServerDisconnected' exception raised as a consequence of attempting to execute an SMTP 'QUIT' command over a disconnected socket. [1] https://github.com/python/cpython/blob/da51ba442c7bf717872633676207c1ae10e99c99/Lib/smtplib.py#L603 [2] https://github.com/python/cpython/blob/da51ba442c7bf717872633676207c1ae10e99c99/Lib/smtplib.py#L989L990 ---------- components: email messages: 374798 nosy: Dadeos, barry, r.david.murray priority: normal severity: normal status: open title: smtplib.SMTP should reset internal 'helo' and 'ehlo' state within 'connect()' type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 06:34:27 2020 From: report at bugs.python.org (Jens Petersen) Date: Tue, 04 Aug 2020 10:34:27 +0000 Subject: [New-bugs-announce] [issue41471] After installing python 3.x on Mac pip doesn't work at all Message-ID: <1596537267.29.0.654374340764.issue41471@roundup.psfhosted.org> New submission from Jens Petersen : Using pip fails with the same error messages independent of version an user. Also su or sudo -H doesn't change anything: How to Reproduce install python 3.x on your Mac and try pip After a quite long search I found that it is a problem with the proxy config. You need to remove all settings in network settings/proxy even those defining which domains shouldn't use a proxy. Proxy settings work fine with everything except python. xcode-select install ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install pyenv pyenv install 3.7.3 pip list --outdated or pip install something Exception xxx-MBP:~ xxx$ pip list --outdated Exception: Traceback (most recent call last): File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 179, in main status = self.run(options, args) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_internal/commands/list.py", line 144, in run packages = self.get_outdated(packages, options) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_internal/commands/list.py", line 152, in get_outdated dist for dist in self.iter_packages_latest_infos(packages, options) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_internal/commands/list.py", line 152, in dist for dist in self.iter_packages_latest_infos(packages, options) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_internal/commands/list.py", line 179, in iter_packages_latest_infos all_candidates = finder.find_all_candidates(dist.key) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_internal/index.py", line 610, in find_all_candidates for page in self._get_pages(url_locations, project_name): File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_internal/index.py", line 743, in _get_pages page = _get_html_page(location, session=self.session) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_internal/index.py", line 229, in _get_html_page resp = _get_html_response(url, session=session) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_internal/index.py", line 177, in _get_html_response "Cache-Control": "max-age=0", File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 546, in get return self.request('GET', url, **kwargs) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_internal/download.py", line 403, in request return super(PipSession, self).request(method, url, *args, **kwargs) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 524, in request prep.url, proxies, stream, verify, cert File "/Users/xxxx.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 700, in merge_environment_settings env_proxies = get_environ_proxies(url, no_proxy=no_proxy) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_vendor/requests/utils.py", line 761, in get_environ_proxies if should_bypass_proxies(url, no_proxy=no_proxy): File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/site-packages/pip/_vendor/requests/utils.py", line 745, in should_bypass_proxies bypass = proxy_bypass(parsed.hostname) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/urllib/request.py", line 2610, in proxy_bypass return proxy_bypass_macosx_sysconf(host) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/urllib/request.py", line 2587, in proxy_bypass_macosx_sysconf return _proxy_bypass_macosx_sysconf(host, proxy_settings) File "/Users/xxx/.pyenv/versions/3.7.3/lib/python3.7/urllib/request.py", line 2573, in _proxy_bypass_macosx_sysconf if (hostIP >> mask) == (base >> mask): ValueError: negative shift count ---------- components: macOS messages: 374800 nosy: ned.deily, peteje66, ronaldoussoren priority: normal pull_requests: 20872 severity: normal status: open title: After installing python 3.x on Mac pip doesn't work at all type: crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 09:34:03 2020 From: report at bugs.python.org (Marco Trevisan) Date: Tue, 04 Aug 2020 13:34:03 +0000 Subject: [New-bugs-announce] [issue41472] webbrowser uses deprecated env variables to detect desktop type Message-ID: <1596548043.48.0.891442274538.issue41472@roundup.psfhosted.org> New submission from Marco Trevisan : Webbrowser uses env variables such as GNOME_DESKTOP_SESSION_ID that have been dropped by GNOME in recent releases ---------- components: Library (Lib) messages: 374806 nosy: Trevinho priority: normal severity: normal status: open title: webbrowser uses deprecated env variables to detect desktop type type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 10:19:27 2020 From: report at bugs.python.org (STINNER Victor) Date: Tue, 04 Aug 2020 14:19:27 +0000 Subject: [New-bugs-announce] [issue41473] test_gdb fails on AMD64 Fedora Rawhide 3.x Message-ID: <1596550767.43.0.215651378336.issue41473@roundup.psfhosted.org> New submission from STINNER Victor : https://buildbot.python.org/all/#builders/1/builds/1194 0:07:05 load avg: 16.74 [421/423/1] test_gdb failed (2 min 29 sec) -- running: test_capi (1 min 28 sec), test_lib2to3 (1 min 22 sec) (...) ====================================================================== FAIL: test_dicts (test.test_gdb.PrettyPrintTests) Verify the pretty-printing of dictionaries ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/test_gdb.py", line 332, in test_dicts self.assertGdbRepr({'foo': 'bar'}, "{'foo': 'bar'}") File "/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/test_gdb.py", line 308, in assertGdbRepr gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')') File "/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/test_gdb.py", line 284, in get_gdb_repr self.fail('Unexpected gdb output: %r\n%s' % (gdb_output, gdb_output)) AssertionError: Unexpected gdb output: 'Breakpoint 1 at 0x5fbc79: file Python/bltinmodule.c, line 1173.\n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library "/lib64/libthread_db.so.1".\n' Breakpoint 1 at 0x5fbc79: file Python/bltinmodule.c, line 1173. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Stderr: Couldn't get registers: No such process. Selected thread is running. ====================================================================== FAIL: test_pycfunction (test.test_gdb.PyBtTests) [_testcapi.meth_noargs] Verify that "py-bt" displays invocations of PyCFunction instances ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildarea/3.x.cstratak-fedora-rawhide-x86_64/build/Lib/test/test_gdb.py", line 912, in test_pycfunction self.assertIn(f' _______________________________________ From report at bugs.python.org Tue Aug 4 10:23:53 2020 From: report at bugs.python.org (Skip Montanaro) Date: Tue, 04 Aug 2020 14:23:53 +0000 Subject: [New-bugs-announce] [issue41474] Missing dependency on Include/cpython/frameobject.h Message-ID: <1596551033.65.0.706475501997.issue41474@roundup.psfhosted.org> New submission from Skip Montanaro : When Include/cpython/frameobject.h was created, there was no dependency added to Makefile.pre.in. ---------- components: Build messages: 374809 nosy: skip.montanaro priority: normal severity: normal status: open title: Missing dependency on Include/cpython/frameobject.h type: compile error versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 10:36:38 2020 From: report at bugs.python.org (Ram Rachum) Date: Tue, 04 Aug 2020 14:36:38 +0000 Subject: [New-bugs-announce] [issue41475] Fix mistake in "What's new in Python 3.7" Message-ID: <1596551798.69.0.0710620145203.issue41475@roundup.psfhosted.org> New submission from Ram Rachum : Writing the patch now. ---------- assignee: docs at python components: Documentation messages: 374814 nosy: cool-RR, docs at python priority: normal severity: normal status: open title: Fix mistake in "What's new in Python 3.7" versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 11:04:07 2020 From: report at bugs.python.org (STINNER Victor) Date: Tue, 04 Aug 2020 15:04:07 +0000 Subject: [New-bugs-announce] [issue41476] test_zoneinfo fails if the _lzma module is missing Message-ID: <1596553447.24.0.104799735954.issue41476@roundup.psfhosted.org> New submission from STINNER Victor : Error when _lzma extension is missing: test test_zoneinfo crashed -- Traceback (most recent call last): File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 272, in _runtest_inner refleak = _runtest_inner2(ns, test_name) File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 223, in _runtest_inner2 the_module = importlib.import_module(abstest) File "/home/vstinner/python/master/Lib/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 790, in exec_module File "", line 228, in _call_with_frames_removed File "/home/vstinner/python/master/Lib/test/test_zoneinfo/__init__.py", line 1, in from .test_zoneinfo import * File "/home/vstinner/python/master/Lib/test/test_zoneinfo/test_zoneinfo.py", line 9, in import lzma File "/home/vstinner/python/master/Lib/lzma.py", line 27, in from _lzma import * ModuleNotFoundError: No module named '_lzma' The minimum fix is to skip test_zoneinfo is lzma is missing. For example, replace "import lzma" with "lzma = support.import_helper.import_module('lzma')". ---------- components: Tests messages: 374819 nosy: p-ganssle, vstinner priority: normal severity: normal status: open title: test_zoneinfo fails if the _lzma module is missing versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 11:05:40 2020 From: report at bugs.python.org (STINNER Victor) Date: Tue, 04 Aug 2020 15:05:40 +0000 Subject: [New-bugs-announce] [issue41477] test_genericalias fails if ctypes is missing Message-ID: <1596553540.81.0.229958329134.issue41477@roundup.psfhosted.org> New submission from STINNER Victor : Error: 0:05:47 load avg: 5.95 [311/423/2] test_genericalias failed -- running: test_multiprocessing_spawn (1 min 59 sec) test test_genericalias crashed -- Traceback (most recent call last): File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 272, in _runtest_inner refleak = _runtest_inner2(ns, test_name) File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 223, in _runtest_inner2 the_module = importlib.import_module(abstest) File "/home/vstinner/python/master/Lib/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 790, in exec_module File "", line 228, in _call_with_frames_removed File "/home/vstinner/python/master/Lib/test/test_genericalias.py", line 16, in from ctypes import Array, LibraryLoader File "/home/vstinner/python/master/Lib/ctypes/__init__.py", line 8, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes' The minimum fix is to skip test_genericalias is ctypes is missing. For example, use "ctypes = support.import_helper.import_module('ctypes')" to import ctypes. See also bpo-41476: test_zoneinfo fails if the _lzma module is missing. ---------- components: Tests messages: 374820 nosy: vstinner priority: normal severity: normal status: open title: test_genericalias fails if ctypes is missing versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 12:47:24 2020 From: report at bugs.python.org (Ilya Kamenshchikov) Date: Tue, 04 Aug 2020 16:47:24 +0000 Subject: [New-bugs-announce] [issue41478] Empty representation of AssertionError Message-ID: <1596559644.4.0.529490005495.issue41478@roundup.psfhosted.org> New submission from Ilya Kamenshchikov : I have a high level wrapper where I am catching expection and present it in (more) user-friendly format with a message. try: raise ValueError except Exception as e: print(f"Following happened: {e}") >>> prints "Following happened: " Can an exception print it's class when it has no message? ---------- components: Interpreter Core messages: 374831 nosy: Ilya Kamenshchikov priority: normal severity: normal status: open title: Empty representation of AssertionError type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 14:18:11 2020 From: report at bugs.python.org (Immo Wetzel) Date: Tue, 04 Aug 2020 18:18:11 +0000 Subject: [New-bugs-announce] [issue41479] pip install== will install 0.0.0 version in stead of showing alll Message-ID: <1596565091.91.0.157187140221.issue41479@roundup.psfhosted.org> New submission from Immo Wetzel : I do have a pip package with version id 0.0.0 on my own registry. If I try to get the list of available versions like before with pip install package_name== it will install version 0.0.0 of the package package_name thats not right ---------- messages: 374835 nosy: iwetzel priority: normal severity: normal status: open title: pip install== will install 0.0.0 version in stead of showing alll versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 14:18:57 2020 From: report at bugs.python.org (LX Cubing) Date: Tue, 04 Aug 2020 18:18:57 +0000 Subject: [New-bugs-announce] [issue41480] python won't save Message-ID: <1596565137.77.0.746633483379.issue41480@roundup.psfhosted.org> New submission from LX Cubing : When I try to run python, it asks me if I want to save it or not. So I clicked yes, like I always do, but nothing happened. It didn't run at all. I keep trying, but still it won't save. ---------- messages: 374836 nosy: leoxie0733 priority: normal severity: normal status: open title: python won't save versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 14:35:49 2020 From: report at bugs.python.org (Immo Wetzel) Date: Tue, 04 Aug 2020 18:35:49 +0000 Subject: [New-bugs-announce] [issue41481] pip install will install version 0.0.0 if existing in stead of newer ones Message-ID: <1596566149.36.0.0442903263551.issue41481@roundup.psfhosted.org> New submission from Immo Wetzel : if a version 0.0.0 is existing in repo/index ... pip will install this version and not the newer ones. ---------- components: Installation messages: 374838 nosy: iwetzel priority: normal severity: normal status: open title: pip install will install version 0.0.0 if existing in stead of newer ones type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 4 15:54:05 2020 From: report at bugs.python.org (Eric Frederich) Date: Tue, 04 Aug 2020 19:54:05 +0000 Subject: [New-bugs-announce] [issue41482] docstring errors in ipaddress.IPv4Network Message-ID: <1596570845.31.0.932838232512.issue41482@roundup.psfhosted.org> New submission from Eric Frederich : The __init__ method for IPv4Network has a typo where it says all three of '192.0.2.0/24', '192.0.2.0/255.255.255.0' and '192.0.0.2/0.0.0.255' should be equal. ---------- assignee: docs at python components: Documentation messages: 374841 nosy: docs at python, eric.frederich priority: normal severity: normal status: open title: docstring errors in ipaddress.IPv4Network type: enhancement versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 5 02:06:13 2020 From: report at bugs.python.org (Kostis Anagnostopoulos) Date: Wed, 05 Aug 2020 06:06:13 +0000 Subject: [New-bugs-announce] [issue41483] Do not acquire lock in MemoryHandler.flush() if no target defined Message-ID: <1596607573.95.0.247308930011.issue41483@roundup.psfhosted.org> New submission from Kostis Anagnostopoulos : The `logging.handlers.MemoryHandler.flush()` method acquire the lock even if target has not been set, and the method is a noop: ``` def flush(self): # (Docstring skipped) self.acquire() try: if self.target: for record in self.buffer: self.target.handle(record) self.buffer..clear() finally: self.release() ``` An optimized version would re-arrrange the nesting to avoid the locking: ``` def flush(self): # (Docstring skipped) if self.target: self.acquire() try: for record in self.buffer: self.target.handle(record) self.buffer.clear() finally: self.release() ``` - There is no use-case, beyond the expected performance gain. - Without having searched, i would deem highly improbable the existence of code in the std-library or 3rdp code that depends on the current noop-locking when `flush()` is called. ---------- components: Library (Lib) messages: 374859 nosy: ankostis, penlect, vinay.sajip priority: normal severity: normal status: open title: Do not acquire lock in MemoryHandler.flush() if no target defined type: performance versions: Python 3.10, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 5 03:33:25 2020 From: report at bugs.python.org (=?utf-8?q?Admir_Ljubijanki=C4=87?=) Date: Wed, 05 Aug 2020 07:33:25 +0000 Subject: [New-bugs-announce] [issue41484] Overriding dictionary value under wrong key. Message-ID: <1596612805.37.0.383723382681.issue41484@roundup.psfhosted.org> New submission from Admir Ljubijanki? : I'm writing a function that combines two dictionaries called "baseProducts" and "variantProducts". The logic behind is simple, I loop trough variantProducts, create a string that will be used as a key for that combined product. Add all values of baseProduct under that key, and add all fitting variants to this new nested dictionary under key "variants". And return the new dict once all variants are grouped correctly. The code looks something like this: def combineProductsByColor(baseProducts, variantProducts): retDict = {} for key, variant in variantProducts.items(): productKey = variant['parent'] + '_' + variant['color'] if productKey not in retDict: retDict[productKey] = baseProducts[variant['parent']] retDict[productKey]['variants'] = {} retDict[productKey]['variants'][key] = variant return retDict Now with my test data, baseProducts only contains one item in it. While variantProducts contain 4 items. When the first two loops happen it creates a new key, and adds the first and second variant under that key correctly (this was tested using ms code debugger) but when it looks at the 3rd item, it creates a new key, and adds the variant to that key, but it also overrides all the variants in the previous key, even if the variable productKey is the new key. And when the 4th item gets processed it again gets added to both. So to make sure that I'm not getting some wrong key somehow. I also tried to implement it like this: def combineProductsByColor(baseProducts, variantProducts): retDict = {} keys = list(variantProducts.keys()) for k in keys: productKey = variantProducts[k]['parent'] + '_' + variantProducts[k]['color'] if productKey not in retDict: retDict[productKey] = baseProducts[variantProducts[k]['parent']] retDict[productKey]['variants'] = {} retDict[productKey]['variants'][k] = variantProducts[k] return retDict But the result was identical. Again following the whole procedure with ms code debugger. I've also tried making the productKey simpler, but the problem still remains. Now I do have an idea how to implement this in a different way, but I don't see and understand why the code I provided doesn't work. Because when the new key gets generated, its not the same as the old, but it still can change values under the old key. Here is what the data looks like before and after processing it. baseProducts: { '2321963000004': { 'code': 'P20-0002', 'name': '?enske hla?e', 'regular_price': '22,99', 'vat': '22,00', 'attrib': { 'material': '97% bomba?, 3% elastan, 20% viskoza, 5% elastan' }, 'categories': ['01', '0101', '010104'] } } variantProducts: { '2321963991029': { 'parent': '2321963000004', 'color': '99', 'size': '102', 'title': None, 'name': None, 'regular_price': None, 'vat': None, 'attrib': None, 'categories': None }, '2321963991036': { 'parent': '2321963000004', 'color': '99', 'size': '103', 'title': None, 'name': None, 'regular_price': '25,99', 'vat': '22,00', 'attrib': None, 'categories': None }, '2321963981029': { 'parent': '2321963000004', 'color': '98', 'size': '102', 'title': None, 'name': None, 'regular_price': None, 'vat': None, 'attrib': None, 'categories': None }, '2321963981036': { 'parent': '2321963000004', 'color': '98', 'size': '103', 'title': None, 'name': None, 'regular_price': None, 'vat': None, 'attrib': None, 'categories': None } } And last combined data: { '2321963000004_99': { 'code': 'P20-0002', 'name': '?enske hla?e', 'regular_price': '22,99', 'vat': '22,00', 'attrib': { 'material': '97% bomba?, 3% elastan, 20% viskoza, 5% elastan' }, 'categories': ['01', '0101', '010104'], 'variants': { '2321963981029': { 'parent': '2321963000004', 'color': '98', 'size': '102', 'title': None, 'name': None, 'regular_price': None, 'vat': None, 'attrib': None, 'categories': None }, '2321963981036': { 'parent': '2321963000004', 'color': '98', 'size': '103', 'title': None, 'name': None, 'regular_price': None, 'vat': None, 'attrib': None, 'categories': None } } }, '2321963000004_98': { 'code': 'P20-0002', 'name': '?enske hla?e', 'regular_price': '22,99', 'vat': '22,00', 'attrib': { 'material': '97% bomba?, 3% elastan, 20% viskoza, 5% elastan' }, 'categories': ['01', '0101', '010104'], 'variants': { '2321963981029': { 'parent': '2321963000004', 'color': '98', 'size': '102', 'title': None, 'name': None, 'regular_price': None, 'vat': None, 'attrib': None, 'categories': None }, '2321963981036': { 'parent': '2321963000004', 'color': '98', 'size': '103', 'title': None, 'name': None, 'regular_price': None, 'vat': None, 'attrib': None, 'categories': None } } } } ---------- components: macOS messages: 374860 nosy: admir, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Overriding dictionary value under wrong key. type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 5 05:05:28 2020 From: report at bugs.python.org (Eric Wieser) Date: Wed, 05 Aug 2020 09:05:28 +0000 Subject: [New-bugs-announce] [issue41485] Repr of complex number with signed zero does not roundtrip Message-ID: <1596618328.49.0.282649932671.issue41485@roundup.psfhosted.org> New submission from Eric Wieser : Python distinguishes signed zeros by their repr: # floats >>> 0.0 0.0 >>> -0.0 -0.0 # complex >>> complex(0.0, 0.0) # A 0j >>> complex(0.0, -0.0) # B -0j >>> complex(-0.0, 0.0) # C (-0+0j) >>> complex(-0.0, -0.0) # D (-0+0j) However, only one of these `complex` reprs round-trips: >>> 0j # ok 0j >>> -0j # doesn't round-trip (-0-0j) >>> (-0+0j) # doesn't round-trip 0j >>> (-0-0j) 0j ---------- components: Interpreter Core messages: 374864 nosy: Eric Wieser priority: normal severity: normal status: open title: Repr of complex number with signed zero does not roundtrip versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 5 05:55:44 2020 From: report at bugs.python.org (Ma Lin) Date: Wed, 05 Aug 2020 09:55:44 +0000 Subject: [New-bugs-announce] [issue41486] Add _BlocksOutputBuffer for bz2/lzma/zlib module Message-ID: <1596621344.28.0.22443935276.issue41486@roundup.psfhosted.org> New submission from Ma Lin : ? bz2/lzma module's current growth algorithm bz2/lzma module's initial output buffer size is 8KB [1][2], and they are using this output buffer growth algorithm [3][4]: newsize = size + (size >> 3) + 6 [1] https://github.com/python/cpython/blob/v3.9.0b4/Modules/_bz2module.c#L109 [2] https://github.com/python/cpython/blob/v3.9.0b4/Modules/_lzmamodule.c#L124 [3] https://github.com/python/cpython/blob/v3.9.0b4/Modules/_lzmamodule.c#L133 [4] https://github.com/python/cpython/blob/v3.9.0b4/Modules/_bz2module.c#L121 For many case, the output buffer is resized too many times. You may paste this code to REPL to see the growth step: size = 8*1024 for i in range(1, 120): print('Step %d ' % i, format(size, ','), 'bytes') size = size + (size >> 3) + 6 Step 1 8,192 bytes Step 2 9,222 bytes Step 3 10,380 bytes Step 4 11,683 bytes Step 5 13,149 bytes Step 6 14,798 bytes ... ? zlib module's current growth algorithm zlib module's initial output buffer size is 16KB [5], in each growth the buffer size doubles [6]. [5] https://github.com/python/cpython/blob/v3.9.0b4/Modules/zlibmodule.c#L32 [6] https://github.com/python/cpython/blob/v3.9.0b4/Modules/zlibmodule.c#L174 This algorithm has a higher risk of running out of memory: ... Step 14 256 MB Step 15 512 MB Step 16 1 GB Step 17 2 GB Step 18 4 GB Step 19 8 GB Step 20 16 GB Step 21 32 GB Step 22 64 GB ... ? Add _BlocksOutputBuffer for bz2/lzma/zlib module Proposed PR uses a list of bytes object to represent output buffer. It can eliminate the overhead of resizing (bz2/lzma), and prevent excessive memory footprint (zlib). I only tested decompression, because the result is more obvious than compression. For special data benchmark (all data consists of b'a'), see these attached pictures, _BlocksOutputBuffer has linear performance: (Benchmark by attached file benchmark.py) 0to2GB_step30MB.png (Decompress from 0 to 2GB, 30MB step) 0to200MB_step2MB.png (Decompress from 0 to 200MB, 2MB step) 0to20MB_step64KB.png (Decompress from 0 to 20MB, 64KB step) After switching to _BlocksOutputBuffer, the code of bz2/lzma is more concise, the code of zlib is basically translated statement by statement, IMO it's safe and easy for review. ? Real data benchmark For real data, the weight of resizing output buffer is not big, so the performance improvement is not as big as above pictures: (Benchmark by attached file benchmark_real.py) ----------------- bz2 ----------------- linux-2.6.39.4.tar.bz2 input size: 76,097,195, output size: 449,638,400 best of 5: [baseline_raw] 12.954 sec -> [patched_raw] 11.600 sec, 1.12x faster (-10%) firefox-79.0.linux-i686.tar.bz2 input size: 74,109,706, output size: 228,055,040 best of 5: [baseline_raw] 8.511 sec -> [patched_raw] 7.829 sec, 1.09x faster (-8%) ffmpeg-4.3.1.tar.bz2 input size: 11,301,038, output size: 74,567,680 best of 5: [baseline_raw] 1.915 sec -> [patched_raw] 1.671 sec, 1.15x faster (-13%) gimp-2.10.20.tar.bz2 input size: 33,108,938, output size: 214,179,840 best of 5: [baseline_raw] 5.794 sec -> [patched_raw] 4.964 sec, 1.17x faster (-14%) sde-external-8.56.0-2020-07-05-lin.tar.bz2 input size: 26,746,086, output size: 92,129,280 best of 5: [baseline_raw] 3.153 sec -> [patched_raw] 2.835 sec, 1.11x faster (-10%) ----------------- lzma ----------------- linux-5.7.10.tar.xz input size: 112,722,840, output size: 966,062,080 best of 5: [baseline_raw] 9.813 sec -> [patched_raw] 7.434 sec, 1.32x faster (-24%) linux-2.6.39.4.tar.xz input size: 63,243,812, output size: 449,638,400 best of 5: [baseline_raw] 5.256 sec -> [patched_raw] 4.200 sec, 1.25x faster (-20%) gcc-9.3.0.tar.xz input size: 70,533,868, output size: 618,608,640 best of 5: [baseline_raw] 6.398 sec -> [patched_raw] 4.878 sec, 1.31x faster (-24%) Python-3.8.5.tar.xz input size: 18,019,640, output size: 87,531,520 best of 5: [baseline_raw] 1.315 sec -> [patched_raw] 1.098 sec, 1.20x faster (-16%) firefox-79.0.source.tar.xz input size: 333,220,776, output size: 2,240,573,440 best of 5: [baseline_raw] 25.339 sec -> [patched_raw] 19.661 sec, 1.29x faster (-22%) ----------------- zlib ----------------- linux-5.7.10.tar.gz input size: 175,493,557, output size: 966,062,080 best of 5: [baseline_raw] 2.360 sec -> [patched_raw] 2.401 sec, 1.02x slower (+2%) linux-2.6.39.4.tar.gz input size: 96,011,459, output size: 449,638,400 best of 5: [baseline_raw] 1.215 sec -> [patched_raw] 1.216 sec, 1.00x slower (+0%) gcc-9.3.0.tar.gz input size: 124,140,228, output size: 618,608,640 best of 5: [baseline_raw] 1.668 sec -> [patched_raw] 1.555 sec, 1.07x faster (-7%) Python-3.8.5.tgz input size: 24,149,093, output size: 87,531,520 best of 5: [baseline_raw] 0.263 sec -> [patched_raw] 0.253 sec, 1.04x faster (-4%) openjdk-14.0.2_linux-x64_bin.tar.gz input size: 198,606,190, output size: 335,175,680 best of 5: [baseline_raw] 1.273 sec -> [patched_raw] 1.221 sec, 1.04x faster (-4%) postgresql-10.12-1-linux-x64-binaries.tar.gz input size: 159,090,037, output size: 408,678,400 best of 5: [baseline_raw] 1.415 sec -> [patched_raw] 1.401 sec, 1.01x faster (-1%) -------------- benchmark end -------------- ? Add .readall() function to _compression.DecompressReader class The last commit add .readall() function to _compression.DecompressReader, it optimize the .read(-1) for BZ2File/LZMAFile/GzipFile object. The following description is a bit complicate: 1, BZ2File/LZMAFile/GzipFile object has a `self._buffer` attribute [7]: raw = _compression.DecompressReader(fp, BZ2Decompressor/LZMADecompressor/zlib.decompressobj) self._buffer = io.BufferedReader(raw) [7] https://github.com/python/cpython/blob/v3.9.0b4/Lib/lzma.py#L130-L132 2, When call `.read(-1)` function (read all data) on BZ2File/LZMAFile/GzipFile object, will dispatch to `self._buffer`'s .read(-1) function [8]. [8] https://github.com/python/cpython/blob/v3.9.0b4/Lib/lzma.py#L200 3, `self._buffer` is an io.BufferedReader object, it will dispatch to underlying stream's readall() function [9]. [9] https://github.com/python/cpython/blob/v3.9.0b4/Modules/_io/bufferedio.c#L1538-L1542 4, The underlying stream is a _compression.DecompressReader object, which is a subclass of io.RawIOBase [10]. [10] https://github.com/python/cpython/blob/v3.9.0b4/Lib/_compression.py#L33 5, Then io.RawIOBase's readall() function is called, but it's very inefficient. It only read DEFAULT_BUFFER_SIZE (8KB) data each time. [11] [11] https://github.com/python/cpython/blob/v3.9.0b4/Modules/_io/iobase.c#L968-L969 6, So each time the decompressor will try to decompress 8KB input data to a 8KB output buffer [12]: data = self._decompressor.decompress(8KB_input_buffer, 8KB_output_buffer) [12] https://github.com/python/cpython/blob/v3.9.0b4/Lib/_compression.py#L103 In most cases, the input buffer will not be fully decompressed, this brings unnecessary overhead. After adding the .readall() function to _compression.DecompressReader, the limit of the output buffer size has been removed. This change requires _BlocksOutputBuffer, otherwise, in extreme cases (small input buffer be decompressed to 100MB data), it will be slower due to the overhead of buffer resizing. Benchmark with real data, call .read(-1) on XXXXFile object: (Benchmark by attached file benchmark_real.py) ----------------- BZ2File ----------------- linux-2.6.39.4.tar.bz2 input size: 76,097,195, output size: 449,638,400 best of 5: [baseline_file] 12.371 sec -> [patched_file] 12.035 sec, 1.03x faster (-3%) firefox-79.0.linux-i686.tar.bz2 input size: 74,109,706, output size: 228,055,040 best of 5: [baseline_file] 8.233 sec -> [patched_file] 8.124 sec, 1.01x faster (-1%) ffmpeg-4.3.1.tar.bz2 input size: 11,301,038, output size: 74,567,680 best of 5: [baseline_file] 1.747 sec -> [patched_file] 1.724 sec, 1.01x faster (-1%) gimp-2.10.20.tar.bz2 input size: 33,108,938, output size: 214,179,840 best of 5: [baseline_file] 5.220 sec -> [patched_file] 5.162 sec, 1.01x faster (-1%) sde-external-8.56.0-2020-07-05-lin.tar.bz2 input size: 26,746,086, output size: 92,129,280 best of 5: [baseline_file] 2.935 sec -> [patched_file] 2.899 sec, 1.01x faster (-1%) ----------------- LZMAFile ----------------- linux-5.7.10.tar.xz input size: 112,722,840, output size: 966,062,080 best of 5: [baseline_file] 7.712 sec -> [patched_file] 7.670 sec, 1.01x faster (-1%) linux-2.6.39.4.tar.xz input size: 63,243,812, output size: 449,638,400 best of 5: [baseline_file] 4.342 sec -> [patched_file] 4.274 sec, 1.02x faster (-2%) gcc-9.3.0.tar.xz input size: 70,533,868, output size: 618,608,640 best of 5: [baseline_file] 5.077 sec -> [patched_file] 4.974 sec, 1.02x faster (-2%) Python-3.8.5.tar.xz input size: 18,019,640, output size: 87,531,520 best of 5: [baseline_file] 1.093 sec -> [patched_file] 1.087 sec, 1.01x faster (-1%) firefox-79.0.source.tar.xz input size: 333,220,776, output size: 2,240,573,440 best of 5: [baseline_file] 20.748 sec -> [patched_file] 20.276 sec, 1.02x faster (-2%) ----------------- GzipFile ----------------- linux-5.7.10.tar.gz input size: 175,493,567, output size: 966,062,080 best of 5: [baseline_file] 4.422 sec -> [patched_file] 3.803 sec, 1.16x faster (-14%) linux-2.6.39.4.tar.gz input size: 96,011,469, output size: 449,638,400 best of 5: [baseline_file] 2.119 sec -> [patched_file] 1.863 sec, 1.14x faster (-12%) gcc-9.3.0.tar.gz input size: 124,140,238, output size: 618,608,640 best of 5: [baseline_file] 2.825 sec -> [patched_file] 2.409 sec, 1.17x faster (-15%) Python-3.8.5.tgz input size: 24,149,103, output size: 87,531,520 best of 5: [baseline_file] 0.410 sec -> [patched_file] 0.349 sec, 1.18x faster (-15%) openjdk-14.0.2_linux-x64_bin.tar.gz input size: 198,606,200, output size: 335,175,680 best of 5: [baseline_file] 1.885 sec -> [patched_file] 1.702 sec, 1.11x faster (-10%) postgresql-10.12-1-linux-x64-binaries.tar.gz input size: 159,090,047, output size: 408,678,400 best of 5: [baseline_file] 2.236 sec -> [patched_file] 2.002 sec, 1.12x faster (-10%) -------------- benchmark end -------------- ---------- components: Library (Lib) messages: 374867 nosy: malin priority: normal severity: normal status: open title: Add _BlocksOutputBuffer for bz2/lzma/zlib module type: performance versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 5 06:30:35 2020 From: report at bugs.python.org (Shlomi Fish) Date: Wed, 05 Aug 2020 10:30:35 +0000 Subject: [New-bugs-announce] [issue41487] Builtin bigint modulo operation can be made faster when the base is divisible by a large power of 2 (i.e: has many trailing 0 digits in binary) Message-ID: <1596623435.88.0.500860382488.issue41487@roundup.psfhosted.org> New submission from Shlomi Fish : As the pure-Python code below demonstrates, when called as `python3 test.py jitshift` it is much faster than when called as `python3 test.py builtinops` (which takes many seconds/minutes past the 24th iteration). I am using fedora 32 x86-64 on a Cannon lake intel core i5 NUC. Tested with latest cpython3 git master and with /usr/bin/pypy3 The improvement was done in pure-python / userland and may be improved upon further given these or others: https://gmplib.org/ and https://github.com/ridiculousfish/libdivide . ``` #!/usr/bin/env python3 # The Expat License # # Copyright (c) 2020, Shlomi Fish # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import sys OPT = "builtinops" def mytest(p): pint2p = p << p myrange = range(1000) if OPT == "builtinpow": ret = pow(2, (1 << p), pint2p) elif OPT == "builtinops": ret = 2 for i in myrange: print('sq', i, flush=True) ret *= ret print('mod', i, flush=True) ret %= pint2p print('after mod', i, (ret % 10 ** 20), flush=True) else: class ShiftMod: """docstring for ShiftMod:d""" def __init__(self, base, shift): self.base = base self.shift = shift self.mask = (1 << shift) - 1 self.n = base << shift def mod(self, inp): if inp < self.n: return inp return ((((inp >> self.shift) % self.base) << self.shift) | (inp & self.mask)) def gen_shift_mod(x): s = 0 for offset in (200000, 20000, 2000, 200, 20, 1): bits_mask = (1 << offset) - 1 while x & bits_mask == 0: s += offset x >>= offset return ShiftMod(x, s) ret = 2 if OPT == "shiftmodpre": m = ShiftMod(p, p) for i in myrange: print('sq', i, flush=True) ret *= ret print('mod', i, flush=True) # m = gen_shift_mod(pint2p) ret = m.mod(ret) print('after mod', i, (ret % 10 ** 20), flush=True) elif OPT == "gen_shift_mod": m = gen_shift_mod(pint2p) for i in myrange: print('sq', i, flush=True) ret *= ret print('mod', i, flush=True) ret = m.mod(ret) print('after mod', i, (ret % 10 ** 20), flush=True) elif OPT == "jitshift": for i in myrange: print('sq', i, flush=True) ret *= ret print('mod', i, flush=True) ret = gen_shift_mod(pint2p).mod(ret) print('after mod', i, (ret % 10 ** 20), flush=True) return ret % (p*p) // p def main(which): global OPT OPT = which ''' if which == "builtinpow": OPT = 1 elif which == "builtinops": OPT = 0 elif which == "shiftmod": OPT = 2 else: raise Exception("unknown choice") ''' x = mytest(9816593) print(x) return if __name__ == "__main__": main(sys.argv[1]) ``` ---------- components: Interpreter Core files: modtest.py messages: 374869 nosy: shlomif2 priority: normal severity: normal status: open title: Builtin bigint modulo operation can be made faster when the base is divisible by a large power of 2 (i.e: has many trailing 0 digits in binary) type: performance versions: Python 3.10 Added file: https://bugs.python.org/file49369/modtest.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 5 10:25:10 2020 From: report at bugs.python.org (Andre Roberge) Date: Wed, 05 Aug 2020 14:25:10 +0000 Subject: [New-bugs-announce] [issue41488] Unusable type hint should not be silently ignored Message-ID: <1596637510.96.0.457695576567.issue41488@roundup.psfhosted.org> New submission from Andre Roberge : The following code is currently consistent with the type hint syntax but contains a line that is completely ignored. >>> d = {} >>> d['a']: int >>> d {} >>> __annotations__ {} >>> '__annotations__' in dir(d) False I believe that type hints that cannot be either attached to an object nor added to any other __annotations__ dict should either generate a SyntaxError or, at the very least, result in a warning. ---------- messages: 374884 nosy: aroberge priority: normal severity: normal status: open title: Unusable type hint should not be silently ignored type: behavior versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 5 16:04:25 2020 From: report at bugs.python.org (AbcSxyZ) Date: Wed, 05 Aug 2020 20:04:25 +0000 Subject: [New-bugs-announce] [issue41489] HTMLParser : HTMLParser.error creating multiple errors. Message-ID: <1596657865.41.0.326756245182.issue41489@roundup.psfhosted.org> New submission from AbcSxyZ : Coming from deprecated feature. Using python 3.7.3 Related and probably fixed with https://bugs.python.org/issue31844 Just in case. I've got 2 different related problems, the first one creating the second. Using linked file and this class : ``` from html.parser import HTMLParser class LinkParser(HTMLParser): """ DOM parser to retrieve href of all elements """ def parse_links(self, html_content): self.links = [] self.feed(html_content) return self.links def handle_starttag(self, tag, attrs): if tag == "a": attrs = {key.lower():value for key, *value in attrs} urls = attrs.get("href", None) if urls and urls[0]: self.links.append(urls[0]) # def error(self, *args, **kwargs): # pass if __name__ == "__main__": with open("error.txt") as File: LinkParser().parse_links(File.read()) ``` With error method commented, it creates : ``` File "scanner/link.py", line 8, in parse_links self.feed(html_content) File "/usr/lib/python3.7/html/parser.py", line 111, in feed self.goahead(0) File "/usr/lib/python3.7/html/parser.py", line 179, in goahead k = self.parse_html_declaration(i) File "/usr/lib/python3.7/html/parser.py", line 264, in parse_html_declaration return self.parse_marked_section(i) File "/usr/lib/python3.7/_markupbase.py", line 159, in parse_marked_section self.error('unknown status keyword %r in marked section' % rawdata[i+3:j]) File "/usr/lib/python3.7/_markupbase.py", line 34, in error "subclasses of ParserBase must override error()") NotImplementedError: subclasses of ParserBase must override error() ``` If error method do not raise anything, using only pass, it creates : ``` File "/home/simon/Documents/radio-parser/scanner/link.py", line 8, in parse_links self.feed(html_content) File "/usr/lib/python3.7/html/parser.py", line 111, in feed self.goahead(0) File "/usr/lib/python3.7/html/parser.py", line 179, in goahead k = self.parse_html_declaration(i) File "/usr/lib/python3.7/html/parser.py", line 264, in parse_html_declaration return self.parse_marked_section(i) File "/usr/lib/python3.7/_markupbase.py", line 160, in parse_marked_section if not match: UnboundLocalError: local variable 'match' referenced before assignment ``` We see here `match` variable is not created if `self.error` is called, and because error do not raise exception, will create UnboundLocalError : ``` def parse_marked_section(self, i, report=1): rawdata= self.rawdata assert rawdata[i:i+3] == ' ending match= _markedsectionclose.search(rawdata, i+3) elif sectName in {"if", "else", "endif"}: # look for MS Office ]> ending match= _msmarkedsectionclose.search(rawdata, i+3) else: self.error('unknown status keyword %r in marked section' % rawdata[i+3:j]) if not match: return -1 if report: j = match.start(0) self.unknown_decl(rawdata[i+3: j]) return match.end(0) ``` ---------- files: error.txt messages: 374899 nosy: AbcSxyZ priority: normal severity: normal status: open title: HTMLParser : HTMLParser.error creating multiple errors. type: crash versions: Python 3.7 Added file: https://bugs.python.org/file49370/error.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 5 17:26:19 2020 From: report at bugs.python.org (Steve Dower) Date: Wed, 05 Aug 2020 21:26:19 +0000 Subject: [New-bugs-announce] [issue41490] Update bundled pip to 20.2.1 and setuptools to 49.2.1 Message-ID: <1596662779.45.0.341157838113.issue41490@roundup.psfhosted.org> New submission from Steve Dower : I'm doing the PR now, based on the latest versions available today: https://pypi.org/project/pip/20.2.1/ https://pypi.org/project/setuptools/49.2.1/ If you're a maintainer and there's a reason to not update to to the latest, please let me know asap. All of our subsequent releases should be RC's, so I assume we won't take any changes bigger than targeted fixes before the next full releases. ---------- assignee: steve.dower components: Distutils messages: 374901 nosy: Marcus.Smith, dstufft, eric.araujo, jaraco, lukasz.langa, ncoghlan, paul.moore, pradyunsg, steve.dower priority: normal severity: normal stage: needs patch status: open title: Update bundled pip to 20.2.1 and setuptools to 49.2.1 versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 5 18:16:19 2020 From: report at bugs.python.org (Wesley Whetstone) Date: Wed, 05 Aug 2020 22:16:19 +0000 Subject: [New-bugs-announce] [issue41491] plistlib can't load macOS BigSur system LaunchAgent Message-ID: <1596665779.04.0.552451730401.issue41491@roundup.psfhosted.org> New submission from Wesley Whetstone : When attempting to load the new LaunchAgent at `/System/Library/LaunchAgents/com.apple.cvmsCompAgent3600_arm64.plist` plistlib Raises a ValueError of File "/opt/salt/lib/python3.7/plistlib.py", line 272, in handle_end_element handler() File "/opt/salt/lib/python3.7/plistlib.py", line 332, in end_integer self.add_object(int(self.get_data())) ValueError: invalid literal for int() with base 10: '0x0100000c' on 0x0100000c Technically this violates the spec at http://www.apple.com/DTDs/PropertyList-1.0.dtd. Figured it was worth reporting. Full Plist is attached. ---------- files: com.apple.cvmsCompAgent_arm64.plist messages: 374908 nosy: jckwhet priority: normal severity: normal status: open title: plistlib can't load macOS BigSur system LaunchAgent Added file: https://bugs.python.org/file49371/com.apple.cvmsCompAgent_arm64.plist _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 5 19:35:01 2020 From: report at bugs.python.org (Steve Dower) Date: Wed, 05 Aug 2020 23:35:01 +0000 Subject: [New-bugs-announce] [issue41492] Fix signing description for Windows release builds Message-ID: <1596670501.61.0.28435008733.issue41492@roundup.psfhosted.org> New submission from Steve Dower : At some point, Windows started displaying an authenticated certificate property as the display name in UAC prompts, rather than the file properties. Currently our SigningDescription is set to the build identifier, which is not a nice display name. We should change it to be "Python 3.x.y" (which will involve updating the build YAML files to extract the version number). ---------- assignee: steve.dower components: Windows messages: 374910 nosy: paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Fix signing description for Windows release builds type: behavior versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 6 05:04:27 2020 From: report at bugs.python.org (Inada Naoki) Date: Thu, 06 Aug 2020 09:04:27 +0000 Subject: [New-bugs-announce] [issue41493] Refactoring dictresize to accept only new keysize Message-ID: <1596704667.77.0.860143007378.issue41493@roundup.psfhosted.org> New submission from Inada Naoki : dictresize accept `minsize` and calculate `newsize` which is `newsize >= minsize`. Some caller pass the exact dk_size so calculating `newsize` is not necessary. Split calculating `newsize` from `minused` into new function. Additonally, use _Py_bit_length for the calculation when possible. ---------- components: Interpreter Core messages: 374919 nosy: inada.naoki priority: normal severity: normal status: open title: Refactoring dictresize to accept only new keysize versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 6 07:10:23 2020 From: report at bugs.python.org (Soumendra Ganguly) Date: Thu, 06 Aug 2020 11:10:23 +0000 Subject: [New-bugs-announce] [issue41494] Add window resizing support [ SIGWINCH ] to Lib/pty Message-ID: <1596712223.19.0.204047363548.issue41494@roundup.psfhosted.org> New submission from Soumendra Ganguly : This was tested using Python 3.7 after commenting out the sys.audit lines. https://docs.python.org/3/library/pty.html presents us with an example usage of pty.spawn. This example mimics script(1). However, the script(1) from util-linux has fantastic signal handing that pty.spawn does not directly provide. In fact, Lib/pty.py says "Bugs: No signal handling. Doesn't set slave termios and window size." xterm(1) on Debian 10 GNU/Linux was used to test the pty.spawn example mentioned above; upon resizing the xterm(1) window, the output of programs such as ls(1) became scattered and hard to visually parse. This patch does not modify any of the functions that are already present in Lib/pty. Instead, it exposes a new function called "wspawn" [ pty.wspawn ]. This is like pty.spawn + the following differences. 1. Window size is set at the beginning. 2. A SIGWINCH handler is registered. The old handler is saved and restored later. 3. If the above two steps fail, then cleanup is done, and an exception is raised, so that the programmer can catch the exception and use pty.spawn instead. 4. Unlike pty.spawn, this does not depend on OSError to break out of the parent mainloop. Instead, the main loop calls select with an adjustable timeout, so that waitpid with WNOHANG can be called periodically to check if the spawned child process has undergone an alteration of state. 5. While the return value is same as that of pty.spawn, this accepts an extra optional "timeout" argument for the select call. The aforementioned pty.spawn example now works well with window resizing if pty.wspawn is used in place of pty.spawn. Signed-off-by: Soumendra Ganguly ---------- components: Library (Lib) files: pty.diff keywords: patch messages: 374926 nosy: soumendra priority: normal severity: normal status: open title: Add window resizing support [ SIGWINCH ] to Lib/pty type: enhancement versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 Added file: https://bugs.python.org/file49372/pty.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 6 08:05:45 2020 From: report at bugs.python.org (john mathew) Date: Thu, 06 Aug 2020 12:05:45 +0000 Subject: [New-bugs-announce] [issue41495] Technical advise Message-ID: <1596715545.04.0.835435955151.issue41495@roundup.psfhosted.org> New submission from john mathew : We provide Technical Help to our users by a diagnosis of their computer and other devices. And if there is an issue to be solved, we give out the solution. This helps the user to avoid any existing issues. http://tplinklogins.com http://linksysextendersetups.com http://tplinkloginn.com http://tplinkextendersetupp.com ---------- messages: 374932 nosy: john745 priority: normal severity: normal status: open title: Technical advise _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 6 08:47:49 2020 From: report at bugs.python.org (Dominik V.) Date: Thu, 06 Aug 2020 12:47:49 +0000 Subject: [New-bugs-announce] [issue41496] Create public API for typing._eval_type Message-ID: <1596718069.87.0.65884086877.issue41496@roundup.psfhosted.org> New submission from Dominik V. : In this [python-ideas thread](https://mail.python.org/archives/list/python-ideas at python.org/thread/T6K4DWENPM7LYXSDVYQYDVFEVBMA5K3L/) it was suggested to create a public API for `typing._eval_type` in order to be able to create custom versions of `get_type_hints`. Specifically a version that allows to specify an upper boundary in the MRO when retrieving type hints for a class object. The public API should use `None` as defaults for `globalns` and `localns` and not expose the `recursive_guard` parameter. ---------- messages: 374933 nosy: Dominik V. priority: normal severity: normal status: open title: Create public API for typing._eval_type type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 6 15:52:45 2020 From: report at bugs.python.org (JIanqiu Tao) Date: Thu, 06 Aug 2020 19:52:45 +0000 Subject: [New-bugs-announce] [issue41497] Potential UnicodeDecodeError in dis Message-ID: <1596743565.22.0.770154691166.issue41497@roundup.psfhosted.org> New submission from JIanqiu Tao : A potential UnicodeDecodeError could be raised when run "python -m dis" on non-utf8 encoding environment. Assume there is a file named "a.py", and contains "print('?')", then save with UTF8 encoding. Run "python -m dis ./a.py", on non-UTF8 encoding environment, for example a Windows PC which default language is Chinese. A UnicodeDecodeError raised. Traceback (most recent call last): File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\Python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Program Files\Python38\lib\dis.py", line 553, in _test() File "C:\Program Files\Python38\lib\dis.py", line 548, in _test source = infile.read() UnicodeDecodeError: 'gbk' codec can't decode byte 0xb5 in position 9: illegal multibyte sequence That because Windows' default encoding is decided by language. Chinese use cp936(GB2312) as default encoding and can't handle UTF8 encoding. It just need to read in "rb" mode instead of "r". ---------- components: Library (Lib) messages: 374961 nosy: zkonge priority: normal severity: normal status: open title: Potential UnicodeDecodeError in dis type: behavior versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 6 16:20:07 2020 From: report at bugs.python.org (Roman Yurchak) Date: Thu, 06 Aug 2020 20:20:07 +0000 Subject: [New-bugs-announce] [issue41498] Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not set Message-ID: <1596745207.18.0.893678923913.issue41498@roundup.psfhosted.org> New submission from Roman Yurchak : The `_Py_Sigset_Converter` function is conditionally defined in https://github.com/python/cpython/blob/777b611c8c5676b80898a429f71d28e59bddc49d/Modules/posixmodule.h#L27 if `ifdef HAVE_SIGSET_T` However this function is called unconditionally in https://github.com/python/cpython/blob/777b611c8c5676b80898a429f71d28e59bddc49d/Modules/clinic/signalmodule.c.h#L385 (there are 4 such occurrences), which leads to a compilation error when `HAVE_SIGSET_T` is not set. This is regression in 3.8+ as far as I can tell due to changes in https://github.com/python/cpython/pull/6720 I imagine the solution could be to always define this function but raise an exception if it is called when HAVE_SIGSET_T` is undefined, as done in the following patch: https://github.com/iodide-project/pyodide/blob/fc5495ffdb54a11fd588dc60ba6b8777f90c3724/cpython/patches/0006-fix-Py_Sigset_Converter.patch Would this be acceptable, or is there a better way of handling it? Thanks! ---------- messages: 374963 nosy: Roman Yurchak, pablogsal, serhiy.storchaka priority: normal severity: normal status: open title: Undefinied _Py_Sigset_Converter function when HAVE_SIGSET_T not set versions: Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 7 04:38:02 2020 From: report at bugs.python.org (=?utf-8?q?Lasse_N=C3=B8rfeldt?=) Date: Fri, 07 Aug 2020 08:38:02 +0000 Subject: [New-bugs-announce] [issue41499] logging nested file path Message-ID: <1596789482.89.0.186016372743.issue41499@roundup.psfhosted.org> New submission from Lasse N?rfeldt : I have been having a lot of issues when creating loggers that are located in nested folders. I have attached a .py with a logger module. Currently it works if I don't place them in nested folders... ---------- components: Library (Lib) files: logger.py messages: 374985 nosy: Norfeldt priority: normal severity: normal status: open title: logging nested file path versions: Python 3.8 Added file: https://bugs.python.org/file49374/logger.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 7 07:10:23 2020 From: report at bugs.python.org (Pauser) Date: Fri, 07 Aug 2020 11:10:23 +0000 Subject: [New-bugs-announce] [issue41500] InterpolationSyntaxError reading the (windows) environment with unresolved environment variables Message-ID: <1596798623.9.0.767951694174.issue41500@roundup.psfhosted.org> New submission from Pauser : Hello, I tried to extend our config processing using the environment variables and the configparser module. On some machines (all windows) the configparser failed with an InterpolationSyntaxError ... It seems that not resolved environment variables (e.g. "test":"%not_existing%") lead to this error. I wrote little python test file reproducing the error and providing a very simple workaround to not fix all environments ;) Attention the bug is reproduced but the test is green ^^ I would be happy to remove the workaround as soon as possible ;) ---------- components: Library (Lib) files: test_EnvironmentProcessing.py messages: 374991 nosy: c_panser, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: InterpolationSyntaxError reading the (windows) environment with unresolved environment variables type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49375/test_EnvironmentProcessing.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 7 08:54:37 2020 From: report at bugs.python.org (BSM and 102 others) Date: Fri, 07 Aug 2020 12:54:37 +0000 Subject: [New-bugs-announce] [issue41501] 0x80070643, can't install any version Message-ID: <1596804877.84.0.108317920754.issue41501@roundup.psfhosted.org> New submission from BSM and 102 others : I wanted to install Python 3.8, but I poorly removed a previous version of Python 3.3 through the "permanently delete" function. I started the installer and it gave me a 0x80070643 error with a log similar to the link provided(https://pastebin.com/RzQEttiL). I then try and uninstall via the Control Panel, but it does nothing. "Change" brings up a 3.3 launcher, but that crashes as well. "Repair" brings up a message saying "Fatal error during installation", so I switch to installing via a 3.3.3 64bit launcher, which crashes, then I switch to a non-64bit one, and that crashes. I also try toggling PATH, but that changes nothing. And now I am stuck. ---------- components: Installation messages: 374996 nosy: BSMMedia priority: normal severity: normal status: open title: 0x80070643, can't install any version type: crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 7 09:11:36 2020 From: report at bugs.python.org (Aaron Lichtman) Date: Fri, 07 Aug 2020 13:11:36 +0000 Subject: [New-bugs-announce] [issue41502] Option for Colored Logging in http.server Module Message-ID: <1596805896.61.0.531750689021.issue41502@roundup.psfhosted.org> New submission from Aaron Lichtman : It would be useful if the http.server module had an option for colored logging to help users visually parse the HTTP traffic logs. $ python3 -m http.server 80 --color is along the lines of what I'm thinking. ---------- components: Library (Lib) messages: 374997 nosy: alichtman priority: normal severity: normal status: open title: Option for Colored Logging in http.server Module type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 7 11:10:00 2020 From: report at bugs.python.org (Irit Katriel) Date: Fri, 07 Aug 2020 15:10:00 +0000 Subject: [New-bugs-announce] [issue41503] Race between setTarget and flush in logging.handlers.MemoryHandler Message-ID: <1596813000.5.0.282136577627.issue41503@roundup.psfhosted.org> New submission from Irit Katriel : The `logging.handlers.MemoryHandler.setTarget()` method does not acquire the lock, so it can change the target while flush is processing the buffer. The script below causes flush to call target.handle when target is None, causing: File "C:\Users\User\src\cpython\lib\logging\handlers.py", line 1265, in emit self.flush() File "C:\Users\User\src\cpython\lib\logging\handlers.py", line 1348, in flush self.target.handle(record) AttributeError: 'NoneType' object has no attribute 'handle' ------------------------------------------------ import io import logging.handlers import threading import time class SlowHandler: def __init__(self): self.stream = io.StringIO() self.streamHandler = logging.StreamHandler(self.stream) def handle(self, msg): time.sleep(1) self.streamHandler.handle(msg) target = SlowHandler() mem_hdlr = logging.handlers.MemoryHandler(10, logging.ERROR, target) mem_logger = logging.getLogger('mem') mem_logger.propagate = False mem_logger.addHandler(mem_hdlr) def toggleTarget(): time.sleep(1) mem_hdlr.setTarget(None) t = threading.Thread(target=toggleTarget, args=()) t.daemon = True t.start() while True: time.sleep(0.1) mem_logger.warning("warning not flushed") mem_logger.error("error is flushed") ------------------------------------------------ ---------- components: Library (Lib) messages: 375001 nosy: iritkatriel priority: normal severity: normal status: open title: Race between setTarget and flush in logging.handlers.MemoryHandler type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 7 17:19:20 2020 From: report at bugs.python.org (Edward K Ream) Date: Fri, 07 Aug 2020 21:19:20 +0000 Subject: [New-bugs-announce] [issue41504] Add links to asttokens, leoAst, LibCST and Parso to ast.rst Message-ID: <1596835160.37.0.4007435101.issue41504@roundup.psfhosted.org> New submission from Edward K Ream : These links added with the provisional approval of GvR, pending approval of the PR. ---------- assignee: docs at python components: Documentation messages: 375019 nosy: docs at python, edreamleo priority: normal severity: normal status: open title: Add links to asttokens, leoAst, LibCST and Parso to ast.rst type: enhancement versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 7 21:24:55 2020 From: report at bugs.python.org (Kevin Amado) Date: Sat, 08 Aug 2020 01:24:55 +0000 Subject: [New-bugs-announce] [issue41505] asyncio.gather of large streams with limited resources Message-ID: <1596849895.25.0.102671243316.issue41505@roundup.psfhosted.org> New submission from Kevin Amado : Sometimes when dealing with high concurrency systems developers face the problem of executing concurrently a large number of tasks while taking care of a finite pool of resources Just to mention some examples: - reading asynchronously a lot of files without exceeding the maximum number of open files by the operative system - making millions of requests to a website, doing it in sufficiently small batches as not to be banned by the site's firewall or hitting API limits - making a lot of DNS lookups without exceeding the maximum number of open sockets allowed by the operative system - and many more What these examples have in common is that there is a hard-limit in the maximum concurrency possible to solve the problem. A naive approach is to split the long list of tasks in small batches and use asyncio.gather on each batch. This, however, has some downsides if one of the tasks takes more time than the others because at some point in time only this task would be running and the execution of the following batch gets delayed, impacting performance and overall throughput and execution time. Another approach is to use asyncio.wait on a subset of tasks, gathering the done tasks and appending more tasks from the remaining subset until all tasks get executed. This alternative is good but still far from optimal as many boilerplate code is needed. The ideal approach is to operate in the possibly infinite list of tasks with an always constant number of them being resolved concurrently. If one of the tasks being concurrently executed finishes then immediately another one is fetched from the input stream and added to the list of concurrently executing ones. By doing it in this way we optimize the resources needed while minimizing the total execution time and never exceeding the finite pool of resources (sockets, open files, http API limit), etc. What I'm attaching is a proof of concept of a new function to add to the asyncio.tasks module that implements the ideal approach. The proposed signature for such function is: async def materialize(aws, *, max_concurrency=None) And functions in this way: ``` async def do(n: int) -> None: print('running', n) await asyncio.sleep(1) print('returning', n) return n async def main(): result = [] async for x in materialize(map(do, range(5)), max_concurrency=2): print('got', x) result.append(x) print(result) ``` Whose output is: running 0 running 1 returning 0 returning 1 got 0 got 1 running 2 running 3 returning 2 returning 3 got 2 got 3 running 4 returning 4 got 4 [0, 1, 2, 3, 4] As you can see, tasks are resolved concurrently without exceeding the max concurrency allowed, yet always executing concurrently as many tasks as the limit specifies. Yielding results as soon as available, keeping a small memory footprint (proportional to the max concurrency allowed) and returning results in the same order of the input stream (opposite to asyncio.as_completed) Since it's an asynchronous generator it can deal with infinite input streams, which is nice! I'm willing to work further on a PR ---------- components: asyncio files: materialize.py messages: 375028 nosy: asvetlov, kamadorueda, yselivanov priority: normal severity: normal status: open title: asyncio.gather of large streams with limited resources type: enhancement versions: Python 3.10 Added file: https://bugs.python.org/file49377/materialize.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 7 21:32:00 2020 From: report at bugs.python.org (Aaron Meurer) Date: Sat, 08 Aug 2020 01:32:00 +0000 Subject: [New-bugs-announce] [issue41506] Inclusion or documentation of extended with syntax in 3.9 Message-ID: <1596850320.21.0.142080709573.issue41506@roundup.psfhosted.org> New submission from Aaron Meurer : This discussion started at https://github.com/python/cpython/pull/19503 (actually on Twitter https://twitter.com/asmeurer/status/1289304407696261120), but Guido asked me to move it bpo. Alongside the implementation of Python 3.9's new PEG parser, a new syntax feature has been added, which is the ability to use parentheses in with statements, like with (open('a') as f1, open('b') as f2): ... This is an error in lower versions of Python (or an error about tuple not having __enter__ if the "as" parts are omitted). This new feature is not documented in the "What's new in Python 3.9" document https://docs.python.org/3.9/whatsnew/3.9.html. It also apparently goes against PEP 627 https://www.python.org/dev/peps/pep-0617/, which says (in bold), "no new Python Grammar addition will be added that requires the PEG parser". Note that this feature does indeed rely on the PEG parser, and it stops working if you use python -X oldparser or PYTHONOLDPARSER=1. I think this feature should either 1. be removed from 3.9 and held until 3.10, or 2. be documented properly, including in the document for the "with" statement and the "what's new" document. Also the PEP should be updated if this option is chosen. Others have stated opinions about this on the issue or on Twitter, but I'll let them repeat them here rather than trying to summarize. ---------- messages: 375029 nosy: asmeurer priority: normal pull_requests: 20921 severity: normal status: open title: Inclusion or documentation of extended with syntax in 3.9 versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 7 23:14:44 2020 From: report at bugs.python.org (Inada Naoki) Date: Sat, 08 Aug 2020 03:14:44 +0000 Subject: [New-bugs-announce] [issue41507] Use utf-8 in "Reading and Writing Files" tutorial. Message-ID: <1596856484.75.0.552563820268.issue41507@roundup.psfhosted.org> New submission from Inada Naoki : https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files Current tutorial doesn't mention about encoding and example uses locale encoding. Since UTF-8 is major text encoding and many Windows environment doesn't use UTF-8 by default, encoding should be mentioned in the tutorial and UTF-8 should be recommended. Additionally, the paragraph about line ending conversion [1] can be removed. This was important in Python 2. But it is not important because (en|de)coding binary data is nonsense already. [1]: "This behind-the-scenes modification to file data is fine for text files, but will corrupt binary data like that in JPEG or EXE files. Be very careful to use binary mode when reading and writing such files." ---------- assignee: docs at python components: Documentation keywords: newcomer friendly messages: 375033 nosy: docs at python, inada.naoki priority: normal severity: normal status: open title: Use utf-8 in "Reading and Writing Files" tutorial. type: enhancement versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 8 05:57:46 2020 From: report at bugs.python.org (Alex) Date: Sat, 08 Aug 2020 09:57:46 +0000 Subject: [New-bugs-announce] [issue41508] Failed to open os.path in Open Module window of IDLE without any error informations Message-ID: <1596880666.24.0.0998253425531.issue41508@roundup.psfhosted.org> New submission from Alex <2423067593 at qq.com>: When openning os.path by Open Module window in IDLE (Shortcut: Alt + M), the window didn't open 'ntpath'(in Windows) or show any error informations. ---------- assignee: terry.reedy components: IDLE messages: 375040 nosy: Alex-Python-Programmer, terry.reedy priority: normal severity: normal status: open title: Failed to open os.path in Open Module window of IDLE without any error informations type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 8 13:34:37 2020 From: report at bugs.python.org (Jason R. Coombs) Date: Sat, 08 Aug 2020 17:34:37 +0000 Subject: [New-bugs-announce] [issue41509] ntpath.relpath behaves differently on Windows with trailing spaces Message-ID: <1596908077.96.0.398710638995.issue41509@roundup.psfhosted.org> New submission from Jason R. Coombs : On Windows: Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import ntpath >>> ntpath.relpath('foo ', 'foo') '.' On macOS: Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import ntpath >>> ntpath.relpath('foo ', 'foo') '..\\foo ' I stumbled into this issue when troubleshooting an [issue in a Setuptools PR](https://github.com/pypa/setuptools/pull/2305#issuecomment-670946965). I suspect the Windows version is using some API that strips whitespace from the filename before performing a relative path. However, when using relpath to detect characters after a common path, stripping the whitespace can cause problems. I wouldn't expect Windows to be performing normalization of paths in relpath, but it seems it does. If this behavior is by design and has a good reason, that behavior should be mirrored in the non-Windows implementation. ---------- components: Windows messages: 375053 nosy: jaraco, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: ntpath.relpath behaves differently on Windows with trailing spaces versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 8 20:14:35 2020 From: report at bugs.python.org (Maciej Olko) Date: Sun, 09 Aug 2020 00:14:35 +0000 Subject: [New-bugs-announce] [issue41510] Mentions of pdb.set_trace() in library/functions and library/sys uncorrectly states that set_trace expects no arguments Message-ID: <1596932075.04.0.305444661582.issue41510@roundup.psfhosted.org> New submission from Maciej Olko : An argument was added to pdb.set_trace() in Python 3.7 and those fragments of documentation should have been updated: library/functions.rst:120 > By default, sys.breakpointhook() calls pdb.set_trace() expecting no arguments. library/sys.rst > For example, the default binding (e.g. pdb.set_trace()) expects no arguments, but you might bind it to a function that expects additional arguments (positional and/or keyword). ---------- assignee: docs at python components: Documentation messages: 375064 nosy: Maciej Olko, docs at python priority: normal severity: normal status: open title: Mentions of pdb.set_trace() in library/functions and library/sys uncorrectly states that set_trace expects no arguments versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 9 13:43:16 2020 From: report at bugs.python.org (Yaroslav) Date: Sun, 09 Aug 2020 17:43:16 +0000 Subject: [New-bugs-announce] [issue41511] Pathlib parents doesn't support slicing with negative indexes Message-ID: <1596994996.9.0.794186780316.issue41511@roundup.psfhosted.org> New submission from Yaroslav : As I can see, pathlib path parents don't support slicing with negative indexes: >>> import pathlib >>> path = pathlib.PosixPath("some/very/long/path/here") >>> path.parents[-1] ... raise IndexError(idx) IndexError: -1 That's kinda weird for python. I mean, in regular list/etc if I need the last element, I'd normally do list[-1], but here to get the last parent, I need to actually know how many parents do I have. So now, I can do something like this: >>> parents_count = len(path.parents) - 1 >>> path.parents[parents_count] PosixPath('.') So that's how I can get the last parent. But is it pythonic? No. So, I decided to fix this, and now we can do negative slicing: >>> path.parents[-1] == path.parents[parents_count] True >>> path.parents[-2] == path.parents[parents_count - 1] True So what do you guys think about this? ---------- components: Library (Lib) messages: 375076 nosy: ypank priority: normal severity: normal status: open title: Pathlib parents doesn't support slicing with negative indexes type: behavior versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 9 20:51:11 2020 From: report at bugs.python.org (evaldas) Date: Mon, 10 Aug 2020 00:51:11 +0000 Subject: [New-bugs-announce] [issue41512] Microsoft Store app IDLE (Python 3.8.5) cannot save files Message-ID: <1597020671.06.0.0667003578842.issue41512@roundup.psfhosted.org> New submission from evaldas : OS: x64 Windows 10 Professional 1903 Python: Python 3.8 package (3.8.5) installed from Microsoft Store Steps to reproduce the bug: 1. Create empty file (right click anywhere, "New" -> "Text document", rename to "insert_filename_here.py"). File size is 0 bytes. 2. Open the file in IDLE 3. Type "import os" (actually content could be anything). IDLE title bar changes by prepending asterisk (*) to the filename, indicating file is modified but not saved yet. 4a. Press Ctrl+S --> nothing happens 4b. Click "File" -> "Save" --> nothing happens 4c. Click "File" -> "Close". Dialog pops-up "Do you want to save insert_filename_here.py before closing?", click "Yes" --> nothing happens Tested on 2 machines, same behavior. If file has some previuos content, sometimes saving in IDLE works (not always). ---------- assignee: terry.reedy components: IDLE messages: 375088 nosy: evaldas, terry.reedy priority: normal severity: normal status: open title: Microsoft Store app IDLE (Python 3.8.5) cannot save files versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 9 21:14:14 2020 From: report at bugs.python.org (Raymond Hettinger) Date: Mon, 10 Aug 2020 01:14:14 +0000 Subject: [New-bugs-announce] [issue41513] Scale by power of two in math.hypot() Message-ID: <1597022054.77.0.549983904563.issue41513@roundup.psfhosted.org> New submission from Raymond Hettinger : I'd like to resurrect Serhiy's idea for using power-of-two scaling in math.hypot() rather than dividing each coordinate by the maximum value. I drafted a patch. It looks to be a little faster than what we have now and is generally (but not always) more accurate. For accuracy, the current approach has the advantage that for the largest coordinate, (x/max)**2 is exactly 1.0. If that element is much larger than the others, it overpowers the 1/2 ulp error in each of the other divisions. In contrast, scaling by a power of two is always exact, but the squaring of the largest scaled coordinate is no longer exact. The two approaches each have some cases that are more accurate than the other. I generated 10,000 samples. In 66% of the cases, the two results agree. In 26% of the cases, scaling by a power of two was more accurate. In the remaining 8%, the division by max was more accurate. The standard deviation of relative errors was better using power-of-two scaling. These results were consistent whether using 2, 3, or 20 dimensions. As expected, multiplying by a power of two was a bit faster than dividing by an arbitrary float. ---------- components: Library (Lib) messages: 375089 nosy: mark.dickinson, rhettinger, serhiy.storchaka, tim.peters priority: low severity: normal status: open title: Scale by power of two in math.hypot() type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 10 08:02:17 2020 From: report at bugs.python.org (STINNER Victor) Date: Mon, 10 Aug 2020 12:02:17 +0000 Subject: [New-bugs-announce] [issue41514] test_idle: test_error() failed on aarch64 RHEL8 Refleaks 3.8 Message-ID: <1597060937.12.0.87529554525.issue41514@roundup.psfhosted.org> New submission from STINNER Victor : https://buildbot.python.org/all/#/builders/597/builds/178 test_error (idlelib.idle_test.test_run.HandleErrorTest) ... FAIL (...) ====================================================================== FAIL: test_error (idlelib.idle_test.test_run.HandleErrorTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildarea/3.8.cstratak-RHEL8-aarch64.refleak/build/Lib/unittest/mock.py", line 1325, in patched return func(*newargs, **newkeywargs) File "/home/buildbot/buildarea/3.8.cstratak-RHEL8-aarch64.refleak/build/Lib/idlelib/idle_test/test_run.py", line 352, in test_error eq(self.func.called, 2) AssertionError: 4 != 2 I can reproduce the issue on 3.8, 3.9 and master branches: 14:00:18 vstinner at apu$ ./python -m test -m test_error -v test_idle test_idle == CPython 3.8.5+ (heads/3.8:61f23cb62d, Aug 10 2020, 14:00:04) [GCC 10.2.1 20200723 (Red Hat 10.2.1-1)] == Linux-5.7.11-200.fc32.x86_64-x86_64-with-glibc2.29 little-endian == cwd: /home/vstinner/python/3.8/build/test_python_43858 == CPU count: 8 == encodings: locale=UTF-8, FS=utf-8 0:00:00 load avg: 1.68 Run tests sequentially 0:00:00 load avg: 1.68 [1/2] test_idle test_error (idlelib.idle_test.test_run.HandleErrorTest) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.004s OK 0:00:00 load avg: 1.68 [2/2] test_idle test_error (idlelib.idle_test.test_run.HandleErrorTest) ... FAIL ====================================================================== FAIL: test_error (idlelib.idle_test.test_run.HandleErrorTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vstinner/python/3.8/Lib/unittest/mock.py", line 1325, in patched return func(*newargs, **newkeywargs) File "/home/vstinner/python/3.8/Lib/idlelib/idle_test/test_run.py", line 352, in test_error eq(self.func.called, 2) AssertionError: 4 != 2 ---------------------------------------------------------------------- Ran 1 test in 0.007s FAILED (failures=1) test test_idle failed test_idle failed == Tests result: FAILURE == 1 test OK. 1 test failed: test_idle Total duration: 722 ms Tests result: FAILURE It seems like the test was added recently: commit f2e161c27964a59bc5ab20d96f87ba5862c6222d Author: Terry Jan Reedy Date: Sun Aug 9 16:08:30 2020 -0400 bpo-41468: Improve and test IDLE run error exit (GH-21798) A message box pops up when an unexpected error stops the run process. Tell users it is likely a random glitch, but report it if not. ---------- assignee: terry.reedy components: IDLE, Tests messages: 375106 nosy: terry.reedy, vstinner priority: normal severity: normal status: open title: test_idle: test_error() failed on aarch64 RHEL8 Refleaks 3.8 versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 10 09:43:58 2020 From: report at bugs.python.org (Eric Fahlgren) Date: Mon, 10 Aug 2020 13:43:58 +0000 Subject: [New-bugs-announce] [issue41515] typing.get_type_hints generates KeyError Message-ID: <1597067038.73.0.335844562656.issue41515@roundup.psfhosted.org> New submission from Eric Fahlgren : Windows 10 Pro 64 Python 3.8.3 64 wxPython 4.1.0 It appears that there are synthetic classes in the mro, which don't appear in the type's namespace, raising KeyError when encountered. From reading the function's doc and source, it looks like it should handle this internally and return a valid dict (possibly empty), and not raise KeyError. >>> import typing, wx >>> typing.get_type_hints(wx.Window)' Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Python38\lib\typing.py", line 1223, in get_type_hints base_globals = sys.modules[base.__module__].__dict__ >>> wx.Window.mro() [, , , , , , , ] KeyError: 'sip' ---------- components: Library (Lib) messages: 375111 nosy: eric.fahlgren priority: normal severity: normal status: open title: typing.get_type_hints generates KeyError versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 10 11:52:50 2020 From: report at bugs.python.org (D. A. Pellegrino) Date: Mon, 10 Aug 2020 15:52:50 +0000 Subject: [New-bugs-announce] [issue41516] venv activate scripts do not pass ShellCheck Message-ID: <1597074770.49.0.0492267082511.issue41516@roundup.psfhosted.org> New submission from D. A. Pellegrino : The activate scripts created by the venv module do not pass checks by ShellCheck (https://www.shellcheck.net/). ShellCheck generally has a point for each warning and note generated against the venv activate scripts. Addressing the ShellCheck reports would align the activate script implementation with best practices. ---------- components: Extension Modules messages: 375125 nosy: user93448 priority: normal severity: normal status: open title: venv activate scripts do not pass ShellCheck type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 10 13:47:58 2020 From: report at bugs.python.org (Tal Suhareanu) Date: Mon, 10 Aug 2020 17:47:58 +0000 Subject: [New-bugs-announce] [issue41517] Enum multiple inheritance loophole Message-ID: <1597081678.02.0.276964498945.issue41517@roundup.psfhosted.org> New submission from Tal Suhareanu : when inheriting an implemented enum, we get a runtime error But when creating a multiple inheritance like the following, it works? so something feels broken in the enum mechanism ------------------------------------ from enum import IntEnum, Enum class A(IntEnum): a = 1 class B(A, Enum): b= 1 print(B.b) ------------------------------------ ---------- components: Library (Lib) messages: 375133 nosy: talsuk5 priority: normal severity: normal status: open title: Enum multiple inheritance loophole type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 10 14:56:50 2020 From: report at bugs.python.org (Ramesh Sahoo) Date: Mon, 10 Aug 2020 18:56:50 +0000 Subject: [New-bugs-announce] [issue41518] incorrect printing behavior with parenthesis symbols Message-ID: <1597085810.49.0.205847918608.issue41518@roundup.psfhosted.org> New submission from Ramesh Sahoo : With for loop, I am able to print all elements in the list 'a' a = ['a','a','b','b','c'] for i in a: print(i) O/P: a a b b c but with the following loop, python only prints 3 uniq elements instead of 5. stack = ['(', '(', '[', ']', ')'] for i in stack: print(i) O/P: ( ] ) Is this is intended behavior? ---------- messages: 375136 nosy: rameshsahoo11 priority: normal severity: normal status: open title: incorrect printing behavior with parenthesis symbols type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 10 16:37:28 2020 From: report at bugs.python.org (Cory Nezin) Date: Mon, 10 Aug 2020 20:37:28 +0000 Subject: [New-bugs-announce] [issue41519] `pkgutil.get_data` causes future imports of children modules to fail. Message-ID: <1597091848.05.0.295677555121.issue41519@roundup.psfhosted.org> New submission from Cory Nezin : As demonstrated in this Stack Overflow question (https://stackoverflow.com/questions/59377661/python-pkgutil-get-data-disrupts-future-imports) using `pkgutil.get_data` on a module causes future imports of children modules to fail. I tracked this down to a call to `importlib._bootstrap.load` here: https://github.com/python/cpython/blob/3.8/Lib/pkgutil.py#L627 This seems to do something to sys.modules which I don't quite understand but I think it is caching the module when it shouldn't be. If I replace the linked line with `importlib.import_module(package))` it seems to work okay. ---------- components: Library (Lib) files: pkgutil_err.tar messages: 375149 nosy: cnezin priority: normal severity: normal status: open title: `pkgutil.get_data` causes future imports of children modules to fail. type: behavior versions: Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file49381/pkgutil_err.tar _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 10 17:57:55 2020 From: report at bugs.python.org (Matthias Bussonnier) Date: Mon, 10 Aug 2020 21:57:55 +0000 Subject: [New-bugs-announce] [issue41520] 3.8.5 regression, warnings.simplefilter('error', SyntaxWarning) does not raise. Message-ID: <1597096675.93.0.560814112421.issue41520@roundup.psfhosted.org> New submission from Matthias Bussonnier : assuming $ cat foo.py import warnings from codeop import compile_command warnings.simplefilter('error', SyntaxWarning) res = compile_command('1 is 1\n', symbol='exec') print('Res', res) On 3.8.0...3.8.4 this correctly raises a SyntaxError: python foo.py Traceback (most recent call last): File "foo.py", line 5, in res = compile_command('1 is 1\n', symbol='exec') File "/Users/bussonniermatthias/miniconda3/envs/38/lib/python3.8/codeop.py", line 122, in compile_command return _maybe_compile(_compile, source, filename, symbol) File "/Users/bussonniermatthias/miniconda3/envs/38/lib/python3.8/codeop.py", line 99, in _maybe_compile raise err1 File "/Users/bussonniermatthias/miniconda3/envs/38/lib/python3.8/codeop.py", line 87, in _maybe_compile code1 = compiler(source + "\n", filename, symbol) File "/Users/bussonniermatthias/miniconda3/envs/38/lib/python3.8/codeop.py", line 102, in _compile return compile(source, filename, symbol, PyCF_DONT_IMPLY_DEDENT) File "", line 1 SyntaxError: "is" with a literal. Did you mean "=="? But will silently return None on 3.8.5 $ python foo.py Res None ---------- components: Interpreter Core messages: 375152 nosy: mbussonn priority: normal severity: normal status: open title: 3.8.5 regression, warnings.simplefilter('error', SyntaxWarning) does not raise. type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 11 08:44:30 2020 From: report at bugs.python.org (STINNER Victor) Date: Tue, 11 Aug 2020 12:44:30 +0000 Subject: [New-bugs-announce] [issue41521] Replace whitelist/blacklist with allowlist/denylist Message-ID: <1597149870.51.0.801389190746.issue41521@roundup.psfhosted.org> New submission from STINNER Victor : I propose to replace whitelist/blacklist with allowlist/denylist. The terms whitelist and blacklist can be associated to color skins which isn't the intent. To avoid confusion, I propose to use neutral terms: allowlist and denylist. Moreover, as a french person (english is not my first language, but french), "allow" and "deny" are even more explicit to me than "white "and "black". The intent is to make the Python community more welcoming and more diverse by avoiding to make some people uncomfortable. Many other projects already replaced whitelist/blacklist with allowlist/denylist: * GitLab: https://gitlab.com/gitlab-org/gitlab/-/issues/7554 * React: https://github.com/facebook/react/commit/8a8d973d3cc5623676a84f87af66ef9259c3937c * Mediawiki: https://phabricator.wikimedia.org/T254646 * GitHub: https://thenextweb.com/dd/2020/06/15/github-plans-to-replace-racially-insensitive-terms-like-master-and-whitelist/ * Google Chrome: https://9to5google.com/2020/06/12/google-android-chrome-blacklist-blocklist-more-inclusive/ * etc. See also: * Carolyn Stransky's "Humanizing Your Documentation" presentation: https://speakerdeck.com/carolstran/humanizing-your-documentation-full-talk * bpo-34605: "Avoid master/slave terminology" Attached PRs replace whitelist/blacklist with allowlist/denylist. ---------- assignee: docs at python components: Documentation, Library (Lib) messages: 375170 nosy: docs at python, vstinner priority: normal severity: normal status: open title: Replace whitelist/blacklist with allowlist/denylist versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 11 12:53:23 2020 From: report at bugs.python.org (E. Paine) Date: Tue, 11 Aug 2020 16:53:23 +0000 Subject: [New-bugs-announce] [issue41522] IDLE: configdialog tab icons Message-ID: <1597164803.05.0.374696108322.issue41522@roundup.psfhosted.org> New submission from E. Paine : Currently, the tabs on the configdialog's Notebook only have a text description. I propose we add icons to the tabs to make them a little more colourful, new-user-friendly, etc. I have drafted a version which uses icons found in the Public Domain (I can provide links if this would be helpful - I believe the changes I have made would be covered under the CLA) resized to a height of 25px (see attached). The shown icons are meant more as a demonstration of this feature than a "I want these particular icons in the patch" but feel these make the dialog seem more inviting. I have nosied Mark Roseman as this idea came from the sort of changes described on the IDLE modernisation case study (https://tkdocs.com/tutorial/idle.html) ---------- assignee: terry.reedy components: IDLE files: idle-tab-icons.png messages: 375186 nosy: epaine, markroseman, taleinat, terry.reedy priority: normal severity: normal status: open title: IDLE: configdialog tab icons type: enhancement versions: Python 3.10, Python 3.8, Python 3.9 Added file: https://bugs.python.org/file49382/idle-tab-icons.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 11 13:23:57 2020 From: report at bugs.python.org (Bernat Gabor) Date: Tue, 11 Aug 2020 17:23:57 +0000 Subject: [New-bugs-announce] [issue41523] functools.cached_property does not satisfy the property check Message-ID: <1597166637.39.0.130570807543.issue41523@roundup.psfhosted.org> New submission from Bernat Gabor : from functools import cached_property, lru_cache class A: @property def a(self): return '' @cached_property def b(self): return '' @property @lru_cache def c(self): return "" print(isinstance(A.a, property)) print(isinstance(A.b, property)) print(isinstance(A.c, property)) True False True I feel like cached property should be of type property, not? ---------- messages: 375188 nosy: Bernat Gabor priority: normal severity: normal status: open title: functools.cached_property does not satisfy the property check versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 11 18:01:38 2020 From: report at bugs.python.org (William Meehan) Date: Tue, 11 Aug 2020 22:01:38 +0000 Subject: [New-bugs-announce] [issue41524] PyOS_mystricmp advances pointers too far Message-ID: <1597183298.26.0.225375554526.issue41524@roundup.psfhosted.org> New submission from William Meehan : The existing implementation of PyOS_mystricmp increments both pointers as long as the first string hasn't reached the end yet. If the second string ends first, then we increment past the null byte. If there is a difference in the middle of the two strings, then the result actually compares the following pair of letters. e.g. PyOS_mystricmp("a", "\0") => 0 (should be positive) PyOS_mystricmp("foo", "fro") => 0 (should be negative) Similarly, PyOS_mystrnicmp increments the pointers in a condition before breaking out of the loop. It's possible to increment the first pointer without incrementing the second, and the result is the character past the null byte. e.g. PyOS_mystrnicmp("\0a", "\0b", 2) => 97 (should be negative) ---------- components: C API messages: 375203 nosy: wmeehan priority: normal severity: normal status: open title: PyOS_mystricmp advances pointers too far type: behavior versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 11 19:19:48 2020 From: report at bugs.python.org (William Pickard) Date: Tue, 11 Aug 2020 23:19:48 +0000 Subject: [New-bugs-announce] [issue41525] Python '--help' has corrupted text. Message-ID: <1597187988.07.0.0319767984896.issue41525@roundup.psfhosted.org> New submission from William Pickard : Running Python's '--help' argument yields some corrupted text: "-X dev: enable CPython??Ts ??odevelopment mode???, introducing additional runtime" ---------- components: Interpreter Core messages: 375204 nosy: WildCard65 priority: normal severity: normal status: open title: Python '--help' has corrupted text. type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 11 21:04:09 2020 From: report at bugs.python.org (Peter Lovett) Date: Wed, 12 Aug 2020 01:04:09 +0000 Subject: [New-bugs-announce] [issue41526] Python 3.9.0rc1 "setup successful" dialog box overflow Message-ID: <1597194249.21.0.0691065972604.issue41526@roundup.psfhosted.org> New submission from Peter Lovett : "Setup was successful" dialog box text overflows the box, and last line can't be read. ---------- components: Installation files: Python 3.9.0rc1 setup successful overflow dialog box.PNG messages: 375206 nosy: PeterL777 priority: normal severity: normal status: open title: Python 3.9.0rc1 "setup successful" dialog box overflow type: behavior versions: Python 3.9 Added file: https://bugs.python.org/file49383/Python 3.9.0rc1 setup successful overflow dialog box.PNG _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 12 02:31:06 2020 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Wed, 12 Aug 2020 06:31:06 +0000 Subject: [New-bugs-announce] [issue41527] smart quotes in Lib/pydoc_data/topics.py file Message-ID: <1597213866.96.0.245351837241.issue41527@roundup.psfhosted.org> New submission from Karthikeyan Singaravelan : Similar to issue41525 the generated file seems to contain smart quotes. This is used in help utility of the repl to explore different topics. git log -G'?' Lib/pydoc_data/topics.py | cat commit bc1c8af8ef2563802767404c78c8ec6d6a967897 Author: ?ukasz Langa Date: Mon Apr 27 22:44:04 2020 +0200 Python 3.9.0a6 commit fd757083df79c21eee862e8d89aeefefe45f64a0 Author: ?ukasz Langa Date: Tue Nov 19 12:17:21 2019 +0100 Python 3.9.0a1 commit aab0e57045f6badaa1404409626545785ef02d62 Author: ?ukasz Langa Date: Sun Feb 3 14:04:12 2019 +0100 [pydoc] Regenerate topics for v3.8.0a1 ---------- components: Library (Lib) messages: 375213 nosy: lukasz.langa, serhiy.storchaka, xtreak priority: normal severity: normal status: open title: smart quotes in Lib/pydoc_data/topics.py file type: behavior versions: Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 12 03:36:26 2020 From: report at bugs.python.org (Marek Madejski) Date: Wed, 12 Aug 2020 07:36:26 +0000 Subject: [New-bugs-announce] [issue41528] Use math module in turtle Message-ID: <1597217786.87.0.701727445347.issue41528@roundup.psfhosted.org> New submission from Marek Madejski : "Turtle" module is closely related to geometry, which is also covered by "math" (and "cmath") module. Nevertheless, in many places in "turtle" the wheel is being reinvented. Currently, only ? and basing trig functions are used. Performance may be improved by such refactor (for example, by using "math.hypot" instead of manual calculation of vector norm). ---------- components: Library (Lib) messages: 375215 nosy: TrangOul priority: normal pull_requests: 20965 severity: normal status: open title: Use math module in turtle type: performance 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 Aug 12 04:23:18 2020 From: report at bugs.python.org (Andreas Jung) Date: Wed, 12 Aug 2020 08:23:18 +0000 Subject: [New-bugs-announce] [issue41529] Unable to compile 3.0b3 on Ubuntu systems: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Message-ID: <1597220598.27.0.292747751554.issue41529@roundup.psfhosted.org> New submission from Andreas Jung : Building 3.9.0b3 fails on Ubuntu 19 and 20 in same way: ./python -E -S -m sysconfig --generate-posix-vars ;\ if test $? -ne 0 ; then \ echo "generate-posix-vars failed" ; \ rm -f ./pybuilddir.txt ; \ exit 1 ; \ fi Could not find platform independent libraries Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] Python path configuration: PYTHONHOME = (not set) PYTHONPATH = (not set) program name = './python' isolated = 0 environment = 0 user site = 1 import site = 0 sys._base_executable = '/home/ajung/src/pp.server/Python-3.9.0b3/python' sys.base_prefix = '/opt/python-3.9.0b3' sys.base_exec_prefix = '/opt/python-3.9.0b3' sys.platlibdir = 'lib' sys.executable = '/home/ajung/src/pp.server/Python-3.9.0b3/python' sys.prefix = '/opt/python-3.9.0b3' sys.exec_prefix = '/opt/python-3.9.0b3' sys.path = [ '/opt/python-3.9.0b3/lib/python39.zip', '/opt/python-3.9.0b3/lib/python3.9', '/opt/python-3.9.0b3/lib/lib-dynload', ] 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 0x00007f824c25c280 (most recent call first): generate-posix-vars failed make: *** [Makefile:612: pybuilddir.txt] Error 1 ---------- components: Build messages: 375216 nosy: ajung priority: normal severity: normal status: open title: Unable to compile 3.0b3 on Ubuntu systems: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 12 07:42:16 2020 From: report at bugs.python.org (Joshua) Date: Wed, 12 Aug 2020 11:42:16 +0000 Subject: [New-bugs-announce] [issue41530] Unhandled exceptions in zoneinfo.ZoneInfo constructor Message-ID: <1597232536.81.0.285347310196.issue41530@roundup.psfhosted.org> New submission from Joshua : Attempting to parse specific keys in zoneinfo.ZoneInfo with tzdata installed will raise unhandled exceptions e.g. on windows >>> import zoneinfo >>> zoneinfo.ZoneInfo('Pacific') PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\Python39\\lib\\site-packages\\tzdata\\zoneinfo\\Pacific' >>> import zoneinfo >>> zoneinfo.ZoneInfo('__init__.py') ValueError: Invalid TZif file: magic not found This happens when non TZif files or directories in the tzdata.zoneinfo module are used as keys. ---------- components: Library (Lib) messages: 375225 nosy: josh.ja.butt priority: normal severity: normal status: open title: Unhandled exceptions in zoneinfo.ZoneInfo constructor type: behavior versions: Python 3.10, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 12 11:42:56 2020 From: report at bugs.python.org (=?utf-8?q?Miro_Hron=C4=8Dok?=) Date: Wed, 12 Aug 2020 15:42:56 +0000 Subject: [New-bugs-announce] [issue41531] Python 3.9 regression: Literal dict with > 65535 items are one item shorter Message-ID: <1597246976.86.0.332574378371.issue41531@roundup.psfhosted.org> New submission from Miro Hron?ok : Consider this reproducer.py: import sys LEN = int(sys.argv[1]) with open('big_dict.py', 'w') as f: print('INTS = {', file=f) for i in range(LEN): print(f' {i}: None,', file=f) print('}', file=f) import big_dict assert len(big_dict.INTS) == LEN, len(big_dict.INTS) And run it with any number > 65535: $ python3.9 reproducer.py 65536 Traceback (most recent call last): File "/tmp/reproducer.py", line 12, in assert len(big_dict.INTS) == LEN, len(big_dict.INTS) AssertionError: 65535 This has not happened on python 3.8. This also happens with PYTHONOLDPARSER=1. ---------- messages: 375255 nosy: hroncok priority: normal severity: normal status: open title: Python 3.9 regression: Literal dict with > 65535 items are one item shorter type: behavior versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 12 12:43:17 2020 From: report at bugs.python.org (=?utf-8?b?6rmA7KeE7ISc?=) Date: Wed, 12 Aug 2020 16:43:17 +0000 Subject: [New-bugs-announce] [issue41532] Import precedence is broken in some library Message-ID: <1597250597.2.0.528794904808.issue41532@roundup.psfhosted.org> New submission from ??? : I found this behavior by chance: >>> with open('tokenize.py', 'w') as f: ... f.write("print('This is so sad')") ... >>> import linecache This is so sad >>> path/of/python/Lib/linecache.py: import functools import sys import os import tokenize [...] Meanwhile, >>> with open('functools.py', 'w') as f: ... f.write("print('This is so sad')") ... >>> import linecache >>> It seems for me to be broken: 'import' doesn't have clear precedence. ---------- components: Library (Lib) messages: 375262 nosy: contact priority: normal severity: normal status: open title: Import precedence is broken in some library type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 12 13:27:41 2020 From: report at bugs.python.org (Tony) Date: Wed, 12 Aug 2020 17:27:41 +0000 Subject: [New-bugs-announce] [issue41533] Bugfix: va_build_stack leaks the stack if do_mkstack fails Message-ID: <1597253261.51.0.12759996374.issue41533@roundup.psfhosted.org> New submission from Tony : When calling a function a stack is allocated via va_build_stack. There is a leak that happens if do_mkstack fails in it. ---------- messages: 375267 nosy: tontinton priority: normal severity: normal status: open title: Bugfix: va_build_stack leaks the stack if do_mkstack fails _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 12 14:10:13 2020 From: report at bugs.python.org (r1kk3r) Date: Wed, 12 Aug 2020 18:10:13 +0000 Subject: [New-bugs-announce] [issue41534] argparse : allow_abbrev behavior between 3.7 and 3.8 Message-ID: <1597255813.65.0.986302240119.issue41534@roundup.psfhosted.org> New submission from r1kk3r : I looked into changelog and the source code to see if the behavior was wanted but I was not able to see the source of the issue. import argparse parser = argparse.ArgumentParser(allow_abbrev=True) parser.add_argument('-o', type=str, required=True, dest="bla", help="bla") known_args, rest_of_args = parser.parse_known_args(["-o", "test1", "-object_lto", "test2"]) print(rest_of_args) Executing with python 3.7.8 With allow_abbrev=True: ['test2'] allow_abbrev=False: ['-object_lto', 'test2'] Executed with python 3.8.5 With allow_abbrev=True: ['test2'] allow_abbrev=False: ['test2'] Is it expected? How do I get the behavior of python 3.7 in python 3.8? ---------- components: Library (Lib) messages: 375276 nosy: r1kk3r priority: normal severity: normal status: open title: argparse : allow_abbrev behavior between 3.7 and 3.8 type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 12 17:07:17 2020 From: report at bugs.python.org (John McCrone) Date: Wed, 12 Aug 2020 21:07:17 +0000 Subject: [New-bugs-announce] [issue41535] platform win32_ver produces incorrect value for release on Windows domain controllers Message-ID: <1597266437.41.0.707688174447.issue41535@roundup.psfhosted.org> New submission from John McCrone : The method platform.win32_ver() produces the client version for the release rather than the server version on a Windows domain controller. This is easy to recreate on 3.8.5. For example, on a Windows 2012 server running as a domain controller, the method produces the following: >>> import platform >>> platform.win32_ver() ('8', '6.2.9200', 'SP0', 'Multiprocessor Free') The product type is 2: >>> import sys >>> sys.getwindowsversion().product_type 2 The correct value should not be '8' but rather '2012Server'. From looking at the source (platform.py), it appears that we determine if we are on a windows server by this check: if getattr(winver, 'product_type', None) == 3 However, both types 2 (Domain Controller) and 3 (Non-Domain Controller Server) are server types (see the documentation for sys.getwindowsversion() https://docs.python.org/3/library/sys.html). Therefore, it seems likely to me that it should check if the value of product_type is either 2 or 3 instead of just 3. ---------- components: Windows messages: 375285 nosy: jvm3487, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: platform win32_ver produces incorrect value for release on Windows domain controllers type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 12 22:29:57 2020 From: report at bugs.python.org (Phillip Mackintosh) Date: Thu, 13 Aug 2020 02:29:57 +0000 Subject: [New-bugs-announce] [issue41536] pathlib's Path("NUL:").resolve() throws an error on windows Message-ID: <1597285797.92.0.269181951645.issue41536@roundup.psfhosted.org> New submission from Phillip Mackintosh : I'm looking for the equivalent windows functionality to the posix `/dev/null` file, and I discovered `NUL:` This snippet works on a windows OS, proving that it is indeed a writable file: `Path('NUL:').write_text('abcd')` However, `Path('NUL:').resolve()` Throws an exception `OSError: [WinError 87] The parameter is incorrect: 'NUL:'` Is this the expected behaviour? I.E. I should wrap the call to `resolve()` in a `try...except`? If I catch all `OSError` types, how can I determine if it's a legitimate error or not? E.G. Full console output: Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from pathlib import Path >>> Path('NUL:') WindowsPath('NUL:') >>> Path('NUL:').write_text('abcd') 4 >>> Path('NUL:').resolve() Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Python37\lib\pathlib.py", line 1134, in resolve s = self._flavour.resolve(self, strict=strict) File "C:\Program Files\Python37\lib\pathlib.py", line 192, in resolve s = self._ext_to_normal(_getfinalpathname(s)) OSError: [WinError 87] The parameter is incorrect: 'NUL:' ---------- components: Windows messages: 375289 nosy: paul.moore, phillmac, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: pathlib's Path("NUL:").resolve() throws an error on windows type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 13 01:29:01 2020 From: report at bugs.python.org (Poorna VenkataSai) Date: Thu, 13 Aug 2020 05:29:01 +0000 Subject: [New-bugs-announce] [issue41537] {Save, Save As, Save Copy As} not Working from version 3.8.3 Message-ID: <1597296541.26.0.0912699525588.issue41537@roundup.psfhosted.org> New submission from Poorna VenkataSai : save, Save as, Save Copy As are not responding in IDLE in the scenario created a PYTHON FILE from by renaming the new text document. now i wrote some content and trying to save. but, it's not responding. ---------- assignee: terry.reedy components: IDLE messages: 375291 nosy: lpoorna357, terry.reedy priority: normal severity: normal status: open title: {Save, Save As, Save Copy As} not Working from version 3.8.3 type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 13 04:31:21 2020 From: report at bugs.python.org (Albert Cervin) Date: Thu, 13 Aug 2020 08:31:21 +0000 Subject: [New-bugs-announce] [issue41538] Allow customizing python interpreter in venv.EnvBuilder Message-ID: <1597307480.95.0.346460653424.issue41538@roundup.psfhosted.org> New submission from Albert Cervin : When creating a virtualenv using venv.EnvBuilder, it always uses sys._base_executable. However, in some embedded cases (Blender being one example), it is not set to a valid Python executable. The proposal is to add a keyword parameter to the EnvBuilder constructor for specifying which python interpreter to use, much like the -p flag in virtualenv. ---------- components: Library (Lib) messages: 375293 nosy: abbec priority: normal severity: normal status: open title: Allow customizing python interpreter in venv.EnvBuilder type: enhancement versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 13 05:42:10 2020 From: report at bugs.python.org (Martin) Date: Thu, 13 Aug 2020 09:42:10 +0000 Subject: [New-bugs-announce] [issue41539] print blocks with multiprocessing and buffered output Message-ID: <1597311730.71.0.906884435677.issue41539@roundup.psfhosted.org> New submission from Martin : I experience a problem with multiprocessing and print. I tried to make a minimal working example, please see the attached file. WITHOUT the offending print statement in the queue filler thread, everything works: - pytest experiments/mp_problem.py - pytest experiments/mp_problem.py -s - python experiments/mp_problem.py WITH the offending print statement, not so much: - pytest experiments/mp_problem.py WORKS (Probably because pytest captures fd 1) - pytest experiments/mp_problem.py -s FAILS eventually (after a couple of workers have been started) - python experiments/mp_problem.py FAILS eventually (same). WITH the offending print statement AND PYTHONUNBUFFERED=1, everything works again: - pytest experiments/mp_problem.py - pytest experiments/mp_problem.py -s - python experiments/mp_problem.py Environment: Ubuntu 18.04.5 LTS python 3.8.5 (hcff3b4d_1) on conda 4.8.3 ---------- files: mp_problem.py messages: 375298 nosy: moi90 priority: normal severity: normal status: open title: print blocks with multiprocessing and buffered output type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49385/mp_problem.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 13 08:15:27 2020 From: report at bugs.python.org (Tony Reix) Date: Thu, 13 Aug 2020 12:15:27 +0000 Subject: [New-bugs-announce] [issue41540] Test test_maxcontext_exact_arith (_decimal) consumes all memory on AIX Message-ID: <1597320927.12.0.00429700709329.issue41540@roundup.psfhosted.org> New submission from Tony Reix : Python master of 2020/08/11 Test test_maxcontext_exact_arith (test.test_decimal.CWhitebox) checks that Python correctly handles a case where an object of size 421052631578947376 is created. maxcontext = Context(prec=C.MAX_PREC, Emin=C.MIN_EMIN, Emax=C.MAX_EMAX) Both on Linux and AIX, we have: Context(prec=999999999999999999, rounding=ROUND_HALF_EVEN, Emin=-999999999999999999, Emax=999999999999999999, capitals=1, clamp=0, flags=[], traps=[InvalidOperation, DivisionByZero, Overflow]) The test appears in: Lib/test/test_decimal.py 5665 def test_maxcontext_exact_arith(self): and the issue (on AIX) exactly appears at: self.assertEqual(Decimal(4) / 2, 2) The issue is due to code in: Objects/obmalloc.c : void * PyMem_RawMalloc(size_t size) { /* * Limit ourselves to PY_SSIZE_T_MAX bytes to prevent security holes. * Most python internals blindly use a signed Py_ssize_t to track * things without checking for overflows or negatives. * As size_t is unsigned, checking for size < 0 is not required. */ if (size > (size_t)PY_SSIZE_T_MAX) return NULL; return _PyMem_Raw.malloc(_PyMem_Raw.ctx, size); Both on Fedora/x86_64 and AIX, we have: size: 421052631578947376 PY_SSIZE_T_MAX: 9223372036854775807 thus: size < PY_SSIZE_T_MAX and _PyMem_Raw.malloc() is called. However, on Linux, the malloc() returns a NULL pointer in that case, and then Python handles this and correctly runs the test. However, on AIX, the malloc() tries to allocate the requested memory, and the OS gets stucked till the Python process is killed by the OS. Either size is too small, or PY_SSIZE_T_MAX is not correctly computed: ./Include/pyport.h : /* Largest positive value of type Py_ssize_t. */ #define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) Anyway, the following code added in PyMem_RawMalloc() before the call to _PyMem_Raw.malloc() , which in turns calls malloc() : if (size == 421052631578947376) { printf("TONY: 421052631578947376: --> PY_SSIZE_T_MAX: %ld \n", PY_SSIZE_T_MAX); return NULL; } does fix the issue on AIX. However, it is simply a way to show where the issue can be fixed. Another solution (fix size < PY_SSIZE_T_MAX) is needed. ---------- components: C API messages: 375302 nosy: T.Rex priority: normal severity: normal status: open title: Test test_maxcontext_exact_arith (_decimal) consumes all memory on AIX type: crash versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 13 13:37:00 2020 From: report at bugs.python.org (Soumendra Ganguly) Date: Thu, 13 Aug 2020 17:37:00 +0000 Subject: [New-bugs-announce] [issue41541] Make pty.spawn set window size, make code more readable Message-ID: <1597340220.32.0.858165521017.issue41541@roundup.psfhosted.org> New submission from Soumendra Ganguly : The example in https://docs.python.org/3/library/pty.html that mimics script(1) can be used to reproduce the problem: since window size is not set by pty.spawn, output of "ls" becomes scattered and hard to visually parse if xterm window is not in fullscreen mode. To fix the above issue, this patch makes pty.spawn set window size ( TIOCSWINSZ ). Also, this patch makes the code of pty.fork() more readable by defining _login_pty(); the latter is reused in spawn(). ---------- components: Library (Lib) files: pty.diff keywords: patch messages: 375326 nosy: soumendra priority: normal severity: normal status: open title: Make pty.spawn set window size, make code more readable type: behavior versions: Python 3.10, Python 3.8, Python 3.9 Added file: https://bugs.python.org/file49386/pty.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 13 14:46:53 2020 From: report at bugs.python.org (Tianrui Luo) Date: Thu, 13 Aug 2020 18:46:53 +0000 Subject: [New-bugs-announce] =?utf-8?b?W2lzc3VlNDE1NDJdIG1vZHVsZSBgX19h?= =?utf-8?q?ll=5F=5F=60_cannot_detect_function_name_with_=60=CF=86=60?= Message-ID: <1597344413.55.0.876960006552.issue41542@roundup.psfhosted.org> New submission from Tianrui Luo : Fairly easy to reproduce. `__all__` in a module seems unable to track name with `?`. The following minimal reproducing example also fails for function name of `a?` or `?b`. ```python3 Python 3.7.7 (default, May 7 2020, 21:25:33) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> from tmp import * Traceback (most recent call last): File "", line 1, in AttributeError: module 'tmp' has no attribute '?' ``` The `tmp.py` file. ```python # tmp.py __all__ = ['?'] def ?(): print('"__all__" doesn\'t like me') return ``` ---------- components: Unicode messages: 375330 nosy: ezio.melotti, tianrluo, vstinner priority: normal severity: normal status: open title: module `__all__` cannot detect function name with `?` type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 13 16:58:48 2020 From: report at bugs.python.org (Tom Gringauz) Date: Thu, 13 Aug 2020 20:58:48 +0000 Subject: [New-bugs-announce] [issue41543] contextlib.nullcontext doesn't work with async context managers Message-ID: <1597352328.6.0.811344048873.issue41543@roundup.psfhosted.org> New submission from Tom Gringauz : `contextlib.nullcontext` cannot be used with async conetext managers, because it implements only `__enter__` and `__exit__`, and doesn't implement `__aenter__` and `__aexit__`. ---------- components: Library (Lib), asyncio messages: 375346 nosy: asvetlov, tomgrin10, yselivanov priority: normal severity: normal status: open title: contextlib.nullcontext doesn't work with async context managers type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 13 17:08:33 2020 From: report at bugs.python.org (Martin) Date: Thu, 13 Aug 2020 21:08:33 +0000 Subject: [New-bugs-announce] [issue41544] multiprocessing.dummy.Process lacks daemon parameter Message-ID: <1597352913.9.0.790175794398.issue41544@roundup.psfhosted.org> New submission from Martin : Although multiprocessing.Process has a `daemon` parameter, multiprocessing.dummy.Process doesn't. As multiprocessing.dummy is meant to replicate the API of multiprocessing and the daemon parameter is readily available in threading.Thread, it should also be available in multiprocessing.dummy.Process. ---------- messages: 375347 nosy: moi90 priority: normal severity: normal status: open title: multiprocessing.dummy.Process lacks daemon parameter _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 13 19:52:21 2020 From: report at bugs.python.org (Yonatan Goldschmidt) Date: Thu, 13 Aug 2020 23:52:21 +0000 Subject: [New-bugs-announce] [issue41545] gc API requiring matching number of gc.disable - gc.enable calls Message-ID: <1597362741.87.0.831562855057.issue41545@roundup.psfhosted.org> New submission from Yonatan Goldschmidt : I have a construct in my code where I wrap a function's logic with `gc.disable()` to prevent GC from triggering some race condition. Today this construct got a bit more complicated, and another function had to use this "trick". Now there are 2 flows: foo(): gc.disable() .... gc.enable() bar() .... gc.disable() ... # bar calls foo, which also messes with the gc foo() gc.disable() ... gc.enable() ... gc.enable() ... I'd expected the GC to be truly enabled only on the second call to `enable()`, but apparently it's enabled on the first call :( Both `gc.enable()` and `gc.disable()` just write `1`/`0` to `gcstate->enabled`, respectively. For the meantime I wrote a simple wrapper class to do this counting (finally calling `enable()` only when necessary). Another option is for the code to check first "is GC enabled?" before disabling, and before enabling again, remember whether it really disabled it or not. But I think those manual workarounds are more error prone, and it's easier to forget to use it them in all sites (compared to using the "right" API from the standard module), so I was considering if we can add an API that encapsulate this counting: an enable-disable pair that makes sure GC is only enabled back when the number of "enable" calls matches the number of "disable" calls. ---------- components: Interpreter Core messages: 375355 nosy: Yonatan Goldschmidt priority: normal severity: normal status: open title: gc API requiring matching number of gc.disable - gc.enable calls type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 13 20:10:04 2020 From: report at bugs.python.org (Luiz) Date: Fri, 14 Aug 2020 00:10:04 +0000 Subject: [New-bugs-announce] [issue41546] pprint() gives exception when ran from pythonw Message-ID: <1597363804.39.0.98824418874.issue41546@roundup.psfhosted.org> New submission from Luiz : If you use the pprint function when running on windowed mode (either by using the .pyw extension or running the file with pythonw) a "AttributeError" exception occurs, saying that "'NoneType' object has no attribute 'write'". Looking at the source code (Lib/pprint.py), it happens because in this mode sys.stdout is set to None, therefore it has no write attribute. I think intended behavior is to simply ignore any console output when in this mode, since many programs have loads of print statements for debugging with a console window; it shouldn't crash because of a extension change. There's two solutions I can think of. One is to check if sys.stdout is None, not printing anything in case it is. Another is, when in windowed mode, setting sys.stdout to some dummy null file. This has the advantage of automatically fixing this in other parts of Python where this error might also occur. This error is particularly hard to find, since in windowed mode there's no console to show the exception - it simply closes. In the attached file, where I showcase the error, I have to log to a file to see the problem. I'm not sure how can this be unnoticed for so much time, it can't possibly be intended, or maybe it is and it's print() that actually has a problem, lol. ---------- components: Library (Lib) files: pprint_error_showcase.py messages: 375358 nosy: luizeldorado priority: normal severity: normal status: open title: pprint() gives exception when ran from pythonw type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49388/pprint_error_showcase.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 14 00:57:50 2020 From: report at bugs.python.org (youkaichao) Date: Fri, 14 Aug 2020 04:57:50 +0000 Subject: [New-bugs-announce] [issue41547] Expose default __getstate__ and __setstate__ Message-ID: <1597381070.63.0.19953658002.issue41547@roundup.psfhosted.org> New submission from youkaichao : According to the doc ( https://docs.python.org/3/library/pickle.html#object.__getstate__ ), an object may not have a __getstate__ method. During pickling and unpickling, python first finds __getstate__ and __setstate__, which may invoke a customed __getattr__. I think this is unnecessary if python just provides a default implementation for __getstate__ / __setstate__ . An additional benefit of this is that __setstate__ and __getstate__ becomes available for every object and it is possible to do something like ``getstate(obj)``. For people who customize __getattr__, I think no one intends to deal with ``obj.__getattr__??__getstate__??``, so it makes sense not to invoke ``__getattr__`` during pickling and unpickling. ---------- messages: 375369 nosy: youkaichao priority: normal severity: normal status: open title: Expose default __getstate__ and __setstate__ type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 14 02:37:07 2020 From: report at bugs.python.org (Roger Meier) Date: Fri, 14 Aug 2020 06:37:07 +0000 Subject: [New-bugs-announce] [issue41548] IDLE Window rendering on macOS Big Sur Message-ID: <1597387027.35.0.148329747195.issue41548@roundup.psfhosted.org> New submission from Roger Meier : macOS Big Sur, Public Beta (20A5343j) There is noticeable window flickering when the IDLE window is being resized manually. It sometimes become translucent, and sometimes the window frame isn't properly refreshed after resizing, but simply by switching to another app (i.e. removing focus from the IDLE window) the contents are refreshed. This was not the case prior to Big Sur. ---------- assignee: terry.reedy components: IDLE messages: 375373 nosy: roger.meier, terry.reedy priority: normal severity: normal status: open title: IDLE Window rendering on macOS Big Sur versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 14 04:51:48 2020 From: report at bugs.python.org (wyz23x2) Date: Fri, 14 Aug 2020 08:51:48 +0000 Subject: [New-bugs-announce] [issue41549] IDLE leaks `_` into hint box Message-ID: <1597395108.67.0.477230529042.issue41549@roundup.psfhosted.org> New submission from wyz23x2 : Reproduce: 1. Open shell and enter an expression, say 1+1. 2. Create a new file and save. 3. Enter a letter and press Tab. `_` appears in the box. ---------- assignee: terry.reedy components: IDLE messages: 375383 nosy: terry.reedy, wyz23x2 priority: normal severity: normal status: open title: IDLE leaks `_` into hint box type: behavior versions: Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 14 05:36:36 2020 From: report at bugs.python.org (Raphael Grewe) Date: Fri, 14 Aug 2020 09:36:36 +0000 Subject: [New-bugs-announce] [issue41550] SimpleQueues put blocks if feeded with strings greater than 2**16-13 chars Message-ID: <1597397796.53.0.606306315718.issue41550@roundup.psfhosted.org> New submission from Raphael Grewe : Hi at all, Maybe I am using the put function incorrectly, but it is not possible to add larger strings there. The programm keeps locked and is doing nothing. I tested it on latest Debian Buster. Python 3.7.3 (default, Jul 25 2020, 13:03:44) Please check the example script. python3 test_simple_queue_put.py 2**16-13 ---------- files: test_simple_queue_put.py messages: 375385 nosy: rgrewe priority: normal severity: normal status: open title: SimpleQueues put blocks if feeded with strings greater than 2**16-13 chars versions: Python 3.7 Added file: https://bugs.python.org/file49389/test_simple_queue_put.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 14 05:37:24 2020 From: report at bugs.python.org (=?utf-8?b?U3Jpbml2YXMgIFJlZGR5IFRoYXRpcGFydGh5KOCwtuCxjeCwsOCxgOCwqA==?= =?utf-8?b?4LC/4LC14LC+4LC44LGNIOCwsOCxhuCwoeCxjeCwoeCwvyDgsKTgsL7gsJ8=?= =?utf-8?b?4LC/4LCq4LCw4LGN4LCk4LC/KQ==?=) Date: Fri, 14 Aug 2020 09:37:24 +0000 Subject: [New-bugs-announce] [issue41551] test.support has way too many imports in libregrtest Message-ID: <1597397844.25.0.450972102548.issue41551@roundup.psfhosted.org> Change by Srinivas Reddy Thatiparthy(?????????? ?????? ?????????) : ---------- components: Tests nosy: thatiparthy priority: normal severity: normal status: open title: test.support has way too many imports in libregrtest versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 14 05:43:58 2020 From: report at bugs.python.org (Terry Greeniaus) Date: Fri, 14 Aug 2020 09:43:58 +0000 Subject: [New-bugs-announce] [issue41552] uuid.uuid1() on macOS doesn't generate unique IDs Message-ID: <1597398238.17.0.874687707711.issue41552@roundup.psfhosted.org> New submission from Terry Greeniaus : I'm using Python 3.8.5 on a 2016 MacBook Pro running macOS Catalina 10.15.3. This model has a touch bar and macOS communicates with the touch bar via a dedicated "iBridge" network interface. The iBridge network interface uses a fixed MAC address that is common across all MacBook Pro models (ac:de:48:00:11:22). Normally uuid.uuid1() picks up my WiFi MAC address (which is obviously unique), but this evening I noticed it was generating UUIDs based on the iBridge MAC address. Since the iBridge MAC is shared across all MacBook Pro laptops, there's no way to guarantee that the UUIDs are now universally unique. I'm not sure what triggered uuid.uuid1() to start using my iBridge interface although there was an Internet outage here at some point so maybe the network interfaces got reordered. The iBridge interface (en5) does appear before my WiFi interface (en0) in the output of ifconfig now. Here's a quick example of the problem: greent7 at avocado:~$ python3 Python 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import uuid >>> uuid.uuid1() UUID('32bbad32-de12-11ea-a0ee-acde48001122') And here's the output from ifconfig: greent7 at avocado:~$ ifconfig lo0: flags=8049 mtu 16384 options=1203 inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 nd6 options=201 gif0: flags=8010 mtu 1280 stf0: flags=0<> mtu 1280 en5: flags=8863 mtu 1500 ether ac:de:48:00:11:22 inet6 fe80::aede:48ff:fe00:1122%en5 prefixlen 64 scopeid 0x4 nd6 options=201 media: autoselect status: active en0: flags=8863 mtu 1500 options=400 ether 78:4f:43:5e:b9:86 inet6 fe80::1c4b:d303:b374:c2f3%en0 prefixlen 64 secured scopeid 0x5 inet6 fd00:1cab:c0ac:fc82:80e:f701:8302:6287 prefixlen 64 autoconf secured inet6 fd00:1cab:c0ac:fc82:1c38:9f17:2073:8eb prefixlen 64 autoconf temporary inet 192.168.0.11 netmask 0xffffff00 broadcast 192.168.0.255 nd6 options=201 media: autoselect status: active en3: flags=8963 mtu 1500 options=460 ether 82:46:1a:46:5c:01 media: autoselect status: inactive en1: flags=8963 mtu 1500 options=460 ether 82:46:1a:46:5c:00 media: autoselect status: inactive en4: flags=8963 mtu 1500 options=460 ether 82:46:1a:46:5c:05 media: autoselect status: inactive en2: flags=8963 mtu 1500 options=460 ether 82:46:1a:46:5c:04 media: autoselect status: inactive bridge0: flags=8822 mtu 1500 options=63 ether 82:46:1a:46:5c:00 Configuration: id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0 maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200 root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0 ipfilter disabled flags 0x2 member: en1 flags=3 ifmaxaddr 0 port 7 priority 0 path cost 0 member: en2 flags=3 ifmaxaddr 0 port 9 priority 0 path cost 0 member: en3 flags=3 ifmaxaddr 0 port 6 priority 0 path cost 0 member: en4 flags=3 ifmaxaddr 0 port 8 priority 0 path cost 0 media: status: inactive p2p0: flags=8843 mtu 2304 options=400 ether 0a:4f:43:5e:b9:86 media: autoselect status: inactive awdl0: flags=8943 mtu 1484 options=400 ether f6:38:1e:e0:6c:3f inet6 fe80::f438:1eff:fee0:6c3f%awdl0 prefixlen 64 scopeid 0xc nd6 options=201 media: autoselect status: active llw0: flags=8863 mtu 1500 options=400 ether f6:38:1e:e0:6c:3f inet6 fe80::f438:1eff:fee0:6c3f%llw0 prefixlen 64 scopeid 0xd nd6 options=201 media: autoselect status: active utun0: flags=8051 mtu 1380 inet6 fe80::afc9:f21a:4d82:2c8d%utun0 prefixlen 64 scopeid 0xe nd6 options=201 utun1: flags=8051 mtu 2000 inet6 fe80::4b52:18b4:5f46:4edf%utun1 prefixlen 64 scopeid 0xf nd6 options=201 ---------- components: macOS messages: 375387 nosy: ned.deily, ronaldoussoren, terrygreeniaus priority: normal severity: normal status: open title: uuid.uuid1() on macOS doesn't generate unique IDs type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 14 07:53:18 2020 From: report at bugs.python.org (Erik Quaeghebeur) Date: Fri, 14 Aug 2020 11:53:18 +0000 Subject: [New-bugs-announce] [issue41553] encoded-word abused for header line folding causes RFC 2047 violation Message-ID: <1597405998.37.0.935240009064.issue41553@roundup.psfhosted.org> New submission from Erik Quaeghebeur : Encoded-word is apparently used for header line folding sometimes. This appears to me as an abuse of this encoding technique. However, that is not the main issue: it also causes a violation of RFC 2074, as it also encodes message id's: https://tools.ietf.org/html/rfc2047#section-5 says ?An 'encoded-word' MUST NOT appear in any portion of an 'addr-spec'.? and https://tools.ietf.org/html/rfc5322#section-3.6.4 says ?The message identifier (msg-id) syntax is a limited version of the addr-spec construct enclosed in the angle bracket characters, "<" and ">".? This causes actual problems. Namely, email clients cannot parse the message id and so have trouble with generation of In-Reply-To and References headers or problems with thread reconstruction using these headers containing encoded-word versions of message ids. Minimal example: --- >>>?import email >>>?import email.policy >>> msg = email.message_from_string("""From: test at example.com To: test at example.org Subject: Test Date: Mon, 10 Aug 2020 22:52:53 +0000 Message-ID: X-Some-Blobby-Custom-Header: DIZEglcw6TIh1uC2UrnNjWYqe8l/bYo0oxKG7mBX38s1urzvCwQD30Q07DDJFgTVZWKbThu6hVjR53MTYAHYClHPt8UvyFPkAUIc8Ps1/R+HuSQ8gbR1R03sKoFAgPZKO+FKJ9bNbBb60THl81zSCsZiALwi4LLOqnf9ZIB111G4/shFuWxRlPcsPJt72sn+tTHZqK9fRAyoK1OZCZMJmjQGysovicz1Xc6nOXHMQr2+suRwOJwSUqvsfkj8EEtzJGj7ICQ2GbgBaOjcof1AML4RCFy/vD5bG0Y8HQ2KET3SraTki4dPo+xMYSZVFEy/va4rYeynOXPfxXfHSyIFwB6gnH74Ws/XPk8ZxhAQ2wSy7Hvgg3tZ7HOmlLWg4A/vUGN+8RJlgn+hHtuCXnglv+fIKEhW36wcFotngSrcXULbTlqdE5zjuV5O7wNfgIShZnNhnPdLipslmZJGaa6RQpIonZbwUWCM8g9DZmSwo8g0On0l20IVS9s6bUCddwRZ5erHx4eUZ4DGh4YyR2fgm0WsNVW8pVsAdFMClfAJYqyPEqrDN91djfPYRZPMvzYWTAm8MAip6vDa1ZvzywDpGJYD3VwapLfgFy+AR0S/q/V1HHRmSXx1oNLEedhAt0OkIxWxO8FvqNeEfMLVhxTk1g== MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" BODY """) >>> print(msg.as_bytes(policy=email.policy.SMTPUTF8).decode()) From: test at example.com To: test at example.org Subject: Test Date: Mon, 10 Aug 2020 22:52:53 +0000 Message-ID: =?utf-8?q?=3CVI1PR09MB41911D8371E899C1FE78EE48FA440=40abcdefghij?= =?utf-8?q?klm=2Enmopqrst=2Euvwx=2Eexample=2Ecom=3E?= X-Some-Blobby-Custom-Header: =?utf-8?q?DIZEglcw6TIh1uC2UrnNjWYqe8l/bYo0oxKG7?= =?utf-8?q?mBX38s1urzvCwQD30Q07DDJFgTVZWKbThu6hVjR53MTYAHYClHPt8UvyFPkAUIc8P?= =?utf-8?q?s1/R+HuSQ8gbR1R03sKoFAgPZKO+FKJ9bNbBb60THl81zSCsZiALwi4LLOqnf9ZIB?= =?utf-8?q?111G4/shFuWxRlPcsPJt72sn+tTHZqK9fRAyoK1OZCZMJmjQGysovicz1Xc6nOXHM?= =?utf-8?q?Qr2+suRwOJwSUqvsfkj8EEtzJGj7ICQ2GbgBaOjcof1AML4RCFy/vD5bG0Y8HQ2KE?= =?utf-8?q?T3SraTki4dPo+xMYSZVFEy/va4rYeynOXPfxXfHSyIFwB6gnH74Ws/XPk8ZxhAQ2w?= =?utf-8?q?Sy7Hvgg3tZ7HOmlLWg4A/vUGN+8RJlgn+hHtuCXnglv+fIKEhW36wcFotngSrcXUL?= =?utf-8?q?bTlqdE5zjuV5O7wNfgIShZnNhnPdLipslmZJGaa6RQpIonZbwUWCM8g9DZmSwo8g0?= =?utf-8?q?On0l20IVS9s6bUCddwRZ5erHx4eUZ4DGh4YyR2fgm0WsNVW8pVsAdFMClfAJYqyPE?= =?utf-8?q?qrDN91djfPYRZPMvzYWTAm8MAip6vDa1ZvzywDpGJYD3VwapLfgFy+AR0S/q/V1HH?= =?utf-8?q?RmSXx1oNLEedhAt0OkIxWxO8FvqNeEfMLVhxTk1g=3D=3D?= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" BODY --- ---------- components: email messages: 375397 nosy: barry, equaeghe, r.david.murray priority: normal severity: normal status: open title: encoded-word abused for header line folding causes RFC 2047 violation type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 14 09:41:49 2020 From: report at bugs.python.org (Irit Katriel) Date: Fri, 14 Aug 2020 13:41:49 +0000 Subject: [New-bugs-announce] [issue41554] PR proceeds to "awaiting core review" when changes are requested Message-ID: <1597412509.05.0.639537821302.issue41554@roundup.psfhosted.org> New submission from Irit Katriel : When I click on "review" I get three options: comment, approve, and request changes. I assumed that "request changes" would block the PR until the changes were made, but instead in the case of PR 19046 it proceeded to "awaiting core review", which seems to imply that it passed the first review. ---------- messages: 375404 nosy: iritkatriel priority: normal severity: normal status: open title: PR proceeds to "awaiting core review" when changes are requested type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 14 18:28:33 2020 From: report at bugs.python.org (S. Zhang) Date: Fri, 14 Aug 2020 22:28:33 +0000 Subject: [New-bugs-announce] [issue41555] re.sub replaces twice Message-ID: <1597444113.99.0.353653909979.issue41555@roundup.psfhosted.org> New submission from S. Zhang : The following command produced "name.tsvtsv" with version 3.7.1 and 3.8.5 instead of the expected "name.tsv" from version 2.7.5, 3.5.6, and 3.6.7. Changing * to + produced expected "name.tsv". python -c 'import re; v="name.txt";v = re.sub("[^\.]*$", "tsv", v);print(v)' ---------- messages: 375436 nosy: spz1st priority: normal severity: normal status: open title: re.sub replaces twice type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 15 05:25:03 2020 From: report at bugs.python.org (Dick Visser) Date: Sat, 15 Aug 2020 09:25:03 +0000 Subject: [New-bugs-announce] [issue41556] hostname verification fails if hostname starts with literal IPv4 Message-ID: <1597483503.9.0.826978747102.issue41556@roundup.psfhosted.org> New submission from Dick Visser : I'm trying to connect to an HTTPS site with ssl.create_default_context, which implies hostname verification is done. This fails when connecting to a hostname that starts with a literal IPv4 address. Reproduce with: #!/usr/bin/env python3 import socket import ssl hostname = '145.100.57.105.surf-hosted.nl' # hostname = 'python.org' context = ssl.create_default_context() with socket.create_connection((hostname, 443)) as sock: with context.wrap_socket(sock, server_hostname=hostname) as ssock: cert = ssock.getpeercert() print(cert) Running this yeidls: ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: IP address mismatch, certificate is not valid for '145.100.57.105.surf-hosted.nl'. (_ssl.c:1123) While the certificate on that host is perfectly fine (is has both CN and a subject alt name). Since the actual verification is done by OpenSSL, I tried that manually, and that does validate the hostname OK: dnmvisser at NUC8i5BEK ~$ openssl s_client -connect 145.100.57.105.surf-hosted.nl:443 -verify_hostname 145.100.57.105.surf-hosted.nl CONNECTED(00000005) depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3 verify return:1 depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3 verify return:1 depth=0 CN = 145.100.57.105.surf-hosted.nl verify return:1 --- Certificate chain 0 s:CN = 145.100.57.105.surf-hosted.nl i:C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3 1 s:C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3 i:O = Digital Signature Trust Co., CN = DST Root CA X3 --- Server certificate -----BEGIN CERTIFICATE----- MIIFcTCCBFmgAwIBAgISAxA+MIkEpMc+JZEnhsWHqhSiMA0GCSqGSIb3DQEBCwUA MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0yMDA3MjUxNDM2NDdaFw0y MDEwMjMxNDM2NDdaMCgxJjAkBgNVBAMTHTE0NS4xMDAuNTcuMTA1LnN1cmYtaG9z dGVkLm5sMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvrpqHQUU2AMF KD+aF/XP4qdUe02NiZNG20s1YX8o9T8tVpFlaMbC5GouNpUWvchtRk2uwAEjW7xo //NCBPi5PuT0pfBz5gBhOpMMs3CXUqKCeFK+HxpWQM6h8+TARlWAfUpJ1EDcEK04 L0Oo0hPiq4utQSNouUpLmRMZtiZNH7ct4nht1JUJFr87p+IV9sDqxkZXdqSGvPyq El3dJq+id9f3eaPiTypHg08KGEaH6Cujuhrs98p0lXqZMG/dlR7AOtjHbJCaX0WI iodBri3BrhotMKyMNzWj35rlwf0lJO/vyEf0FanbjWwgfAQSQuTWY3Z4Aerl4DoY 0B063LU+EwIDAQABo4ICcTCCAm0wDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQG CCsGAQUFBwMBBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBR+vf/J VqaQVTf6YUJvUxh95h3n5TAfBgNVHSMEGDAWgBSoSmpjBH3duubRObemRWXv86js oTBvBggrBgEFBQcBAQRjMGEwLgYIKwYBBQUHMAGGImh0dHA6Ly9vY3NwLmludC14 My5sZXRzZW5jcnlwdC5vcmcwLwYIKwYBBQUHMAKGI2h0dHA6Ly9jZXJ0LmludC14 My5sZXRzZW5jcnlwdC5vcmcvMCgGA1UdEQQhMB+CHTE0NS4xMDAuNTcuMTA1LnN1 cmYtaG9zdGVkLm5sMEwGA1UdIARFMEMwCAYGZ4EMAQIBMDcGCysGAQQBgt8TAQEB MCgwJgYIKwYBBQUHAgEWGmh0dHA6Ly9jcHMubGV0c2VuY3J5cHQub3JnMIIBAwYK KwYBBAHWeQIEAgSB9ASB8QDvAHUAb1N2rDHwMRnYmQCkURX/dxUcEdkCwQApBo2y CJo32RMAAAFzhp6XvgAABAMARjBEAiARmq5foTaEABWuwX7XEwkVe7bnml98UGLw xXNG6DOtnwIgYgw+zA5LZICtlFS6QXXxtjUBZ6eNReieBYFHQywZcf4AdgAHt1wb 5X1o//Gwxh0jFce65ld8V5S3au68YToaadOiHAAAAXOGnpfnAAAEAwBHMEUCIFhg BCwM0ywDEP23WLRSOdSSSEAiTzAWQiDnT/St7FlHAiEAwOH86Z4dfV6HivcCZmEG MxsOywJC3JNO0ei0nFZXurIwDQYJKoZIhvcNAQELBQADggEBAFZytDjS2R1jwp8q 2qXp2kl9L33jV5tjAk+q08x0QVLdquBu5QsFjzq6ukZIlZsZV/08Jnb8rn0LaOgg B2nRlbl4Hmwcb4hL3Zpb7yH0nBZiOAI45SbYC/jnjHG2GzKazvtu/Sx8FYQgmRt+ vEGopOKdXrBd0OAJODV/bbv3SwwrQU0Z5cHriqSYz+Mho7aK57bQp2kuyiznNnuP VVxC+F0HL/z2jFq2cbjzFJS3tD8nS45ZR3i2dt/QRqcWqWaUVwoSA4DwoJMhoHQu unMnkBlXJpCodRvTNy/FmLJsCmOZbl2R0PH8Xd9qc4qfBnzzMvyI6iiT1Qb0qFAn HnciWiE= -----END CERTIFICATE----- subject=CN = 145.100.57.105.surf-hosted.nl issuer=C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3 --- No client certificate CA names sent Peer signing digest: SHA512 Peer signature type: RSA Server Temp Key: ECDH, P-256, 256 bits --- SSL handshake has read 3085 bytes and written 457 bytes Verification: OK Verified peername: 145.100.57.105.surf-hosted.nl --- New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384 Server public key is 2048 bit Secure Renegotiation IS supported Compression: NONE Expansion: NONE No ALPN negotiated SSL-Session: Protocol : TLSv1.2 Cipher : ECDHE-RSA-AES256-GCM-SHA384 Session-ID: FE1915CF13C685CBE0A3B19238967A3F8B16C2322D69212492404DE230339E09 Session-ID-ctx: Master-Key: 756B52BC2B2823DD8992E7EE5869CFE929107142AE311B68D9245DF3D049C2FEDE931210F5D11B6F6A3A504923D833D1 PSK identity: None PSK identity hint: None SRP username: None Start Time: 1597482694 Timeout : 7200 (sec) Verify return code: 0 (ok) Extended master secret: no --- I'm guessing that there is some (greedy) IPv4 matching logic that causes the bare literal IPv4 address to be sent to OpenSSL for verification instead of the entire hostname? Because the error (X509_V_ERR_IP_ADDRESS_MISMATCH, https://github.com/python/cpython/blob/3.8/Modules/_ssl.c#L666-L670) indicates that OpenSSL is doing an IP address verification instead of a hostname verification. ---------- assignee: christian.heimes components: SSL messages: 375454 nosy: christian.heimes, dnmvisser priority: normal severity: normal status: open title: hostname verification fails if hostname starts with literal IPv4 type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 15 06:04:24 2020 From: report at bugs.python.org (Erlend Egeberg Aasland) Date: Sat, 15 Aug 2020 10:04:24 +0000 Subject: [New-bugs-announce] [issue41557] Upgrade Windows and macOS builds to use SQLite 3.33 Message-ID: <1597485864.38.0.170390742774.issue41557@roundup.psfhosted.org> New submission from Erlend Egeberg Aasland : SQLite 3.33.0 was just released: https://www.sqlite.org/releaselog/3_33_0.html Suggesting to wait one week before updating, to see if a patch version appears. Python 3.9 and 3.10 both build fine against SQLite 3.33.0, and make test completes without complaints. I'll prepare a patch for the source deps repo, and a pair of patches for macOS/Windows. ---------- components: Library (Lib) messages: 375455 nosy: erlendaasland priority: normal severity: normal status: open title: Upgrade Windows and macOS builds to use SQLite 3.33 type: enhancement versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 15 11:24:25 2020 From: report at bugs.python.org (Ketan Bhatt) Date: Sat, 15 Aug 2020 15:24:25 +0000 Subject: [New-bugs-announce] [issue41558] Backspace not clearing the text Message-ID: <1597505065.08.0.273403618121.issue41558@roundup.psfhosted.org> New submission from Ketan Bhatt : The below statement is not clearing the text, although there are three backspaces: print("123",end="\b\b\b") The output from the Jupiter note book is 12!!! ---------- files: bug.ipynb messages: 375469 nosy: ketanbhatt18 priority: normal severity: normal status: open title: Backspace not clearing the text versions: Python 3.9 Added file: https://bugs.python.org/file49397/bug.ipynb _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 15 14:36:04 2020 From: report at bugs.python.org (Guido van Rossum) Date: Sat, 15 Aug 2020 18:36:04 +0000 Subject: [New-bugs-announce] [issue41559] Add support for PEP 612 to typing.py Message-ID: <1597516564.62.0.520187732663.issue41559@roundup.psfhosted.org> New submission from Guido van Rossum : We need stub versions of ParamSpec and Concatenate added to typing.py, plus tests that ensure these actually work in all situations required by the PEP. (It's not so important to ensure that they raise exceptions at runtime in cases where the PEP says they needn't work -- static type checkers will flag those better.) ---------- components: Library (Lib) messages: 375487 nosy: gvanrossum priority: normal severity: normal stage: needs patch status: open title: Add support for PEP 612 to typing.py type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 15 22:02:44 2020 From: report at bugs.python.org (Alexander Heger) Date: Sun, 16 Aug 2020 02:02:44 +0000 Subject: [New-bugs-announce] [issue41560] pathlib.Path.glob fails on empty string Message-ID: <1597543364.86.0.966636544489.issue41560@roundup.psfhosted.org> New submission from Alexander Heger : Passing an empty string to pathlib.Path.glob fails. Example ``` from pathlib import Path path = Path('./myfile.txt') path.glob('') ``` The result is: ``` ~/Python/lib/python3.8/pathlib.py in glob(self, pattern) 1129 """ 1130 if not pattern: -> 1131 raise ValueError("Unacceptable pattern: {!r}".format(pattern)) 1132 drv, root, pattern_parts = self._flavour.parse_parts((pattern,)) 1133 if drv or root: ValueError: Unacceptable pattern: '' ``` This is not the desired or expected behaviour, which would be to just return `path` if it exists. This behaviour is also inconsistent with the documentation which states (Python 3.8.5): """ Glob the given relative pattern in the directory represented by this path, yielding all matching files (of any kind): """ And it is in contrast to the behaviour of glob.glob, which is just fine with the empty string, returning an empty list. ---------- components: Library (Lib) messages: 375499 nosy: alex.heger priority: normal severity: normal status: open title: pathlib.Path.glob fails on empty string type: crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 16 00:10:49 2020 From: report at bugs.python.org (Bug Reporter) Date: Sun, 16 Aug 2020 04:10:49 +0000 Subject: [New-bugs-announce] [issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch Message-ID: <1597551049.14.0.0578030464715.issue41561@roundup.psfhosted.org> New submission from Bug Reporter : FAIL: test_min_max_version_mismatch (test.test_ssl.ThreadedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vbk/Downloads/Python-3.8.5/Lib/test/test_ssl.py", line 217, in wrapper return func(*args, **kw) File "/home/vbk/Downloads/Python-3.8.5/Lib/test/test_ssl.py", line 3841, in test_min_max_version_mismatch self.assertIn("alert", str(e.exception)) AssertionError: 'alert' not found in '[SSL: NO_PROTOCOLS_AVAILABLE] no protocols available (_ssl.c:1123)' ---------- assignee: christian.heimes components: Build, SSL, Tests messages: 375502 nosy: bugsrep, christian.heimes priority: normal severity: normal status: open title: test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch type: compile error versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 16 02:57:08 2020 From: report at bugs.python.org (Dan Pascu) Date: Sun, 16 Aug 2020 06:57:08 +0000 Subject: [New-bugs-announce] [issue41562] StreamReaderProtocol inheritance Message-ID: <1597561028.71.0.475726602595.issue41562@roundup.psfhosted.org> New submission from Dan Pascu : I noticed that StreamReaderProtocol is defined like this: class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): ... but FlowControlMixin already inherits protocols.Protocol: class FlowControlMixin(protocols.Protocol): ... It seems redundant that StreamReaderProtocol has protocols.Protocol as a second base class (is this an oversight or I'm missing some hidden reasoning behind it in which case it might be useful to have it mentioned in a comment to avoid confusion). ---------- components: asyncio messages: 375504 nosy: asvetlov, danpascu777, yselivanov priority: normal severity: normal status: open title: StreamReaderProtocol inheritance type: enhancement versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 16 07:42:32 2020 From: report at bugs.python.org (Denniver) Date: Sun, 16 Aug 2020 11:42:32 +0000 Subject: [New-bugs-announce] [issue41563] .python_history file causes considerable slowdown Message-ID: <1597578152.77.0.254991053979.issue41563@roundup.psfhosted.org> New submission from Denniver : The seemingly unlimited growth of the ".python_history"-file seems to cause a massive slowdown when starting or exiting python, the same after running commands. On one machine python took about 3 minutes to start and I found out that while it is seemingly doing nothing, it was constantly aceesing the ".python_history"-file, which was 130 Mb large. After deleting the file, anything was back to normal. ---------- components: Build messages: 375505 nosy: bytecookie priority: normal severity: normal status: open title: .python_history file causes considerable slowdown type: performance versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 16 22:50:34 2020 From: report at bugs.python.org (Matt Joiner) Date: Mon, 17 Aug 2020 02:50:34 +0000 Subject: [New-bugs-announce] [issue41564] Cannot access member "hex" for type "ByteString" Message-ID: <1597632634.33.0.93200483748.issue41564@roundup.psfhosted.org> New submission from Matt Joiner : I get this error when running pyright for a type of typing.ByteString. All the implementations of ByteString (bytes, bytearray, memoryview) have the hex method, so this seems unexpected? ---------- components: Library (Lib) messages: 375523 nosy: anacrolix priority: normal severity: normal status: open title: Cannot access member "hex" for type "ByteString" type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 17 01:02:54 2020 From: report at bugs.python.org (song super) Date: Mon, 17 Aug 2020 05:02:54 +0000 Subject: [New-bugs-announce] [issue41565] from os.path import join join('3', '{:3') return '{:3' in windows Message-ID: <1597640574.94.0.668991787867.issue41565@roundup.psfhosted.org> New submission from song super <2262720766 at qq.com>: python3.6 from os.path import join join('3', '{:3') return '{:3' in windows,However,join('3', '{:3') return '3//{:3' in linux,I think this is a bug ---------- components: Windows files: python bug.zip hgrepos: 391 messages: 375524 nosy: 2262720766, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: from os.path import join join('3', '{:3') return '{:3' in windows type: compile error versions: Python 3.6 Added file: https://bugs.python.org/file49400/python bug.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 17 04:19:06 2020 From: report at bugs.python.org (Ruben Vorderman) Date: Mon, 17 Aug 2020 08:19:06 +0000 Subject: [New-bugs-announce] [issue41566] Include much faster DEFLATE implementations in Python's gzip and zlib libraries. (isa-l) Message-ID: <1597652346.68.0.240792775725.issue41566@roundup.psfhosted.org> New submission from Ruben Vorderman : The gzip file format is quite ubiquitous and so is its first (?) free/libre implementation zlib with the gzip command line tool. This uses the DEFLATE algorithm. Lately some faster algorithms (most notable zstd) have popped up which have better speed and compression ratio vs zlib. Unfortunately switching over to zstd will not be seemless. It is not compatible with zlib/gzip in any way. Luckily some developers have tried to implement DEFLATE in a faster way. Most notably libdeflate (https://github.com/ebiggers/libdeflate) and Intel's storage acceleration library (https://github.com/intel/isa-l). These libraries provide the libdeflate-gzip and igzip utilities respectively. These can compress and decompress the same gzip files. An igzip compressed file can be read with gzip and vice versa. To give an idea of the speed improvements that can be obtained. Here are some benchmarks. All benchmarks were done using hyperfine (https://github.com/sharkdp/hyperfine). The system was a Ryzen 5 3600 with 2x16GB DDR4-3200 memory. Operating system Debian 10. All benchmarks were performed on a tmpfs which lives in memory to prevent IO bottlenecks. The test file was a 5 million read FASTQ file of 1.6 GB (https://en.wikipedia.org/wiki/FASTQ_format). These type of files are common in bioinformatics at 100+ GB sizes so are a good real-world benchmark. I benchmarked pigz on one thread as well, as it implements zlib but in a faster way than gzip. Zstd was benchmarked as a comparison. Versions: gzip 1.9 (provided by debian) pigz 2.4 (provided by debian) igzip 2.25.0 (provided by debian) libdeflate-gzip 1.6 (compiled by conda-build with the recipe here: https://github.com/conda-forge/libdeflate-feedstock/pull/4) zstd 1.3.8 (provided by debian) By default level 1 is chosen for all compression benchmarks. Time is average over 10 runs. COMPRESSION program time size memory gzip 23.5 seconds 657M 1.5M pigz (one thread) 22.2 seconds 658M 2.4M libdeflate-gzip 10.1 seconds 623M 1.6G (reads entire file in memory) igzip 4.6 seconds 620M 3.5M zstd (to .zst) 6.1 seconds 584M 12.1M Decompression. All programs decompressed the file created using gzip -1. (Even zstd which can also decompress gzip). DECOMPRESSION program time memory gzip 10.5 seconds 744K pigz (one-thread) 6.7 seconds 1.2M libdeflate-gzip 3.6 seconds 2.2G (reads in mem before writing) igzip 3.3 seconds 3.6M zstd (from .gz) 6.4 seconds 2.2M zstd (from .zst) 2.3 seconds 3.1M As shown from the above benchmarks, using Intel's Storage Acceleration Libraries may improve performance quite substantially. Offering very fast compression and decompression. This gets igzip in the zstd ballpark in terms of speed while still offering backwards compatibility with gzip. Intel's Storage Acceleration Libraries (isa-l) come with a bsd-3-clause license, so there should be no licensing issues when using that code inside of CPython. ---------- components: Library (Lib) messages: 375533 nosy: rhpvorderman priority: normal severity: normal status: open title: Include much faster DEFLATE implementations in Python's gzip and zlib libraries. (isa-l) versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 17 07:37:30 2020 From: report at bugs.python.org (Carl Drougge) Date: Mon, 17 Aug 2020 11:37:30 +0000 Subject: [New-bugs-announce] [issue41567] multiprocessing.Pool from concurrent threads failure on 3.9.0rc1 Message-ID: <1597664250.53.0.724586569237.issue41567@roundup.psfhosted.org> New submission from Carl Drougge : If several threads try to start a multiprocessing.Pool at the same time when no pool has been started before this often fails with an exception like this (the exact import varies): Exception in thread Thread-2: Traceback (most recent call last): File "/tmp/py3.9.0rc1/lib/python3.9/threading.py", line 950, in _bootstrap_inner self.run() File "/tmp/py3.9.0rc1/lib/python3.9/threading.py", line 888, in run self._target(*self._args, **self._kwargs) File "/tmp/py3.9.0rc1/lib/python3.9/multiprocessing/context.py", line 118, in Pool from .pool import Pool ImportError: cannot import name 'Pool' from partially initialized module 'multiprocessing.pool' (most likely due to a circular import) (/tmp/py3.9.0rc1/lib/python3.9/multiprocessing/pool.py) This happens even if Pool was imported before starting the threads and is new in 3.9. It's easy to work around by starting a pool in the main thread before starting the other threads. I have attached a minimal example that triggers it. Tested on Debian stable and FreeBSD 11.3. ---------- components: Library (Lib) files: pool_error_on_3.9.py messages: 375542 nosy: drougge priority: normal severity: normal status: open title: multiprocessing.Pool from concurrent threads failure on 3.9.0rc1 type: behavior versions: Python 3.9 Added file: https://bugs.python.org/file49401/pool_error_on_3.9.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 17 10:31:33 2020 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Mon, 17 Aug 2020 14:31:33 +0000 Subject: [New-bugs-announce] [issue41568] test_zoneinfo leaked [84, 84, 84] references Message-ID: <1597674693.07.0.000622636153165.issue41568@roundup.psfhosted.org> New submission from Pablo Galindo Salgado : OK (skipped=26) ...... test_zoneinfo leaked [84, 84, 84] references, sum=252 test_zoneinfo leaked [41, 41, 41] memory blocks, sum=123 1 test failed again: test_zoneinfo == Tests result: FAILURE then FAILURE == Example failure: https://buildbot.python.org/all/#/builders/84/builds/3 ---------- messages: 375550 nosy: p-ganssle, pablogsal priority: normal severity: normal status: open title: test_zoneinfo leaked [84, 84, 84] references _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 17 13:42:21 2020 From: report at bugs.python.org (David Byrne) Date: Mon, 17 Aug 2020 17:42:21 +0000 Subject: [New-bugs-announce] [issue41569] json.JSONEncoder.default should be called for dict keys as well Message-ID: <1597686141.71.0.298355570835.issue41569@roundup.psfhosted.org> New submission from David Byrne : Sub-classing and overriding json.JSONEncoder.default allows users to create custom serialisation for objects that can?t otherwise be serialized. However, this method is only called for dictionary values such that dictionary supported keys (i.e. hashable types) can not be fully utilized. Calling .default on keys as well as values allows users to to fully utilize json for all dict supported types. See https://stackoverflow.com/questions/63393059/json-dump-not-calling-default-or-cls for example ---------- components: Library (Lib) messages: 375561 nosy: david.byrne222 priority: normal severity: normal status: open title: json.JSONEncoder.default should be called for dict keys as well type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 17 16:07:14 2020 From: report at bugs.python.org (Jonathan Hoffstadt) Date: Mon, 17 Aug 2020 20:07:14 +0000 Subject: [New-bugs-announce] [issue41570] Add DearPyGui to faq/gui.rst Message-ID: <1597694834.82.0.650737066259.issue41570@roundup.psfhosted.org> Change by Jonathan Hoffstadt : ---------- assignee: docs at python components: Documentation nosy: docs at python, jhoffstadt priority: normal severity: normal status: open title: Add DearPyGui to faq/gui.rst type: enhancement versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 17 19:48:01 2020 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Mon, 17 Aug 2020 23:48:01 +0000 Subject: [New-bugs-announce] [issue41571] Allow pdb to switch to a different thread Message-ID: <1597708081.91.0.301663763083.issue41571@roundup.psfhosted.org> New submission from Pablo Galindo Salgado : Unfortunately, the thread experience with pdb is not as good as it could be due to the lack of thread-related commands. In other debuggers like gdb, is common to be able to do some of the following operations: * list all threads * switch the context to a different thread. * Stop all threads when attaching. * Place a breakpoint in a specific thread. I think the user experience will improve considerably if we could implement at least these features (and maybe some others that we deem useful). ---------- messages: 375579 nosy: pablogsal priority: normal severity: normal status: open title: Allow pdb to switch to a different thread versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 17 20:15:35 2020 From: report at bugs.python.org (Cleber Rosa) Date: Tue, 18 Aug 2020 00:15:35 +0000 Subject: [New-bugs-announce] [issue41572] Documentation wording fix on Lib/asyncio/transports.py Message-ID: <1597709735.56.0.50136505299.issue41572@roundup.psfhosted.org> New submission from Cleber Rosa : The docstring on asyncio.transports.BaseTransport.close() is missing a verb. ---------- assignee: docs at python components: Documentation messages: 375581 nosy: cleber.gnu, docs at python priority: normal severity: normal status: open title: Documentation wording fix on Lib/asyncio/transports.py type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 17 21:07:48 2020 From: report at bugs.python.org (wyz23x2) Date: Tue, 18 Aug 2020 01:07:48 +0000 Subject: [New-bugs-announce] [issue41573] Correct wrong sentences in General FAQ Message-ID: <1597712868.36.0.452194180345.issue41573@roundup.psfhosted.org> New submission from wyz23x2 : Release candidate is "rc" not "c"; Python 2.x is not supported anymore. ---------- assignee: docs at python components: Documentation messages: 375583 nosy: docs at python, wyz23x2 priority: normal severity: normal status: open title: Correct wrong sentences in General FAQ versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 18 04:50:45 2020 From: report at bugs.python.org (Prudent) Date: Tue, 18 Aug 2020 08:50:45 +0000 Subject: [New-bugs-announce] [issue41574] Python[11231:143796] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication. Message-ID: <1597740645.65.0.491610324996.issue41574@roundup.psfhosted.org> New submission from Prudent : I am writing codes for opening file dialog to select a file by clicking a button. The function I used was "askopenfilename()" in tkinter.filedialog module. However, a warning displayed when I ran the code. And, the file filter option was also disabled after one click. The displayed warning was below. ---------- components: macOS files: warning.png messages: 375601 nosy: Prudent, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Python[11231:143796] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication. type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49403/warning.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 18 05:35:22 2020 From: report at bugs.python.org (=?utf-8?q?Denilson_Figueiredo_de_S=C3=A1?=) Date: Tue, 18 Aug 2020 09:35:22 +0000 Subject: [New-bugs-announce] [issue41575] Please use active voice "Return foobar" instead of passive voice "foobar is returned" Message-ID: <1597743322.05.0.268987971288.issue41575@roundup.psfhosted.org> New submission from Denilson Figueiredo de S? : When reading the documentation for call_soon(), call_later(), call_at(), and several other functions, the sentence that describes the return value is in passive voice: https://docs.python.org/3/library/asyncio-eventloop.html > An instance of asyncio.TimerHandle is returned which can be used to cancel the callback. The problem: Most functions in Python documentation describe the return value by "Return foobar", an active voice sentence at the beginning of a paragraph. (e.g. https://docs.python.org/3/library/functions.html ) Thus, for the reader, it's easy to quickly skim the text for the return value. Even easier because the reader is already trained to do so, given other occurrences in the documentation. However, by hiding "is returned" in the middle of the sentence/paragraph, the reader can't easily find the return value, having to carefully read through all the text. Not only this is slower, but way more difficult if the reader is in a hurry or tired. (That was my case, I missed that sentence even after looking at the documentation several times.) Solution: Change it to: Return an instance of asyncio.TimerHandle which can be used to cancel the callback. Further solution: Search the documentation for other cases of "is returned" and consider if it is worth rewording as active voice. Bonus link: https://developers.google.com/tech-writing/one/active-voice ---------- assignee: docs at python components: Documentation messages: 375603 nosy: denilsonsa, docs at python priority: normal severity: normal status: open title: Please use active voice "Return foobar" instead of passive voice "foobar is returned" type: enhancement versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 18 06:56:07 2020 From: report at bugs.python.org (Thomas Grainger) Date: Tue, 18 Aug 2020 10:56:07 +0000 Subject: [New-bugs-announce] [issue41576] document BaseException in favour of bare except in error tutorial Message-ID: <1597748167.25.0.315179093688.issue41576@roundup.psfhosted.org> Change by Thomas Grainger : ---------- assignee: docs at python components: Documentation nosy: docs at python, graingert priority: normal pull_requests: 21033 severity: normal status: open title: document BaseException in favour of bare except in error tutorial _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 18 13:21:46 2020 From: report at bugs.python.org (Bob Fang) Date: Tue, 18 Aug 2020 17:21:46 +0000 Subject: [New-bugs-announce] [issue41577] Cannot use ProcessPoolExecutor if in a decorator? Message-ID: <1597771306.07.0.252837170253.issue41577@roundup.psfhosted.org> New submission from Bob Fang : I have this minimal example: ``` from functools import wraps from concurrent import futures import random def decorator(func): num_process = 4 def impl(*args, **kwargs): with futures.ProcessPoolExecutor() as executor: fs = [] for i in range(num_process): fut = executor.submit(func, *args, **kwargs) fs.append(fut) result = [] for f in futures.as_completed(fs): result.append(f.result()) return result return impl @decorator def get_random_int(): return random.randint(0, 100) if __name__ == "__main__": result = get_random_int() print(result) ``` If we try to run this function I think we will have the following error: ``` _pickle.PicklingError: Can't pickle : it's not the same object as __main__.get_random_int ``` I think the main issue here is that the "wraps" decorator itself alters the `func` object and thus make it impossible to pickle. I found this rather strange. I am just wondering if there is any way to get around this behavior? I would want to use `wraps` if possible. Thanks! ---------- components: Library (Lib) messages: 375614 nosy: bob.fang.london priority: normal severity: normal status: open title: Cannot use ProcessPoolExecutor if in a decorator? type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 18 13:56:34 2020 From: report at bugs.python.org (Brett Cannon) Date: Tue, 18 Aug 2020 17:56:34 +0000 Subject: [New-bugs-announce] [issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence Message-ID: <1597773394.37.0.055865211998.issue41584@roundup.psfhosted.org> New submission from Brett Cannon : https://docs.python.org/3/reference/datamodel.html#object.__ror__ has a note saying: "If the right operand's type is a subclass of the left operand's type and that subclass provides the reflected method for the operation, this method will be called before the left operand's non-reflected method." The slightly unclear part (at least to me) is the "provides the reflected method." What this actually means according to https://bugs.python.org/issue30140 is that the subclass **implements** the `__r*__` method, not just that the method is reachable on the subclass via getattr(). That wasn't clear to me when I initially read this. ---------- assignee: docs at python components: Documentation messages: 375621 nosy: brett.cannon, docs at python priority: normal severity: normal stage: needs patch status: open title: Clarify documentation for binary arithmetic operation subclass __r*__ precedence versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 18 16:47:21 2020 From: report at bugs.python.org (Erik Quaeghebeur) Date: Tue, 18 Aug 2020 20:47:21 +0000 Subject: [New-bugs-announce] [issue41585] policy.max_line_length is incorrectly assumed to never be None Message-ID: <1597783641.3.0.970481026671.issue41585@roundup.psfhosted.org> New submission from Erik Quaeghebeur : I?got the following error (Python 3.7.8): Traceback (most recent call last): File "/home/equaeghe/.local/bin/html2alternative.py", line 68, in replaceable.add_alternative(plain) File "/usr/lib/python3.7/email/message.py", line 1153, in add_alternative self._add_multipart('alternative', *args, **kw) File "/usr/lib/python3.7/email/message.py", line 1144, in _add_multipart part.set_content(*args, **kw) File "/usr/lib/python3.7/email/message.py", line 1171, in set_content super().set_content(*args, **kw) File "/usr/lib/python3.7/email/message.py", line 1101, in set_content content_manager.set_content(self, *args, **kw) File "/usr/lib/python3.7/email/contentmanager.py", line 37, in set_content handler(msg, obj, *args, **kw) File "/usr/lib/python3.7/email/contentmanager.py", line 185, in set_text_content cte, payload = _encode_text(string, charset, cte, msg.policy) File "/usr/lib/python3.7/email/contentmanager.py", line 154, in _encode_text max(len(x) for x in lines) <= policy.max_line_length): TypeError: '<=' not supported between instances of 'int' and 'NoneType' This is triggered because it is incorrectly assumed that policy.max_line_length cannot be None. This issue is still present in current master: https://github.com/python/cpython/blob/c3dd7e45cc5d36bbe2295c2840faabb5c75d83e4/Lib/email/contentmanager.py#L149 ---------- components: email messages: 375625 nosy: barry, equaeghe, r.david.murray priority: normal severity: normal status: open title: policy.max_line_length is incorrectly assumed to never be None type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 19 01:46:00 2020 From: report at bugs.python.org (Ruben Vorderman) Date: Wed, 19 Aug 2020 05:46:00 +0000 Subject: [New-bugs-announce] [issue41586] Allow to set pipe size on subprocess.Popen. Message-ID: <1597815960.69.0.196461399013.issue41586@roundup.psfhosted.org> New submission from Ruben Vorderman : Pipes block if reading from an empty pipe or when writing to a full pipe. When this happens the program waiting for the pipe still uses a lot of CPU cycles when waiting for the pipe to stop blocking. I found this while working with xopen. A library that pipes data into an external gzip process. (This is more efficient than using python's gzip module, because the subprocess escapes the GIL, so your main algorithm can fully utilize one CPU core while the compression is offloaded to another). It turns out that increasing the pipe size on Linux from the default of 64KB to the maximum allowed pipe size in /proc/sys/fs/max-pipe-size (1024KB) drastically improves performance: https://github.com/marcelm/xopen/issues/35. TLDR: full utilization of CPU cores, a 40%+ decrease in wall-clock time and a 20% decrease in the number of compute seconds (indicating that 20% was wasted waiting on blocking pipes). However, doing this with subprocess is quite involved as it is now. 1. You have to find out which constants to use in fcntl for setting the pipesize (these constants are not in python). 2. You have to start the Popen process with routing stdout to subprocess.Pipe. 3. You have to get my_popen_process.stdout.fileno() 4. Use fcntl.fcntl to modify the pipe size. It would be much easier to do `subprocess.Popen(args, pipesize=1024 *1024)` for example. I am currently working on a PR implementing this. It will also make F_GETPIPE_SZ and F_SETPIPE_SZ available to the fcntl module. ---------- components: Library (Lib) messages: 375636 nosy: rhpvorderman priority: normal severity: normal status: open title: Allow to set pipe size on subprocess.Popen. versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 19 05:49:29 2020 From: report at bugs.python.org (=?utf-8?b?5p2O6LaF54S2?=) Date: Wed, 19 Aug 2020 09:49:29 +0000 Subject: [New-bugs-announce] [issue41587] Potential memory leak while using shared memory Message-ID: <1597830569.16.0.0101746791101.issue41587@roundup.psfhosted.org> New submission from ??? : We find an issue while using shared memory. When opening another process to overwrite the shared memory, the memory of this process will increase to about the size of this shared memory. So when several processes try to read or write the shared memory, there will be N times memory usage. ``` import os, psutil import numpy as np from multiprocessing import Process, shared_memory SHM_SIZE = 100000 * 30 * 20 def f(name): print('[Sub] (Before) Used Memory of {}: {} MiB'.format( os.getpid(), psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024, )) shm = shared_memory.SharedMemory(name=name) b = np.ndarray(shape=(SHM_SIZE, 1), dtype=np.float64, buffer=shm.buf) for i in range(SHM_SIZE): b[i, 0] = 1 print('[Sub] (After) Used Memory of {}: {} MiB'.format( os.getpid(), psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024, )) def main(): print('[Main] Used Memory of {}: {} MiB'.format( os.getpid(), psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024, )) shm = shared_memory.SharedMemory(create=True, size=8*SHM_SIZE, name='shm') p = Process(target=f, args=('shm',)) p.start() p.join() print('[Main] Used Memory of {}: {} MiB'.format( os.getpid(), psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024, )) input() shm.close() shm.unlink() if __name__ == '__main__': main() ``` ---------- components: Library (Lib) messages: 375642 nosy: seraphlivery priority: normal severity: normal status: open title: Potential memory leak while using shared memory type: resource usage versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 19 09:55:15 2020 From: report at bugs.python.org (Or Yahalom) Date: Wed, 19 Aug 2020 13:55:15 +0000 Subject: [New-bugs-announce] [issue41588] Potential Memory leak with concurrent.futures.ThreadPoolExecutor's map Message-ID: <1597845315.75.0.199249722825.issue41588@roundup.psfhosted.org> New submission from Or Yahalom : I've been debugging a high memory consumption in one of my scripts and traced it back to the `concurrent.futures.ThreadPoolExecutor`. When further investigating and playing around, I found out that when using `concurrent.futures.ThreadPoolExecutor` with the map function, and passing a dictionary to the map's function as an argument, the memory used by the pool won't be freed and as a result the total memory consumption will continue to rise. (Seems like it also happens when passing a list and maybe even other types). Here is an example of a code to recreate this issue: ``` #!/usr/bin/env python3 import os import time import psutil import random import concurrent.futures from memory_profiler import profile as mem_profile p = psutil.Process(os.getpid()) def do_magic(values): return None @mem_profile def foo(): a = {i: chr(i) for i in range(1024)} with concurrent.futures.ThreadPoolExecutor(max_workers=10) as pool: proccessed_data = pool.map(do_magic, a) def fooer(): while True: foo() time.sleep(1) fooer() ``` ---------- components: Extension Modules messages: 375647 nosy: or12 priority: normal severity: normal status: open title: Potential Memory leak with concurrent.futures.ThreadPoolExecutor's map type: resource usage versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 19 13:18:37 2020 From: report at bugs.python.org (browser.365) Date: Wed, 19 Aug 2020 17:18:37 +0000 Subject: [New-bugs-announce] [issue41589] Strange behavior with sparse.dok_matrix decimal is cast to integer Message-ID: <1597857517.39.0.5072524691.issue41589@roundup.psfhosted.org> New submission from browser.365 : import numpy as np from scipy import sparse import decimal D = decimal.Decimal Al = sparse.dok_matrix((10, 10), dtype=np.dtype(D)) Al.astype(D) Al[1,1] = D('0.1') print(Al[1,1]) print(type(Al[1,1])) Al[0,0] = D('0') print(Al[0,0]) print(type(Al[0,0])) z = decimal.Decimal('0') print(z) print(type(z)) print(' - ') Running the above code gives: 0.1 0 0 - All of the elements should be decimal. ---------- messages: 375660 nosy: browser.365 priority: normal severity: normal status: open title: Strange behavior with sparse.dok_matrix decimal is cast to integer type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 19 13:33:13 2020 From: report at bugs.python.org (email0.ya) Date: Wed, 19 Aug 2020 17:33:13 +0000 Subject: [New-bugs-announce] [issue41590] "zip()" very slowly for this Message-ID: <1597858393.53.0.732585687531.issue41590@roundup.psfhosted.org> New submission from email0.ya : https://docs.python.org/3.9/tutorial/datastructures.html Nested List Comprehensions ---------- assignee: docs at python components: Documentation files: nested_lists.py messages: 375662 nosy: docs at python, email0.ya priority: normal severity: normal status: open title: "zip()" very slowly for this type: performance versions: Python 3.9 Added file: https://bugs.python.org/file49405/nested_lists.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 19 13:40:02 2020 From: report at bugs.python.org (Walid Taha) Date: Wed, 19 Aug 2020 17:40:02 +0000 Subject: [New-bugs-announce] [issue41591] Comprehensions documentation Message-ID: <1597858802.77.0.294724913479.issue41591@roundup.psfhosted.org> New submission from Walid Taha : The documentation for list comprehensions contains the following phrase: "As we saw in the previous section, the nested listcomp is evaluated in the context of the for that follows it, so this example is equivalent to:" This should be corrected, as it currently contradicts what was said previously, which is that list comprehensions and the conditional they contain are scoped in the same order as they appear (rather than the reverse). This issue can be found on this page: https://docs.python.org/3/tutorial/datastructures.html It also seems to appear in the most recent version: https://docs.python.org/3.10/tutorial/datastructures.html To confirm that the first (and not the second statement) is correct, you may consider the following code: l=[] for x in range(0,3): for y in range (0,x+1): l.append((x,y)) print(l) l=[(x,y) for x in range (0,3) for y in range (0,x+1)] print(l) Which run on 3.7.5 produces the following output [(0, 0), (1, 0), (1, 1), (2, 0), (2, 1), (2, 2)] [(0, 0), (1, 0), (1, 1), (2, 0), (2, 1), (2, 2)] ---------- assignee: docs at python components: Documentation messages: 375665 nosy: docs at python, wtaha priority: normal severity: normal status: open title: Comprehensions documentation versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 19 15:21:34 2020 From: report at bugs.python.org (Eric Pederson) Date: Wed, 19 Aug 2020 19:21:34 +0000 Subject: [New-bugs-announce] [issue41592] Make _SubParsersAction public Message-ID: <1597864894.48.0.159581898725.issue41592@roundup.psfhosted.org> New submission from Eric Pederson : ArgumentParser.add_subparsers() returns a _SubParsersAction. This requires user code using type annotations to use a protected type which causes type checkers like PyCharm to complain. For example: def add_subparser(name: str, subparser: _SubParsersAction, subparsers: dict) -> ArgumentParser: parser = subparser.add_parser(name) parser.add_argument('-v', '--verbose', action='store_true') subparsers[name] = parser return parser You can't use plain Action because Action doesn't have the add_parser() method. ---------- components: Library (Lib) messages: 375670 nosy: sourcedelica priority: normal severity: normal status: open title: Make _SubParsersAction public type: enhancement versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 19 18:28:29 2020 From: report at bugs.python.org (leonyxz) Date: Wed, 19 Aug 2020 22:28:29 +0000 Subject: [New-bugs-announce] [issue41593] pathlib PermissionError problem Message-ID: <1597876109.8.0.763662606664.issue41593@roundup.psfhosted.org> New submission from leonyxz : python 3.x FreeBSD 11.3-RELEASE-p12 with custom settings mentioned later. On vanilla configuration of FreeBSD there is no issue. Installation of FreeBSD in question has mac_bsdextended turned on (https://www.freebsd.org/cgi/man.cgi?query=mac_bsdextended&sektion=4&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports) Using ugidfw (https://www.freebsd.org/cgi/man.cgi?query=ugidfw&sektion=8&manpath=freebsd-release-ports), the following rule has been set: --------------------------------------------------------------- 0 subject not uid root gid nobody object gid wheel type d mode sx --------------------------------------------------------------- The following code shows the minimal reproducible example: --------------------------------------------------------------- from pathlib import Path BASE_DIR = Path(__file__).resolve(strict=True).parent.parent print(BASE_DIR) --------------------------------------------------------------- Running the code directly works: --------------------------------------------------------------- $ python test.py /usr/home/example --------------------------------------------------------------- But importing it as a module does not: --------------------------------------------------------------- $ python -m test Traceback (most recent call last): File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/home/example/django_3136test/test.py", line 2, in BASE_DIR = Path(__file__).resolve(strict=True).parent.parent File "/usr/local/lib/python3.6/pathlib.py", line 1141, in resolve s = self._flavour.resolve(self, strict=strict) File "/usr/local/lib/python3.6/pathlib.py", line 346, in resolve return _resolve(base, str(path)) or sep File "/usr/local/lib/python3.6/pathlib.py", line 330, in _resolve target = accessor.readlink(newpath) File "/usr/local/lib/python3.6/pathlib.py", line 440, in readlink return os.readlink(path) PermissionError: [Errno 13] Permission denied: '/usr' --------------------------------------------------------------- The issue seems to be comnected with following piece code https://github.com/python/cpython/blob/master/Lib/pathlib.py#L342-L346 --------------------------------------------------------------- try: target = accessor.readlink(newpath) except OSError as e: if e.errno != EINVAL and strict: raise # Not a symlink, or non-strict mode. We just leave the path # untouched. path = newpath --------------------------------------------------------------- With ugidfw enabled, `os.readlink` raises a `PermissionError`, which is unhandled by pathlib. ---------- components: FreeBSD, Library (Lib) messages: 375677 nosy: koobs, leonyxz priority: normal severity: normal status: open title: pathlib PermissionError problem versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 19 20:24:11 2020 From: report at bugs.python.org (Kyle Meyer) Date: Thu, 20 Aug 2020 00:24:11 +0000 Subject: [New-bugs-announce] [issue41594] Intermittent failures of loop.subprocess_exec() to capture output Message-ID: <1597883051.54.0.163691000969.issue41594@roundup.psfhosted.org> New submission from Kyle Meyer : I've been debugging an intermittent test failure in code that calls `loop.subprocess_exec` with an `asyncio.SubprocessProtocol` subclass. Here's a minimal example that I hope captures the issue. It's based closely off of the `DateProtocol` [example][1] in the asyncio protocol documentation. import asyncio class Protocol(asyncio.SubprocessProtocol): def __init__(self, exit_future): self.exit_future = exit_future self.output = bytearray() def pipe_data_received(self, fd, data): self.output.extend(data) def process_exited(self): self.exit_future.set_result(True) async def get_stdout(): loop = asyncio.get_running_loop() exit_future = asyncio.Future(loop=loop) transport, protocol = await loop.subprocess_exec( lambda: Protocol(exit_future), "printf", "ok", stdin=None, stderr=None) await exit_future transport.close() return bytes(protocol.output) The attached script adds some debugging statements to what's above and then repeats the specified number of calls to `asyncio.run(get_stdout())`, aborting if `asyncio.run(get_stdout())` returns an empty byte string rather then the expected `b'ok'`. With Python 3.7.3 on a Debian system, I see occasional aborts. For example, after two runs of the script with no unexpectedly empty output, I saw $ python3 reproducer.py 500 Iteration: 32 of 500 Failed on iteration 32 logfile: /tmp/asyncio-debug-bqehu8f3.log $ tail /tmp/asyncio-debug-bqehu8f3.log DEBUG: process_exited() called DEBUG: Starting iteration 31 DEBUG: Using selector: EpollSelector DEBUG: pipe_data_received(): fd=1, data=b'ok' DEBUG: process_exited() called DEBUG: Starting iteration 32 DEBUG: Using selector: EpollSelector DEBUG: process_exited() called DEBUG: pipe_data_received(): fd=1, data=b'ok' DEBUG: Failed on iteration 32 Based on the debug statements, it looks like `pipe_data_received` does get called with the output for the run that comes up empty, but only after `process_exited` is called. On my first try with a python built from a recent commit (0be7c216e1), I triggered the failure: $ python -V Python 3.10.0a0 $ python reproducer.py 500 Iteration: 8 of 500 Failed on iteration 8 logfile: /tmp/asyncio-debug-m5fba4ga.log $ tail /tmp/asyncio-debug-m5fba4ga.log DEBUG: process_exited() called DEBUG: Starting iteration 7 DEBUG: Using selector: EpollSelector DEBUG: pipe_data_received(): fd=1, data=b'ok' DEBUG: process_exited() called DEBUG: Starting iteration 8 DEBUG: Using selector: EpollSelector DEBUG: process_exited() called DEBUG: pipe_data_received(): fd=1, data=b'ok' DEBUG: Failed on iteration 8 As I'm following the example from the documentation closely, I hope I'm not committing a silly error that leads to an expected race here. [1]: https://docs.python.org/3/library/asyncio-protocol.html#loop-subprocess-exec-and-subprocessprotocol ---------- components: asyncio files: reproducer.py messages: 375680 nosy: asvetlov, kyleam, yselivanov priority: normal severity: normal status: open title: Intermittent failures of loop.subprocess_exec() to capture output type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file49406/reproducer.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 19 20:39:50 2020 From: report at bugs.python.org (Maarten) Date: Thu, 20 Aug 2020 00:39:50 +0000 Subject: [New-bugs-announce] [issue41595] curses' window.chgat does not change color when specifying curses.A_COLOR Message-ID: <1597883990.64.0.646746547163.issue41595@roundup.psfhosted.org> New submission from Maarten : Or'ing curses.A_COLOR in the `attr` argument of curses.window.chgat ends of with the line not showing. Actual Problem: The text is invisible/hidden/not shown. Using only the attribute curses.A_BLINK is fine. Expected: The color of the line is changed +the text starts blinking. I have attached a small python reproducer and a small c source that shows the correct behavior. The c example should be compiled as `gcc chgat.c -lncurses -o chgat`. This is using ncurses 6.1 The c code is from https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/attrib.html, and the python script is a translation of it. ---------- components: Library (Lib) files: chgat.py messages: 375681 nosy: maarten priority: normal severity: normal status: open title: curses' window.chgat does not change color when specifying curses.A_COLOR versions: Python 3.7 Added file: https://bugs.python.org/file49407/chgat.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 20 03:47:51 2020 From: report at bugs.python.org (Mototsugu Emori) Date: Thu, 20 Aug 2020 07:47:51 +0000 Subject: [New-bugs-announce] [issue41596] Re: Asyncio Fatal Error on SSL Transport - IndexError Deque Index Out Of Range Message-ID: <1597909671.37.0.412048973684.issue41596@roundup.psfhosted.org> New submission from Mototsugu Emori : When using SSL with websocket, _process_write_backlog function throws IndexError. --------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 827, in transfer_data message = await self.read_message() File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 895, in read_message frame = await self.read_data_frame(max_size=self.max_size) File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 971, in read_data_frame frame = await self.read_frame(max_size) File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 1051, in read_frame extensions=self.extensions, File "/usr/local/lib/python3.7/site-packages/websockets/framing.py", line 105, in read data = await reader(2) File "/usr/local/lib/python3.7/asyncio/streams.py", line 679, in readexactly await self._wait_for_data('readexactly') File "/usr/local/lib/python3.7/asyncio/streams.py", line 473, in _wait_for_data await self._waiter File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 689, in _process_write_backlog del self._write_backlog[0] IndexError: deque index out of range --------------------------------------------------------------- Websocket has a keepalive feature and periodically pings the server. If ping sending process occurs at the same time when sending data, the data operation to the array (_write_backlog) will be duplicated and the error will occur. --------------------------------------------------------------- asyncio/sslproto.py --------------------------------------------------------------- class SSLProtocol(protocols.Protocol) def _write_appdata(self, data): self._write_backlog.append((data, 0)) <--- append data to _write_backlog self._write_buffer_size += len(data) self._process_write_backlog() def _process_write_backlog(self): del self._write_backlog[0] <--- !!!ERROR!!! IndexError: deque index out of range --------------------------------------------------------------- I made a patch(sslproto.sy.patch) to exclude data operations on the array (_write_backlog). Could you check it? Environments: debian 4.19.46 Python 3.7.3 OpenSSL 1.1.0l 10 Sep 2019 Reference: Asyncio Fatal Error on SSL Transport - IndexError Deque Index Out Of Range https://bugs.python.org/issue37226 ---------- components: asyncio files: sslproto.py.patch keywords: patch messages: 375689 nosy: asvetlov, ben.brown, christian.heimes, m_emori, maayank, yselivanov priority: normal severity: normal status: open title: Re: Asyncio Fatal Error on SSL Transport - IndexError Deque Index Out Of Range type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file49409/sslproto.py.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 20 03:57:45 2020 From: report at bugs.python.org (Mototsugu Emori) Date: Thu, 20 Aug 2020 07:57:45 +0000 Subject: [New-bugs-announce] [issue41597] Fatal Error on SSL Transport - sslv3 alert bad record mac Message-ID: <1597910265.16.0.778996337527.issue41597@roundup.psfhosted.org> New submission from Mototsugu Emori : When using SSL with websocket, I get an SSLError. --------------------------------------------------------------- [2020-08-17 15:02:51,078] websockets.protocol : Error in data transfer [MainProcess - MainThread] Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 827, in transfer_data message = await self.read_message() File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 895, in read_message frame = await self.read_data_frame(max_size=self.max_size) File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 971, in read_data_frame frame = await self.read_frame(max_size) File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 1051, in read_frame extensions=self.extensions, File "/usr/local/lib/python3.7/site-packages/websockets/framing.py", line 106, in read data = await reader(2) File "/usr/local/lib/python3.7/asyncio/streams.py", line 679, in readexactly await self._wait_for_data('readexactly') File "/usr/local/lib/python3.7/asyncio/streams.py", line 473, in _wait_for_data await self._waiter File "guac_ws_client.py", line 166, in read await websocket.send(instruction) File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 567, in send await self.write_frame(True, opcode, data) File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 1077, in write_frame await self._drain() File "/usr/local/lib/python3.7/site-packages/websockets/protocol.py", line 306, in _drain raise exc File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 530, in data_received ssldata, appdata = self._sslpipe.feed_ssldata(data) File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 202, in feed_ssldata chunk = self._sslobj.read(self.max_size) File "/usr/local/lib/python3.7/ssl.py", line 707, in read v = self._sslobj.read(len) ssl.SSLError: [SSL: SSLV3_ALERT_BAD_RECORD_MAC] sslv3 alert bad record mac (_ssl.c:2488) --------------------------------------------------------------- When data reception (SSL_read) and data transmission (SSL_write) occur at the same time, the error seems to occur. I made a patch(ssl.py.patch) that excludes SSL_read and SSL_write. Could you check it? Environments: debian 4.19.46 Python 3.7.3 OpenSSL 1.1.0l 10 Sep 2019 Reference: Re: Asyncio Fatal Error on SSL Transport - IndexError Deque Index Out Of Range https://bugs.python.org/issue41596 ---------- assignee: christian.heimes components: SSL files: ssl.py.patch keywords: patch messages: 375690 nosy: alex, christian.heimes, dstufft, janssen, m_emori priority: normal severity: normal status: open title: Fatal Error on SSL Transport - sslv3 alert bad record mac type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file49410/ssl.py.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 20 05:39:37 2020 From: report at bugs.python.org (marco_ocram) Date: Thu, 20 Aug 2020 09:39:37 +0000 Subject: [New-bugs-announce] [issue41598] rnd() + rndup() in math Message-ID: <1597916377.13.0.981755252162.issue41598@roundup.psfhosted.org> New submission from marco_ocram : hello, please insert following simple but useful roundings in new lib math. def rnd(x, n=0): a = x*10**n b = int(a) if abs(a - b) >= 0.5: b += 1 if x >= 0 else -1 return b/10**n def rndup(x, n=0): a = x*10**n b = int(a) if abs(a - b) > 0: b += 1 if x >= 0 else -1 return b/10**n thanks a lot, marco. ---------- components: Library (Lib) messages: 375695 nosy: marco_ocram priority: normal severity: normal status: open title: rnd() + rndup() in math type: enhancement versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 20 05:40:49 2020 From: report at bugs.python.org (Erik Quaeghebeur) Date: Thu, 20 Aug 2020 09:40:49 +0000 Subject: [New-bugs-announce] [issue41599] get/set_payload deprecated, but get_set_content do not provide full replacement functionality Message-ID: <1597916449.63.0.470625371504.issue41599@roundup.psfhosted.org> New submission from Erik Quaeghebeur : >From Python 3.6 onwards, get/set_payload methods are deprecated on the basic email message class, email.message.EmailMessage (changed from email.message.Message). The get/set_content methods are suggested instead. However, with get/set_payload one can ?transplant? whole MIME subtrees, while get/set_content cannot deal with multipart parts. I would like to suggest to not remove get/set_payload until its functionality is present in other methods. Perhaps they should even be un-deprecated. ---------- components: email messages: 375696 nosy: barry, equaeghe, r.david.murray priority: normal severity: normal status: open title: get/set_payload deprecated, but get_set_content do not provide full replacement functionality type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 20 07:24:14 2020 From: report at bugs.python.org (Vegard Stikbakke) Date: Thu, 20 Aug 2020 11:24:14 +0000 Subject: [New-bugs-announce] [issue41600] Expected behavior of argparse given quoted strings Message-ID: <1597922654.76.0.585650879506.issue41600@roundup.psfhosted.org> New submission from Vegard Stikbakke : I'm not sure if this is a bug, but I had a problem when I was trying to use argparse recently, and I was wondering about the expected behavior. For context: We invoke a Python program from a deployment tool, where we provide input in a text box. We were using argparse to read and parse the input arguments. The scenario we had was we were requiring two named arguments to be given, as illustrated in the minimal example below. ``` # a.py import argparse parser = argparse.ArgumentParser() parser.add_argument("--a", required=True) parser.add_argument("--b", required=True) parser.parse_args() ``` When invoking this program from this deployment tool giving `--a=1 --b=2` as input, we got the error message `a.py: error: the following arguments are required: --a, --b`. As it turns out, the input was provided in the same way as if you had given the program a quoted string in the shell: ``` $ python a.py "--a=1 --b=2" usage: a.py [-h] --a A --b B a.py: error: the following arguments are required: --a, --b ``` When given a quoted string like this, `sys.argv` only has two elements, namely `a.py` and `--a=1 --b=2`. This was new to me! But it makes sense. This was a bit annoying! One way to get around it, which we did indeed implement, is to mutate `sys.argv`, effectively unpacking the input string such that `sys.argv` ends up as `["a.py", "--a=1`, `--b=2`]. Given that the string contains named arguments, it seems to me that it could be possible, and safe, to unpack this quoted string. Would that make sense? Or am I using it incorrectly? Or is there some other way to provide input such that I don't have to do this hack that I mentioned? If we make a similar program where the arguments `a` and `b` are not named arguments, but rather positional arguments, ``` # b.py import argparse parser = argparse.ArgumentParser() parser.add_argument("a") parser.add_argument("b") parser.parse_args() ``` and we call the program as before with `python b.py "1 2"`, then `a` will be set to the string `1 2`, whereas `b` will not be set (and so the program will, of course, exit). This seems entirely reasonable. And perhaps it isn't possible to both get this behaviour, as well as the behaviour that I mentioned above. ---------- components: Library (Lib) messages: 375702 nosy: vegarsti priority: normal severity: normal status: open title: Expected behavior of argparse given quoted strings type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 20 12:30:59 2020 From: report at bugs.python.org (Clemens) Date: Thu, 20 Aug 2020 16:30:59 +0000 Subject: [New-bugs-announce] [issue41601] Performance issue using isspace() in extension module on Windows Message-ID: <1597941059.18.0.402030297208.issue41601@roundup.psfhosted.org> New submission from Clemens : Function isspace() is significantly slower in extension modules in Python 3.7 or later than in Python 3.6 on Windows 10. Python 3.6: >python test.py Locale: C Set locale: C Locale: C Duration: 0.19718074798583984 Python 3.7: >python test.py Locale: C Set locale: C Locale: C Duration: 2.9086477756500244 Python 3.8: >python test.py Locale: LC_COLLATE=C;LC_CTYPE=English_Germany.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C Set locale: C Locale: C Duration: 2.99224853515625 Python 3.9.0a5: >python test.py Locale: LC_COLLATE=C;LC_CTYPE=English_Germany.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C Set locale: C Locale: C Duration: 2.90370512008667 Building the extension module: > python setup.py build_ext A similar issue already exists, but I am not sure if it is the same problem since the suggested solution is about embedding Python rather then extending it: https://bugs.python.org/issue35195 ---------- components: Distutils, Windows messages: 375722 nosy: Clemens, dstufft, eric.araujo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Performance issue using isspace() in extension module on Windows type: performance versions: Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 20 15:58:37 2020 From: report at bugs.python.org (Thomas Grainger) Date: Thu, 20 Aug 2020 19:58:37 +0000 Subject: [New-bugs-announce] [issue41602] Python doesn't exit with proper resultcode on SIGINT in runpy Message-ID: <1597953517.67.0.398105173164.issue41602@roundup.psfhosted.org> New submission from Thomas Grainger : when running "python -m ham.py" KeyboardInterrupt should result in -2, but results in 1 see test case ---------- components: Interpreter Core files: test_exit.py messages: 375732 nosy: graingert priority: normal severity: normal status: open title: Python doesn't exit with proper resultcode on SIGINT in runpy versions: Python 3.8, Python 3.9 Added file: https://bugs.python.org/file49414/test_exit.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 20 19:40:27 2020 From: report at bugs.python.org (Thangamani) Date: Thu, 20 Aug 2020 23:40:27 +0000 Subject: [New-bugs-announce] [issue41603] Compilation issue 3.8.5 with Redhat 7.8 and Red Hat 4.8.5-39 Message-ID: <1597966827.71.0.80485708689.issue41603@roundup.psfhosted.org> New submission from Thangamani : gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fprofile-use -fprofile-correction -I./Include/internal -I. -I./Include -DPy_BUILD_CORE -o Python/frozen.o Python/frozen.c rm -f libpython3.8.a ar rcs libpython3.8.a Modules/getbuildinfo.o Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/token.o Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/capsule.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/interpreteridobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/picklebufobject.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/context.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/graminit.o Python/hamt.o Python/import.o Python/importdl.o Python/initconfig.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/peephole.o Python/preconfig.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/_operator.o Modules/_collectionsmodule.o Modules/_abc.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/signalmodule.o Modules/_stat.o Modules/timemodule.o Modules/_threadmodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o Modules/xxsubtype.o Python/frozen.o gcc -pthread -Xlinker -export-dynamic -o python Programs/python.o libpython3.8.a -lcrypt -lpthread -ldl -lutil -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 Could not import runpy module Traceback (most recent call last): File "/opt/hadoop_admin/Python-3.8.5/Lib/runpy.py", line 15, in import importlib.util File "/opt/hadoop_admin/Python-3.8.5/Lib/importlib/util.py", line 14, in from contextlib import contextmanager File "/opt/hadoop_admin/Python-3.8.5/Lib/contextlib.py", line 4, in import _collections_abc SystemError: returned NULL without setting an error generate-posix-vars failed make[1]: *** [pybuilddir.txt] Error 1 make[1]: Leaving directory `/opt/hadoop_admin/Python-3.8.5' make: *** [profile-opt] Error 2 ---------- components: Installation messages: 375737 nosy: thangmanims priority: normal severity: normal status: open title: Compilation issue 3.8.5 with Redhat 7.8 and Red Hat 4.8.5-39 type: compile error versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 20 20:16:11 2020 From: report at bugs.python.org (Maarten) Date: Fri, 21 Aug 2020 00:16:11 +0000 Subject: [New-bugs-announce] [issue41604] [curses.panel] Failed panel.set_userptr will decrement refcount of original userptr Message-ID: <1597968971.01.0.83582874982.issue41604@roundup.psfhosted.org> New submission from Maarten : When ncurses' function `set_panel_userptr` fails, panel.set_userptr should not decrement the reference count of the previous userptr. ---------- components: Library (Lib) messages: 375738 nosy: maarten priority: normal severity: normal status: open title: [curses.panel] Failed panel.set_userptr will decrement refcount of original userptr versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 20 21:01:05 2020 From: report at bugs.python.org (soyoo) Date: Fri, 21 Aug 2020 01:01:05 +0000 Subject: [New-bugs-announce] [issue41605] t = re.sub(".*", "*", src) has different ouput Message-ID: <1597971665.44.0.864871063473.issue41605@roundup.psfhosted.org> New submission from soyoo : import re src = "123" # can be anything t = re.sub(".*", "*", src) """ The output of 't' is different in python2 and python3; When python version is python3, it's depend on OS version. When python version is python2, it seem always output single '*'. When python version is python3, and OS is Linux, it output single '*'; When python version is python3, and OS is Mac or windows, it output double '**'. """ ---------- components: 2to3 (2.x to 3.x conversion tool) files: python3 on windows.png messages: 375741 nosy: soyoo priority: normal severity: normal status: open title: t = re.sub(".*", "*", src) has different ouput type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file49418/python3 on windows.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 21 04:01:43 2020 From: report at bugs.python.org (Salvatore Ingala) Date: Fri, 21 Aug 2020 08:01:43 +0000 Subject: [New-bugs-announce] [issue41606] multiprocessing.Event.wait hangs when interrupted by signal that sets the event Message-ID: <1597996903.36.0.845550593577.issue41606@roundup.psfhosted.org> New submission from Salvatore Ingala : According to the docs, multiprocessing.Event is a clone of threading.Event. Yet, there is a strange behavior that is observed only on multiprocessing.Event. If an event.wait() is interrupted by a SIGINT and the signal handler sets the event, then the call to event.set() hangs if event is an instance of multiprocessing.Event, in what looks like a deadlock; instead, it works as expected if it's an instance of threading.Event. See the file attached for a reproduction. It seems to have been so for a long time, see: https://stackoverflow.com/questions/24422154/multiprocessing-event-wait-hangs-when-interrupted-by-a-signal/30831867 ---------- files: event-test.py messages: 375745 nosy: salvatore.ingala priority: normal severity: normal status: open title: multiprocessing.Event.wait hangs when interrupted by signal that sets the event type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49419/event-test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 21 04:49:30 2020 From: report at bugs.python.org (Michael Mussato) Date: Fri, 21 Aug 2020 08:49:30 +0000 Subject: [New-bugs-announce] [issue41607] pdb - Clickabler path to breakpoints Message-ID: <1597999770.47.0.222044983618.issue41607@roundup.psfhosted.org> New submission from Michael Mussato : Wouldn't it be helpful if the pdb showed the path to the current breakpoint as a clickable link? For this to work, it seems that the path needs to follow a specific format, like so: "File "/full/path/to/file.py", line XY" Currently, it displays the breakpoint like this: "> /full/path/to/file.py(XY).func()" This might be very IDE dependent, but i. e. PyCharm interprets the first format as a clickable link and takes you straight to the line of code that contains the breakpoint. Very helpful. ---------- components: Library (Lib) files: Screenshot 2020-06-12 at 08.37.35.png messages: 375747 nosy: michimussato priority: normal severity: normal status: open title: pdb - Clickabler path to breakpoints type: enhancement Added file: https://bugs.python.org/file49420/Screenshot 2020-06-12 at 08.37.35.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 21 09:26:29 2020 From: report at bugs.python.org (E. Paine) Date: Fri, 21 Aug 2020 13:26:29 +0000 Subject: [New-bugs-announce] [issue41608] IDLE: not remove multiple spaces if not at start of line Message-ID: <1598016389.5.0.122509577817.issue41608@roundup.psfhosted.org> New submission from E. Paine : I could not think of a better title so will attempt to explain myself better here. Currently, the IDLE smart backspace will delete multiple whitespace up to the tab width even if it is not at the start of the line. Consider the following examples (where the | is where the cursor is when backspace is clicked - the backticks are just to show code not part of the example text): ` |abc def `: IDLE correctly deletes all four spaces as this is considered the indentation of the code. ` abc |def `: IDLE incorrectly deletes both spaces rather than just one (annoying when correcting a typo). The patch proposes IDLE just deletes one space as is normal/expected behaviour. ` abc def |`: IDLE will currently delete both spaces but the proposed patch will just delete one. This behaviour is up for debate as I personally think all trailing whitespace should be cleared by a backspace, but I also think the proposed behaviour is more consistent than the existing behaviour. The patch (a PR to be linked shortly after issue creation) is very simple as we already have the compiled `_line_indent_re` which we can check for a full match on all text before the cursor (`chars`). ---------- assignee: terry.reedy components: IDLE messages: 375754 nosy: epaine, taleinat, terry.reedy priority: normal severity: normal status: open title: IDLE: not remove multiple spaces if not at start of line type: enhancement versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 21 11:31:01 2020 From: report at bugs.python.org (Irit Katriel) Date: Fri, 21 Aug 2020 15:31:01 +0000 Subject: [New-bugs-announce] [issue41609] pdb's whatis command reports method as function Message-ID: <1598023861.67.0.741384423605.issue41609@roundup.psfhosted.org> New submission from Irit Katriel : pdb's whatis command prints 'Function' instead of 'Method' for a bound method: > python.bat Running Release|Win32 interpreter... Python 3.10.0a0 (heads/master-dirty:12695f4c6d, Aug 21 2020, 15:48:06) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> class MyClass: ... def mymethod(self): ... pass ... >>> import pdb >>> pdb.set_trace() --Return-- > (1)()->None (Pdb) whatis MyClass().mymethod Function mymethod (Pdb) MyClass().mymethod > (Pdb) ---------- components: Library (Lib) messages: 375756 nosy: iritkatriel priority: normal severity: normal status: open title: pdb's whatis command reports method as function type: behavior versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 21 12:44:22 2020 From: report at bugs.python.org (supriya singh) Date: Fri, 21 Aug 2020 16:44:22 +0000 Subject: [New-bugs-announce] [issue41610] Any Raspberry Pi Zero Projects to try? Message-ID: <1598028262.16.0.0744145450871.issue41610@roundup.psfhosted.org> New submission from supriya singh : Not any error or issue just wanted to get some work or to find new friends. Recently I started learning python during this lockdown and with the help of YouTube tutorials I learned a lot. Now I am here to find some Raspberry Pi zero projects that include Python. I have searched on Google and found the project "self-driving car" Now, I want to learn more by trying some more projects so that I can master this language. ---------- messages: 375759 nosy: supriyasingh priority: normal severity: normal status: open title: Any Raspberry Pi Zero Projects to try? _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 21 13:51:37 2020 From: report at bugs.python.org (Raymond Hettinger) Date: Fri, 21 Aug 2020 17:51:37 +0000 Subject: [New-bugs-announce] [issue41611] IDLE warnings and exceptions Message-ID: <1598032297.66.0.655712746709.issue41611@roundup.psfhosted.org> New submission from Raymond Hettinger : In case it is helpful, here is the error log from a recent full-day IDLE session. $ python3.9 --version Python 3.9.0rc1 $ python3.9 -m idlelib.idle Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py", line 1885, in __call__ return self.func(*args) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/autocomplete_w.py", line 248, in winconfig_event acw_width, acw_height = acw.winfo_width(), acw.winfo_height() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py", line 1291, in winfo_width self.tk.call('winfo', 'width', self._w)) _tkinter.TclError: bad window path name ".!listedtoplevel4.!frame.text.!toplevel2" /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 2 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appear to be %d ' 2020-08-20 15:00:38.074 Python[1512:2706287] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication. 2020-08-20 16:29:29.880 Python[1512:2706287] WARNING: running implicitly; please run panels using NSSavePanel rather than NSApplication. ---------- assignee: terry.reedy components: IDLE messages: 375764 nosy: rhettinger, terry.reedy priority: normal severity: normal status: open title: IDLE warnings and exceptions versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 22 01:30:15 2020 From: report at bugs.python.org (Abael He) Date: Sat, 22 Aug 2020 05:30:15 +0000 Subject: [New-bugs-announce] [issue41612] python3.8.3/traceback.py:312, AttributeError: 'KeyError' object has no attribute 'tb_frame' Message-ID: <1598074215.76.0.483354536095.issue41612@roundup.psfhosted.org> New submission from Abael He : /opt/conda/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py in prompt(self, message, editing_mode, refresh_interval, vi_mode, lexer, completer, complete_in_thread, is_password, key_bindings, bottom_toolbar, style, color_depth, include_default_pygments_style, style_transformation, swap_light_and_dark_colors, rprompt, multiline, prompt_continuation, wrap_lines, enable_history_search, search_ignore_case, complete_while_typing, validate_while_typing, complete_style, auto_suggest, validator, clipboard, mouse_support, input_processors, reserve_space_for_menu, enable_system_prompt, enable_suspend, enable_open_in_editor, tempfile_suffix, tempfile, default, accept_default, pre_run, set_exception_handler) 992 return get_event_loop().run_until_complete(self._dumb_prompt(self.message)) 993 --> 994 return self.app.run(set_exception_handler=set_exception_handler) 995 996 async def _dumb_prompt(self, message: AnyFormattedText = "") -> _T: /opt/conda/lib/python3.8/site-packages/prompt_toolkit/application/application.py in run(self, pre_run, set_exception_handler) 809 set_event_loop(loop) 810 --> 811 return loop.run_until_complete( 812 self.run_async(pre_run=pre_run, set_exception_handler=set_exception_handler) 813 ) /opt/conda/lib/python3.8/asyncio/base_events.py in run_until_complete(self, future) 614 raise RuntimeError('Event loop stopped before Future completed.') 615 --> 616 return future.result() 617 618 def stop(self): /opt/conda/lib/python3.8/site-packages/prompt_toolkit/application/application.py in run_async(self, pre_run, set_exception_handler) 776 loop.set_exception_handler(previous_exc_handler) 777 --> 778 return await _run_async2() 779 780 def run( /opt/conda/lib/python3.8/site-packages/prompt_toolkit/application/application.py in _run_async2() 764 # `KeyboardInterrupt`, we still want to wait for the 765 # background tasks. --> 766 await self.cancel_and_wait_for_background_tasks() 767 768 # Set the `_is_running` flag to `False`. Normally this /opt/conda/lib/python3.8/site-packages/prompt_toolkit/application/application.py in cancel_and_wait_for_background_tasks(self) 865 for task in self.background_tasks: 866 try: --> 867 await task 868 except CancelledError: 869 pass /opt/conda/lib/python3.8/site-packages/prompt_toolkit/buffer.py in new_coroutine(*a, **kw) 1852 while True: 1853 try: -> 1854 await coroutine(*a, **kw) 1855 except _Retry: 1856 continue /opt/conda/lib/python3.8/site-packages/prompt_toolkit/buffer.py in async_completer(select_first, select_last, insert_common_part, complete_event) 1681 return self.complete_state == complete_state 1682 -> 1683 async for completion in self.completer.get_completions_async( 1684 document, complete_event 1685 ): /opt/conda/lib/python3.8/site-packages/prompt_toolkit/completion/base.py in get_completions_async(self, document, complete_event) 267 completer = self.get_completer() or DummyCompleter() 268 --> 269 async for completion in completer.get_completions_async( 270 document, complete_event 271 ): /opt/conda/lib/python3.8/site-packages/prompt_toolkit/completion/base.py in get_completions_async(self, document, complete_event) 194 Asynchronous generator of :class:`.Completion` objects. 195 """ --> 196 for item in self.get_completions(document, complete_event): 197 yield item 198 /opt/conda/lib/python3.8/site-packages/IPython/terminal/ptutils.py in get_completions(self, document, complete_event) 114 except Exception as e: 115 from traceback import print_tb --> 116 print_tb(e) 117 118 @staticmethod /opt/conda/lib/python3.8/traceback.py in print_tb(tb, limit, file) 51 method. 52 """ ---> 53 print_list(extract_tb(tb, limit=limit), file=file) 54 55 def format_tb(tb, limit=None): /opt/conda/lib/python3.8/traceback.py in extract_tb(tb, limit) 70 whitespace stripped; if the source is not available it is None. 71 """ ---> 72 return StackSummary.extract(walk_tb(tb), limit=limit) 73 74 # /opt/conda/lib/python3.8/traceback.py in extract(klass, frame_gen, limit, lookup_lines, capture_locals) 345 result = klass() 346 fnames = set() --> 347 for f, lineno in frame_gen: 348 co = f.f_code 349 filename = co.co_filename /opt/conda/lib/python3.8/traceback.py in walk_tb(tb) 310 """ 311 while tb is not None: --> 312 yield tb.tb_frame, tb.tb_lineno 313 tb = tb.tb_next 314 AttributeError: 'KeyError' object has no attribute 'tb_frame' ---------- components: Library (Lib) messages: 375783 nosy: abaelhe priority: normal severity: normal status: open title: python3.8.3/traceback.py:312, AttributeError: 'KeyError' object has no attribute 'tb_frame' type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 22 05:30:02 2020 From: report at bugs.python.org (Batuhan Taskaya) Date: Sat, 22 Aug 2020 09:30:02 +0000 Subject: [New-bugs-announce] [issue41613] get_type_hints regression for 3.9 and 3.10 Message-ID: <1598088602.53.0.71167650591.issue41613@roundup.psfhosted.org> New submission from Batuhan Taskaya : The attached script works perfectly fine under Python 3.8, but it crashes in 3.9/3.10. $ ./py38/python typing_fail.py (3.8.5+) {'a': , 'b': } $ ./py39/python typing_fail.py (3.9.0rc1+) [SNIP] TypeError: 'NoneType' object is not subscriptable $ ./cpython/python typing_fail.py (3.10.0a0) [SNIP] TypeError: 'NoneType' object is not subscriptable ---------- files: typing_fail.py messages: 375791 nosy: BTaskaya, gvanrossum, levkivskyi, lukasz.langa priority: normal severity: normal status: open title: get_type_hints regression for 3.9 and 3.10 Added file: https://bugs.python.org/file49421/typing_fail.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 22 07:42:15 2020 From: report at bugs.python.org (Alex Hall) Date: Sat, 22 Aug 2020 11:42:15 +0000 Subject: [New-bugs-announce] [issue41614] Items put on Queue in thread in child process sometimes not seen by parent process Message-ID: <1598096535.13.0.114988714243.issue41614@roundup.psfhosted.org> New submission from Alex Hall : See attached file. The summary is that I start a Process, which starts a Thread, which puts some values on a Queue which was originally created by the parent process and passed down. Usually this works but occasionally the parent process doesn't see the items on the queue: queue.get() times out and queue.empty() is True, although queue.qsize() is accurate. I can reproduce this on master: Python 3.10.0a0 (heads/master:802726a, Aug 22 2020, 12:56:09) [GCC 7.5.0] on linux as well as other versions I have installed which I've selected. On 3.6 it seems like the problem is even worse and some of my comments don't apply. I've tested the script on Ubuntu 18.04.4, but the general problem seems to also happen on OSX although I can't confirm that now. ---------- files: queue_bug.py messages: 375795 nosy: alexmojaki priority: normal severity: normal status: open title: Items put on Queue in thread in child process sometimes not seen by parent process versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file49422/queue_bug.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 22 08:35:17 2020 From: report at bugs.python.org (Jason R. Coombs) Date: Sat, 22 Aug 2020 12:35:17 +0000 Subject: [New-bugs-announce] [issue41615] sys.argv may be None or an empty list Message-ID: <1598099717.03.0.849817579096.issue41615@roundup.psfhosted.org> New submission from Jason R. Coombs : In [pypa/keyring#445](https://github.com/pypa/keyring/445) and issue839151, we learned that there are Python interpreters in which `sys.argv` is an empty list, is not a list, or is not initialized at all. Through use of `sys.argv[0]`, the documentation strongly implies that `sys.argv` is always a list of at least one element. The documentation makes no mention of these other cases. It would be nice if the documentation would describe what values (or absence thereof) are valid for `sys.argv`. ---------- assignee: docs at python components: Documentation messages: 375796 nosy: docs at python, jaraco priority: normal severity: normal status: open title: sys.argv may be None or an empty list _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 22 09:43:37 2020 From: report at bugs.python.org (ManPython) Date: Sat, 22 Aug 2020 13:43:37 +0000 Subject: [New-bugs-announce] [issue41616] Global variable in whole project and Relative imports problem Message-ID: <1598103817.04.0.76764693555.issue41616@roundup.psfhosted.org> New submission from ManPython : 1. Curently we have easy option to declare global variable (GV) a) like this: global var1 var1 = 'whatever' b) with some improved version like this: global var1 'whatever' or: global var1,var2, 'whatever1','whatever2' c) The Python is in way to produce small lines of code but this philosophy around GV not offering this. 2. Can we have easy option to delclare global variable for whole project including MVC? a) By this is requiments to call GV in any place like in Model, View or Controler and change thits var globaly. b) I noticed that programers many often calling module in main to operate with, where this way made many problems withs Relative imports https://stackoverflow.com/questions/30669474/beyond-top-level-package-error-in-relative-import https://stackoverflow.com/questions/14132789/relative-imports-in-python-2-7/ https://stackoverflow.com/questions/35166821/valueerror-attempted-relative-import-beyond-top-level-package https://stackoverflow.com/questions/40022220/attempted-relative-import-beyond-toplevel-package b) In my test the Relative imports made often problems (As imposible to load - most often Django, but similar with Pyside2) and I noticed that exist some relation with global var. In some of P36 version most often due to libs. Wan't checking this, expecting other way (more easy) to solve typical problems with GV. 1) in Django most often is meeting in config.py 2) in Pyside2 most often is meeting in main.py where we calling model,view,controler (or other liek utils) and we trying working in some core variables that limitig projects to easy manage GV ---------- components: Interpreter Core messages: 375799 nosy: ManPython priority: normal severity: normal status: open title: Global variable in whole project and Relative imports problem type: enhancement versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 22 21:02:47 2020 From: report at bugs.python.org (Joshua Root) Date: Sun, 23 Aug 2020 01:02:47 +0000 Subject: [New-bugs-announce] [issue41617] __builtin_bswap16 is used without checking it is supported Message-ID: <1598144567.0.0.176317601198.issue41617@roundup.psfhosted.org> New submission from Joshua Root : Older clang versions don't have __builtin_bswap16, but it's always used when compiling with clang, which means the build fails with those older versions. The code should use __has_builtin to check. ---------- components: Build messages: 375806 nosy: jmr priority: normal severity: normal status: open title: __builtin_bswap16 is used without checking it is supported type: compile error versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 23 04:48:18 2020 From: report at bugs.python.org (hai shi) Date: Sun, 23 Aug 2020 08:48:18 +0000 Subject: [New-bugs-announce] [issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot() Message-ID: <1598172498.12.0.869607269568.issue41618@roundup.psfhosted.org> New submission from hai shi : In order to resolve bpo41073, we want to extend `PyType_GetSlot()` to accept static types. But there have another question we should be considered: How many slots should be exposed in `PyType_GetSlot()`. petr's opinion from PR-21931:I would not want to expose the Py_tp_as_* slots at all; their contents are covered in other slots that should be used instead. And slots like Py_tp_version_tag are specific to CPython; I don't think they should be exposed in the general C API. ---------- components: C API messages: 375808 nosy: petr.viktorin, shihai1991, vstinner priority: normal severity: normal status: open title: [C API] How many slots of static types should be exposed in PyType_GetSlot() type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 23 08:54:10 2020 From: report at bugs.python.org (Paul Moore) Date: Sun, 23 Aug 2020 12:54:10 +0000 Subject: [New-bugs-announce] [issue41619] Subprocesses created with DETACHED_PROCESS can pop up a console window Message-ID: <1598187250.65.0.957662639779.issue41619@roundup.psfhosted.org> New submission from Paul Moore : The following code pops up an extra console window when run on Windows 10, Python 3.8: from subprocess import DETACHED_PROCESS, Popen p = Popen(["py", "-c", "from time import sleep; sleep(5)"], creationflags=DETACHED_PROCESS) Adding CREATE_NO_WINDOW doesn't help, nor does adding a STARTUPINFO with SW_HIDE. The problem occurs whether the Python interpreter is started via the py.exe wrapper or the actual python.exe. However, changing the process being run from "py" to sys.executable makes the problem go away. I've seen similar issues when using sys.executable, but the script is being called from a virtualenv. I can't find any set of options for Popen that reliably avoids showing a console window when invoked like this. ---------- components: Windows messages: 375811 nosy: paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Subprocesses created with DETACHED_PROCESS can pop up a console window type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 23 13:50:44 2020 From: report at bugs.python.org (Iman Tabrizian) Date: Sun, 23 Aug 2020 17:50:44 +0000 Subject: [New-bugs-announce] [issue41620] Python Unittest does not return results object when the test is skipped Message-ID: <1598205044.1.0.669094685419.issue41620@roundup.psfhosted.org> New submission from Iman Tabrizian : Result object is null when a test case is skipeed. ---------- messages: 375820 nosy: Tabrizian priority: normal pull_requests: 21054 severity: normal status: open title: Python Unittest does not return results object when the test is skipped versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 23 15:04:06 2020 From: report at bugs.python.org (Moshe Morad) Date: Sun, 23 Aug 2020 19:04:06 +0000 Subject: [New-bugs-announce] [issue41621] defaultdict miss behave when using default_factory passed as kwargs Message-ID: <1598209446.58.0.105121459433.issue41621@roundup.psfhosted.org> New submission from Moshe Morad : How to reproduce ---------------- >>> from collections import defaultdict >>> dd = defaultdict(default_factory=list) >>> dd defaultdict(None, {'default_factory': }) >>> print(dd.default_factory) None Analysis -------- defdict_init(PyObject *self, PyObject *args, PyObject *kwds) function that initializing defaultdict object ignores the kwds and pass them to the dict init only. Expect: ------- Since we can understand why we want to move kwds to dict without modification consider at least adding comment in the docstring or enforce it as positional argument only. ---------- assignee: docs at python components: Documentation, ctypes messages: 375823 nosy: docs at python, moshemorad12340 priority: normal severity: normal status: open title: defaultdict miss behave when using default_factory passed as kwargs type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 23 16:34:50 2020 From: report at bugs.python.org (jack1142) Date: Sun, 23 Aug 2020 20:34:50 +0000 Subject: [New-bugs-announce] [issue41622] Add support for emoji-data.txt and emoji-variation-sequences.txt to unicodedata Message-ID: <1598214890.63.0.84270917383.issue41622@roundup.psfhosted.org> New submission from jack1142 : `emoji-data.txt` and `emoji-variation-sequences.txt` files were formally pulled into the UCD as of Version 13.0 [1] so I think that unicodedata as a package providing access to UCD could support those as well. In particular: - `emoji-data.txt` lists character properties for emoji characters [2] - `emoji-variation-sequences.txt` lists valid text and emoji presentation sequences [3] Data from `emoji-variation-sequences.txt` can be used to ensure consistent rendering of emoji characters across devices [4] (`StandardizedVariants.txt` has a similar purpose for non-emoji characters). I'm not entirely sure of the use cases for `emoji-data.txt`, but because it's also newly added in UCD 13.0.0, I figured I at least shouldn't omit it when making this issue. [1] https://www.unicode.org/reports/tr44/#Change_History - Changes in Unicode 13.0.0, "Emoji Data" section [2] https://www.unicode.org/reports/tr51/#Emoji_Properties_and_Data_Files [3] https://www.unicode.org/reports/tr51/#Emoji_Variation_Sequences [4] https://unicode.org/faq/vs.html#1 ---------- components: Unicode messages: 375826 nosy: ezio.melotti, jack1142, vstinner priority: normal severity: normal status: open title: Add support for emoji-data.txt and emoji-variation-sequences.txt to unicodedata type: enhancement versions: Python 3.10, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 24 05:58:16 2020 From: report at bugs.python.org (simin lin) Date: Mon, 24 Aug 2020 09:58:16 +0000 Subject: [New-bugs-announce] [issue41623] What's the by-design behavior when os.fork() is invoked in an asyncio loop? Message-ID: <1598263096.24.0.301943200855.issue41623@roundup.psfhosted.org> New submission from simin lin : I have the same quesion in stackoverflow. Please refer to https://stackoverflow.com/questions/63558555/whats-the-by-design-behavior-when-os-fork-is-invoked-in-an-asyncio-loop to get a better format. Does asyncio work with os.fork()? Code Snippet 1: import asyncio import os import aiohttp async def main(): url = "https://google.com" pid = os.fork() if pid == 0: # child process print("in child process") await fetch(url) print("in child process done") else: print("in parent process") await asyncio.sleep(20) print("in parent process done") async def fetch(url): async with aiohttp.ClientSession() as session: async with session.get(url) as response: return await response.text() if __name__ == "__main__": asyncio.run(main()) Code above works fine. Code Snippet 2: import asyncio import os import aiohttp async def main(): url = "https://google.com" pid = os.fork() if pid == 0: # child process print("in child process") await asyncio.sleep(10) # different with code snippet 1 # await fetch(url) print("in child process done") else: print("in parent process") await asyncio.sleep(20) print("in parent process done") async def fetch(url): async with aiohttp.ClientSession() as session: async with session.get(url) as response: return await response.text() if __name__ == "__main__": asyncio.run(main()) Code above will raise following exception: Traceback (most recent call last): File "fork_sleep.py", line 28, in asyncio.run(main()) File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run return loop.run_until_complete(main) File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "fork_sleep.py", line 13, in main await asyncio.sleep(10) # different with code snippet 1 File "/usr/lib/python3.8/asyncio/tasks.py", line 637, in sleep loop = events.get_running_loop() RuntimeError: no running event loop The reason for the "no running event loop" exception is that function get_running_loop compare the os.getpid() and the pid saved in loop. When they are different, the exception above is raised. Please refer to the following code from cpython source code. def get_running_loop(): """Return the running event loop. Raise a RuntimeError if there is none. This function is thread-specific. """ # NOTE: this function is implemented in C (see _asynciomodule.c) loop = _get_running_loop() if loop is None: raise RuntimeError('no running event loop') return loop def _get_running_loop(): """Return the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific. """ # NOTE: this function is implemented in C (see _asynciomodule.c) running_loop, pid = _running_loop.loop_pid if running_loop is not None and pid == os.getpid(): return running_loop So it seems that asyncio event loop works fine in child process if you don't touch the function get_running_loop. My question is, what is the by-design behavior? Why the author check the pid in function _get_running_loop? And what is the solution if you encounter the "no running event loop" in child process. ---------- components: asyncio messages: 375839 nosy: asvetlov, linsm08, yselivanov priority: normal severity: normal status: open title: What's the by-design behavior when os.fork() is invoked in an asyncio loop? type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 24 08:33:44 2020 From: report at bugs.python.org (MingZhe Hu) Date: Mon, 24 Aug 2020 12:33:44 +0000 Subject: [New-bugs-announce] [issue41624] typing.Coroutine documentation Message-ID: <1598272424.26.0.934323513188.issue41624@roundup.psfhosted.org> New submission from MingZhe Hu : The documentation [1] for Coroutine in typing library writes: class typing.Coroutine(Awaitable[V_co], Generic[T_co T_contra, V_co]) which should be: class typing.Coroutine(Awaitable[V_co], Generic[T_co, T_contra, V_co]) a comma is missed between the first type variable T_co and the second one T_contr. [1] https://docs.python.org/3/library/typing.html#typing.Generic ---------- assignee: docs at python components: Documentation messages: 375841 nosy: Elaphurus, docs at python priority: normal severity: normal status: open title: typing.Coroutine documentation versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 24 11:57:18 2020 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Mon, 24 Aug 2020 15:57:18 +0000 Subject: [New-bugs-announce] [issue41625] Add splice() to the os module Message-ID: <1598284638.54.0.211220433787.issue41625@roundup.psfhosted.org> New submission from Pablo Galindo Salgado : The splice system call moves data between two file descriptors without copying between kernel address space and user address space. This can be a very useful addition for libraries implementing low-level file management. ---------- messages: 375851 nosy: pablogsal priority: normal severity: normal status: open title: Add splice() to the os module _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 24 12:28:45 2020 From: report at bugs.python.org (hai shi) Date: Mon, 24 Aug 2020 16:28:45 +0000 Subject: [New-bugs-announce] [issue41626] port shebang of tools from python2 to python3 Message-ID: <1598286525.38.0.443257169426.issue41626@roundup.psfhosted.org> New submission from hai shi : After the EOL of python2, the shebang of tools should be ported from python2 to python3. some files like: https://github.com/python/cpython/blob/master/Objects/typeslots.py#L1 ---------- messages: 375855 nosy: shihai1991 priority: normal severity: normal status: open title: port shebang of tools from python2 to python3 versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 24 15:45:31 2020 From: report at bugs.python.org (Steve Dower) Date: Mon, 24 Aug 2020 19:45:31 +0000 Subject: [New-bugs-announce] [issue41627] Relocate user site packages on Windows 32-bit Message-ID: <1598298331.25.0.959731633335.issue41627@roundup.psfhosted.org> New submission from Steve Dower : Currently, the user site packages on Windows is %APPDATA%\Python\PythonXY. This can cause conflicts between the 32-bit and 64-bit versions of the runtime. We should switch the pattern to Python{sys.winver}, which is XY or XY-32, the same as elsewhere. This is a breaking change to tools that try to manage these directly, but it shouldn't need a deprecation cycle (there isn't really anywhere to raise a warning...). So I think we can just update Lib/sysconfig.py and Lib/site.py for 3.10, as well as the docs. ---------- components: Windows messages: 375860 nosy: paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Relocate user site packages on Windows 32-bit versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 24 19:31:52 2020 From: report at bugs.python.org (Tom Most) Date: Mon, 24 Aug 2020 23:31:52 +0000 Subject: [New-bugs-announce] [issue41628] All unittest.mock autospec-generated methods are coroutine functions Message-ID: <1598311912.52.0.893321210218.issue41628@roundup.psfhosted.org> New submission from Tom Most : Given a class: class Foo: def bar(self): pass And an autospec'd mock of it: foo_mock = mock.create_autospec(spec=Foo) The result of `asyncio.iscoroutinefunction()` differs: asyncio.iscoroutinefunction(Foo.bar) # -> False asyncio.iscoroutinefunction(foo_mock.bar) # -> True This behavior is the same on Python 3.7 and 3.8. I've attached a demonstration script, repro4.py. Here is the output on Python 3.7.9: $ python3.7 repro4.py baz is a coroutine function? False Foo.bar is a coroutine function? False foo_instance.bar is a coroutine function? False baz_mock is a coroutine function? False foo_mock.bar is a coroutine function? True foo_mock_instance.bar is a coroutine function? True foo_mock_mock.bar is a coroutine function? False foo_mock_mock_instance.bar is a coroutine function? False foo_mock_instance.bar() -> foo_mock_mock_instance.bar() -> And on Python 3.8.2: python3.8 repro4.py baz is a coroutine function? False Foo.bar is a coroutine function? False foo_instance.bar is a coroutine function? False baz_mock is a coroutine function? False foo_mock.bar is a coroutine function? True foo_mock_instance.bar is a coroutine function? True foo_mock_mock.bar is a coroutine function? True foo_mock_mock_instance.bar is a coroutine function? False foo_mock_instance.bar() -> foo_mock_mock_instance.bar() -> ---------- components: Library (Lib) files: repro4.py messages: 375862 nosy: twm priority: normal severity: normal status: open title: All unittest.mock autospec-generated methods are coroutine functions type: behavior versions: Python 3.7, Python 3.8 Added file: https://bugs.python.org/file49425/repro4.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 24 19:32:59 2020 From: report at bugs.python.org (mike bayer) Date: Mon, 24 Aug 2020 23:32:59 +0000 Subject: [New-bugs-announce] [issue41629] __class__ not set defining 'X' as . Was __classcell__ propagated to type.__new__? Message-ID: <1598311979.7.0.775389193479.issue41629@roundup.psfhosted.org> New submission from mike bayer : This is likely related or a dupe of https://bugs.python.org/issue29270, but the error message is different. I'm posting this to confirm it's the same issue, or not, and to at least provide a google result for people who also see this error as 29270 seems to imply this might not be fixable. Like 29270, it involves the fact that the interpreter seems to be looking at my super() call inside of a method without actually calling it, and then getting upset about __classcell__: from typing import NamedTuple class X(NamedTuple): a: str b: str # comment this out to remove the issue def foo(self): return super(X, self) and that's it! on my interpreter: Python 3.8.3 (default, May 23 2020, 16:34:37) [GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux I get: $ python test3.py Traceback (most recent call last): File "test3.py", line 4, in class X(NamedTuple): RuntimeError: __class__ not set defining 'X' as . Was __classcell__ propagated to type.__new__? The most surprising thing is that this seems extremely basic and google is not finding this error message for me. ---------- components: Interpreter Core messages: 375863 nosy: zzzeek priority: normal severity: normal status: open title: __class__ not set defining 'X' as . Was __classcell__ propagated to type.__new__? versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 25 00:15:19 2020 From: report at bugs.python.org (Maarten) Date: Tue, 25 Aug 2020 04:15:19 +0000 Subject: [New-bugs-announce] [issue41630] Visual Studio does not build the curses and curses.panel module Message-ID: <1598328919.18.0.0711977156478.issue41630@roundup.psfhosted.org> New submission from Maarten : When building python using Visual Studio, the curses and curses.module, are not getting built. ---------- components: Build, Library (Lib) messages: 375871 nosy: maarten priority: normal severity: normal status: open title: Visual Studio does not build the curses and curses.panel module _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 25 06:16:01 2020 From: report at bugs.python.org (STINNER Victor) Date: Tue, 25 Aug 2020 10:16:01 +0000 Subject: [New-bugs-announce] [issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import Message-ID: <1598350561.88.0.831200620813.issue41631@roundup.psfhosted.org> New submission from STINNER Victor : Building Mercurial with Python 3.9.0rc1 fails with the error: SystemError: returned NULL without setting an error The problem comes from the PyAST_Check() function. This function calls get_global_ast_state() which gets the state of the _ast module. If the module is not imported yet, it is imported. The problem is that Mercurial monkey-patches the __import__() builtin function to implement lazy imports. get_global_ast_state() calls PyImport_Import() which returns a Mercurial _LazyModule(__name__='_ast', ...) object. Calling get_ast_state() (PyModule_GetState()) on it is unsafe since it's not the _ast extension module, but another module (which has no state, PyModule_GetState() returns NULL). https://bugzilla.redhat.com/show_bug.cgi?id=1871992#c1 -- The _ast extension module was modified multiple times recently: * September 2019: The extension was converted to PEP 384 (stable ABI): bpo-38113, commit ac46eb4ad6662cf6d771b20d8963658b2186c48c * July 2020: The extension was converted to PEP 489 (multiphase init): bpo-41194, commit b1cc6ba73a51d5cc3aeb113b5e7378fb50a0e20a * (and bugfixes: see bpo-41194 and bpo-41204) I did the PEP 489 change to fix a regression caused by the first change (PEP 384), two bugs in fact: * bpo-41194 Python 3.9.0b3 crash on compile() in PyAST_Check() when the _ast module is loaded more than once * bpo-41261: 3.9-dev SEGV in object_recursive_isinstance in ast.literal_eval ---------- components: Library (Lib) messages: 375881 nosy: vstinner priority: release blocker severity: normal status: open title: _ast module: get_global_ast_state() doesn't work with Mercurial lazy import versions: Python 3.10, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 25 08:23:41 2020 From: report at bugs.python.org (Jonathan Lahav) Date: Tue, 25 Aug 2020 12:23:41 +0000 Subject: [New-bugs-announce] [issue41632] Tkinter - Unexpected behavior after creating around 10000 widgets Message-ID: <1598358221.58.0.0866491892705.issue41632@roundup.psfhosted.org> New submission from Jonathan Lahav : Observation: After creating around 10000 widgets (verified with ttk.Label), no more widgets get created, and sometimes graphical artifacts appear outside the application window. No error message or exception is raised. Expected: Either the limit can be removed (having dynamically created 10000 widgets in data heavy applications is sometimes desired), or at least document and return runtime errors to prevent the weird behavior. Reproduction: This is the problematic part: for _ in range(10000): ttk.Label(root, text='problematic') A full minimal example code is attached, though a better effect can be seen when running the above two lines in the context of a more advanced Tkinter application. ---------- components: Tkinter files: ten_k.py messages: 375888 nosy: gpolo, j.lahav, serhiy.storchaka priority: normal severity: normal status: open title: Tkinter - Unexpected behavior after creating around 10000 widgets type: crash versions: Python 3.8 Added file: https://bugs.python.org/file49426/ten_k.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 25 11:28:26 2020 From: report at bugs.python.org (Bob Kline) Date: Tue, 25 Aug 2020 15:28:26 +0000 Subject: [New-bugs-announce] [issue41633] pydoc skips methods of nested classes Message-ID: <1598369306.87.0.655415485903.issue41633@roundup.psfhosted.org> New submission from Bob Kline : Although the documentation for the pydoc says that it produces documentation of the classes recursively, this isn't actually true. ---------- components: Library (Lib) files: repro.py messages: 375891 nosy: bkline priority: normal severity: normal status: open title: pydoc skips methods of nested classes type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49428/repro.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 25 14:44:26 2020 From: report at bugs.python.org (pipythonmc) Date: Tue, 25 Aug 2020 18:44:26 +0000 Subject: [New-bugs-announce] [issue41634] Typo in curses documentation Message-ID: <1598381066.25.0.836031112719.issue41634@roundup.psfhosted.org> New submission from pipythonmc : https://docs.python.org/3/library/curses.html#curses.window.addch "overwriting any character previously painter" I believe it should be "overwriting any character previously painted" Also this is my first issue so if I made any mistakes please tell me. I am using Google Chrome 84.0.4147.135 (Official Build) (64-bit) but this shouldn't affect anything. ---------- assignee: docs at python components: Documentation messages: 375895 nosy: docs at python, pipythonmc priority: normal severity: normal status: open title: Typo in curses documentation type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 25 18:45:52 2020 From: report at bugs.python.org (Thomas Grainger) Date: Tue, 25 Aug 2020 22:45:52 +0000 Subject: [New-bugs-announce] [issue41635] flaky test.test_asyncio.test_events.ProactorEventLoopTests.test_call_later Message-ID: <1598395552.97.0.0133984716471.issue41635@roundup.psfhosted.org> New submission from Thomas Grainger : ====================================================================== FAIL: test_call_later (test.test_asyncio.test_events.ProactorEventLoopTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\a\cpython\cpython\lib\test\test_asyncio\test_events.py", line 301, in test_call_later self.assertTrue(0.08 <= t1-t0 <= 0.8, t1-t0) AssertionError: False is not true : 0.07800000000020191 ---------------------------------------------------------------------- https://github.com/python/cpython/pull/21956/checks?check_run_id=1028726196#step:5:4892 ---------- components: Tests messages: 375900 nosy: graingert priority: normal severity: normal status: open title: flaky test.test_asyncio.test_events.ProactorEventLoopTests.test_call_later versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Aug 25 20:48:02 2020 From: report at bugs.python.org (Graham Oliver) Date: Wed, 26 Aug 2020 00:48:02 +0000 Subject: [New-bugs-announce] [issue41636] distutils.util.strtobool documented behaviour Message-ID: <1598402882.51.0.310018876035.issue41636@roundup.psfhosted.org> New submission from Graham Oliver : Here is the text https://docs.python.org/3.6/distutils/apiref.html#distutils.util.strtobool Convert a string representation of truth to true (1) or false (0). True values are y, yes, t, true, on and 1; false values are n, no, f, false, off and 0. Raises ValueError if val is anything else. I wondered what would happen with 'FALSE' i.e. upper case. It appears to behave the same way as 'false'. In fact case does not seem to be an issue, so 'FaLsE' will return 0 as well. So a note that this function is independent of case may be helpful ---------- assignee: docs at python components: Documentation messages: 375902 nosy: Graham.Oliver, docs at python priority: normal severity: normal status: open title: distutils.util.strtobool documented behaviour versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 26 01:23:56 2020 From: report at bugs.python.org (Camion) Date: Wed, 26 Aug 2020 05:23:56 +0000 Subject: [New-bugs-announce] [issue41637] Calling a function with an infinite number of parameters is not detected and crash the interpreter instead of causing an exception Message-ID: <1598419436.9.0.814986663177.issue41637@roundup.psfhosted.org> New submission from Camion : The following code will obviously cause a memory leak, but this will not be detected and crash the interpreter: def inf(): while True: yield 0 def use(*parm): for i in parm: print(i) and then use(*inf()) or print(*int()) The reason of this test is that I wanted to check if ever python would be able to make lazy evaluation in parameter passing (It would be nice if it was but it is not the case). However, at least, I think this error should have been detected as well as an infinite recursion is, because it even has been able to crash and reboot a not so old (18) version of linux Mint. ---------- components: Interpreter Core messages: 375904 nosy: Camion priority: normal severity: normal status: open title: Calling a function with an infinite number of parameters is not detected and crash the interpreter instead of causing an exception type: crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 26 02:16:55 2020 From: report at bugs.python.org (Wolfgang Fahl) Date: Wed, 26 Aug 2020 06:16:55 +0000 Subject: [New-bugs-announce] [issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved Message-ID: <1598422615.42.0.67853581727.issue41638@roundup.psfhosted.org> New submission from Wolfgang Fahl : def testBindingError(self): ''' test list of Records with incomplete record leading to "You did not supply a value for binding 2" ''' listOfRecords=[{'name':'Pikachu', 'type':'Electric'},{'name':'Raichu' }] resultList=self.checkListOfRecords(listOfRecords,'Pokemon','name') Which eventually will call: insertCmd=entityInfo.insertCmd self.c.executemany(insertCmd,listOfRecords) self.c.commit() leading to the error message: sqlite3.ProgrammingError: You did not supply a value for binding 2. When many thousand records are inserted this message is not very helpful. you might want to improve it to: sqlite3.ProgrammingError: You did not supply a value for binding 2 ("type") in record #2 with a debug option that shows the actual date like: sqlite3.ProgrammingError: You did not supply a value for binding 2 ("type") in record #2 debuginfo: name="Raichu", type=missing sqlite3.ProgrammingError: You did not supply a value for binding 2. ---------- components: Library (Lib) messages: 375906 nosy: WolfgangFahl priority: normal severity: normal status: open title: Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 26 02:50:59 2020 From: report at bugs.python.org (Andy Maier) Date: Wed, 26 Aug 2020 06:50:59 +0000 Subject: [New-bugs-announce] [issue41639] Unpickling derived class of list does not call __init__() Message-ID: <1598424659.93.0.553984904692.issue41639@roundup.psfhosted.org> New submission from Andy Maier : Unpickling an object of a user class that derives from list seems to miss calling the user class's __init__() method: Consider this script, which defines a derived class of the built-in list for the purpose of creating a case insensitive list. The real example has all methods of list implemented, but this subset example also shows the issue: ----------------- import pickle def _lc_list(lst): result = list() for value in lst: result.append(value.lower()) return result class NocaseList(list): #def __new__(cls, iterable=()): # self = super(NocaseList, cls).__new__(cls, iterable) # print("Debug: __new__() for self={}".format(id(self))) # return self def __init__(self, iterable=()): print("Debug: __init__() for self={}".format(id(self))) super(NocaseList, self).__init__(iterable) self.lc_list = _lc_list(self) def append(self, value): super(NocaseList, self).append(value) self.lc_list.append(value.lower()) def extend(self, iterable): super(NocaseList, self).extend(iterable) for value in iterable: self.lc_list.append(value.lower()) ncl = NocaseList(['A', 'b']) pkl = pickle.dumps(ncl) nclx = pickle.loads(pkl) ----------------- $ python ./pickle_extend.py Debug: __init__() for self=4498704880 Traceback (most recent call last): File "./pickle_extend.py", line 32, in nclx = pickle.loads(pkl) File "./pickle_extend.py", line 28, in extend self.lc_list.append(value.lower()) AttributeError: 'NocaseList' object has no attribute 'lc_list' Uncommenting the __new__() method in the script shows that __new__() is called but not __init__(): $ python ./pickle_extend.py Debug: __new__() for self=4359683024 Debug: __init__() for self=4359683024 Debug: __new__() for self=4360134304 Traceback (most recent call last): File "./pickle_extend.py", line 32, in nclx = pickle.loads(pkl) File "./pickle_extend.py", line 28, in extend self.lc_list.append(value.lower()) AttributeError: 'NocaseList' object has no attribute 'lc_list' ---------- messages: 375909 nosy: andymaier priority: normal severity: normal status: open title: Unpickling derived class of list does not call __init__() versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 26 03:31:32 2020 From: report at bugs.python.org (Bastian Ebeling) Date: Wed, 26 Aug 2020 07:31:32 +0000 Subject: [New-bugs-announce] [issue41640] module zipfile issue on closing Message-ID: <1598427092.16.0.16834501548.issue41640@roundup.psfhosted.org> New submission from Bastian Ebeling : When trying to open an archive and read internal binary streams, for me it occurs, that the file-stream gets closed. As a code-Snippet: import zipfile srcfile=zipfile.ZipFile('file.zip') a=zipfile.Path(srcfile,"data1.bin").read_bytes() b=zipfile.Path(srcfile,"data2.bin").read_bytes() the second call results in the ValueError: seek of closed file A quick and dirty solution (as an idea) is to change close() for the _SharedFile to run self.close() instead of self._close(findeobj) in the end (somehow around line 772). Hopefully that helps ---------- messages: 375917 nosy: bastian.ebeling priority: normal severity: normal status: open title: module zipfile issue on closing type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 26 05:11:26 2020 From: report at bugs.python.org (Xavier Morel) Date: Wed, 26 Aug 2020 09:11:26 +0000 Subject: [New-bugs-announce] [issue41641] Add a "message" action to warnings, to trigger for every *unique* message Message-ID: <1598433086.63.0.062465851878.issue41641@roundup.psfhosted.org> New submission from Xavier Morel : Warning actions allow deduplicating warning triggers based on category ("once"), category + file ("module") and category + exact location ("default"). One thing which is missing is support for a single location generating warnings *on behalf* of other pieces of code. `warnings.warn` provides some support via the "stacklevel" parameter, but it is difficult to compute if the warning is generated from somewhat nested generic code (or even impossible if the warning is generated from completely generic code checking over e.g. data files or the like, or if the invoker could be invoked from multiple places with different depth difference from the code they're working for). But in that case, the warning messages will often be unique per functional unit, so it could be a useful base for deduplication, even though the warning could dynamically be invoked multiple times (per functional unit) because e.g. code is reloaded or whatever. ---------- components: Library (Lib) messages: 375924 nosy: xmorel priority: normal severity: normal status: open title: Add a "message" action to warnings, to trigger for every *unique* message type: enhancement versions: Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 26 05:29:54 2020 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Wed, 26 Aug 2020 09:29:54 +0000 Subject: [New-bugs-announce] [issue41642] RHEL and fedora buildbots fail due to disk space error Message-ID: <1598434194.1.0.809832074407.issue41642@roundup.psfhosted.org> New submission from Karthikeyan Singaravelan : It seems many of the RHEL and Fedora builds fail due to disk space https://buildbot.python.org/all/#/builders/185/builds/2 ./configure: line 2382: cannot create temp file for here-document: No space left on device ./configure: line 2394: cannot create temp file for here-document: No space left on device ./configure: line 2429: cannot create temp file for here-document: No space left on device ./configure: line 2591: cannot create temp file for here-document: No space left on device ./configure: line 2595: cannot create temp file for here-document: No space left on device ./configure: line 2599: cannot create temp file for here-document: No space left on device ./configure: line 2603: cannot create temp file for here-document: No space left on device ./configure: line 2607: cannot create temp file for here-document: No space left on device ./configure: line 2611: cannot create temp file for here-document: No space left on device ---------- components: Tests messages: 375925 nosy: cstratak, pablogsal, vstinner, xtreak priority: normal severity: normal status: open title: RHEL and fedora buildbots fail due to disk space error type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 26 06:55:12 2020 From: report at bugs.python.org (Thomas Grainger) Date: Wed, 26 Aug 2020 10:55:12 +0000 Subject: [New-bugs-announce] [issue41643] make shutil.make_archive always accepts pathlib objects Message-ID: <1598439312.44.0.297456491219.issue41643@roundup.psfhosted.org> New submission from Thomas Grainger : >>> shutil.make_archive(pathlib.Path("./foo"), root_dir=pathlib.Path("./foo"), format="zip") '/home/graingert/projects/ham/foo.zip' >>> shutil.make_archive(pathlib.Path("./foo"), root_dir=None, format="zip") Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.8/shutil.py", line 1045, in make_archive filename = func(base_name, base_dir, **kwargs) File "/usr/lib/python3.8/shutil.py", line 912, in _make_zipfile zip_filename = base_name + ".zip" TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str' see also https://bugs.python.org/issue23241 ---------- components: Library (Lib) messages: 375927 nosy: graingert priority: normal severity: normal status: open title: make shutil.make_archive always accepts pathlib objects type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Aug 26 12:37:38 2020 From: report at bugs.python.org (Joseph Perez) Date: Wed, 26 Aug 2020 16:37:38 +0000 Subject: [New-bugs-announce] [issue41644] builtin type kwargs Message-ID: <1598459858.48.0.222216937484.issue41644@roundup.psfhosted.org> New submission from Joseph Perez : Class definition can have kwargs which are used by `__init_subclass__` (and `__prepare__`). However, passing these kwargs using `type` builtin function instead of class definition syntax is not documented; kwargs are not mentioned in the function signature. https://docs.python.org/3/library/functions.html#type However, passing kwargs to `type` works: ```python class Foo: def __init_subclass__(cls, **kwargs): print(kwargs) Bar = type("Bar", (Foo,), {}, bar=None) # mypy and Pycharm complain #> {'bar': None} ``` By the way, the possibility to pass kwargs in `type` call is not documented in https://docs.python.org/3/reference/datamodel.html#customizing-class-creation too. ---------- assignee: docs at python components: Documentation messages: 375936 nosy: docs at python, joperez priority: normal severity: normal status: open title: builtin type kwargs 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 Aug 26 14:15:24 2020 From: report at bugs.python.org (Krishan Agarwal) Date: Wed, 26 Aug 2020 18:15:24 +0000 Subject: [New-bugs-announce] [issue41645] Typo First Page of Documentation Message-ID: <1598465724.17.0.0409144165682.issue41645@roundup.psfhosted.org> New submission from Krishan Agarwal : Grammatical error (parallelism) in Python 3.8.5 documentation, "The Python Tutorial". First page first paragraph. The "it" refers to the Python programming language. It HAS...data structures and it IS...a simple but effective approach... Currently reads: Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Should read: Python is an easy to learn, powerful programming language. It has efficient high-level data structures and is a simple but effective approach to object-oriented programming. ---------- assignee: docs at python components: Documentation messages: 375945 nosy: docs at python, kagarwal603 priority: normal severity: normal status: open title: Typo First Page of Documentation type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 27 05:53:46 2020 From: report at bugs.python.org (Jonatan Skogsfors) Date: Thu, 27 Aug 2020 09:53:46 +0000 Subject: [New-bugs-announce] [issue41646] Outdated shutil.copy documentation Message-ID: <1598522026.83.0.0983078348702.issue41646@roundup.psfhosted.org> New submission from Jonatan Skogsfors : In the 3.8.5 documentation for shutil.copy it says that "src and dst should be strings". However, the implementation doesn't seem to have any problem with path objects. ---------- assignee: docs at python components: Documentation messages: 375983 nosy: Jonatan Skogsfors, docs at python priority: normal severity: normal status: open title: Outdated shutil.copy documentation versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 27 06:28:20 2020 From: report at bugs.python.org (Matias G) Date: Thu, 27 Aug 2020 10:28:20 +0000 Subject: [New-bugs-announce] [issue41647] MutableMapping ".setdefault()" to return default value via __getitem__ Message-ID: <1598524100.24.0.553076023684.issue41647@roundup.psfhosted.org> New submission from Matias G : Hi, This is more a question/proposal than a real issue. I apologize in advance if this has already been debated or if it is not relevant. I noticed `setdefault` method of mutable mapping objects is returning the default value as passed in the call, when applicable, without passing through `__getitem__`. I think it would be more "symmetric" if it would return the default value set by `__setitem__` via `__getitem__`. This would handle the case of a custom MutableMapping defining a custom behaviour of `__setitem__` and `__getitem__`. Of course, in my case finally I overloaded `setdefault` to do this, but it might be worth in general, at least for the MutableMapping class. Thanks, Matias. ---------- messages: 375984 nosy: guijarro priority: normal severity: normal status: open title: MutableMapping ".setdefault()" to return default value via __getitem__ type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 27 08:46:41 2020 From: report at bugs.python.org (STINNER Victor) Date: Thu, 27 Aug 2020 12:46:41 +0000 Subject: [New-bugs-announce] [issue41648] edelsohn-* buildbot worker failing with: No space left on device Message-ID: <1598532401.11.0.67076258216.issue41648@roundup.psfhosted.org> New submission from STINNER Victor : Issue similar to bpo-41642 "RHEL and fedora buildbots fail due to disk space error", multiple edelsohn-* buildbot worker are failing with: No space left on device. ---------- components: Tests messages: 375988 nosy: vstinner priority: normal severity: normal status: open title: edelsohn-* buildbot worker failing with: No space left on device versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 27 10:25:18 2020 From: report at bugs.python.org (Jani Mikkonen) Date: Thu, 27 Aug 2020 14:25:18 +0000 Subject: [New-bugs-announce] [issue41649] Can't pass Path like objects to subprocess api's on Windows. Message-ID: <1598538318.99.0.184680655713.issue41649@roundup.psfhosted.org> New submission from Jani Mikkonen : Following code: ``` from pathlib import Path import os import subprocess dir_name = os.environ.get("WORKSPACE", None) or "." output_directory = Path(dir_name) / "results" res = subprocess.run(["mytest", "--output", output_directory]) ``` Works on macos and linux but on windows, this causes "TypeError: argument of type 'WindowsPath' is not iterable" at https://github.com/python/cpython/blob/master/Lib/subprocess.py#L568 (line is different, depending on the actual python release but i guess that gives the idea where it is).. Quick test to check if i can do `" " in Path("/tmp")` on posix platforms shows the same exception but with PosixPath type but apparently this sort of check does not happen on those platforms as the example code works fine there. It would be nice to be able to pass path objects to subprocess api calls also in windows without explicitly casting the object into string before passing it as argument. ---------- components: Windows messages: 375993 nosy: paul.moore, rasjani, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Can't pass Path like objects to subprocess api's on Windows. type: behavior versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 27 12:11:57 2020 From: report at bugs.python.org (Princy katlana) Date: Thu, 27 Aug 2020 16:11:57 +0000 Subject: [New-bugs-announce] [issue41650] .pyc file not running in cross python versions Message-ID: <1598544717.94.0.558076008933.issue41650@roundup.psfhosted.org> New submission from Princy katlana : When I tried to compile the python source code from python version 3.5 and run the .pyc file on python version 3.6 then it shows the following exception: RuntimeError: Bad magic number in .pyc file ---------- components: Build messages: 376003 nosy: princykatlana priority: normal severity: normal status: open title: .pyc file not running in cross python versions type: crash versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 27 23:44:36 2020 From: report at bugs.python.org (Alex) Date: Fri, 28 Aug 2020 03:44:36 +0000 Subject: [New-bugs-announce] [issue41651] Pip: Wrong Showing of Progressbar when Downloading Modules Message-ID: <1598586276.58.0.803654971013.issue41651@roundup.psfhosted.org> New submission from Alex <2423067593 at qq.com>: 1. Abstract Command line in Windows the progress bar doesn't work like usual after about half of the downloading process. Another remarkble bug is the length of the progressbar seems to be lengthened. 2. Reason(my opinion) I noticed that this bug only happens when the rightmost character reaches the end of the cmd screen. I infer the reason of this bug from the phenomenon: when the progres bar is going to be lengthened, pip will delete the last line. Pip consider the line as an enter that the program output. However, the cmd consider the line as an enter whether it is output by the program or added by cmd itself because of the rightmost character reaches the end of the cmd screen. When pip make cmd delete the last line, pip want cmd to delete the whole progressbar, but cmd only deletes a part of the progressbar which are in the line 2. 3. Instance An instance of the bug, showing what happenred when upgrading pip via py -m pip install --upgrade pip. You can see the progress bar wasn't deleted completly. C:\Users\******>py -m pip install --upgrade pip Collecting pip Downloading pip-20.2.2-py2.py3-none-any.whl (1.5 MB) |?????????????? | 634 kB 21 kB/s eta 0:00:41 |?????????????? | 645 kB 21 kB/s eta 0:00:41 |?????????????? | 655 kB 21 kB/s eta 0:00:40 |?????????????? | 665 kB 21 kB/s eta 0:00:40 |??????????????? | 675 kB 23 kB/s eta 0:00:3 |??????????????? | 686 kB 23 kB/s eta 0:00:3 |??????????????? | 696 kB 23 kB/s eta 0:00:3 |??????????????? | 706 kB 33 kB/s eta 0:00:2 |??????????????? | 716 kB 33 kB/s eta 0:00:2 |???????????????? | 727 kB 28 kB/s eta 0:00: |???????????????? | 737 kB 28 kB/s eta 0:00: |???????????????? | 747 kB 28 kB/s eta 0:00: |???????????????? | 757 kB 23 kB/s eta 0:00: |????????????????? | 768 kB 23 kB/s eta 0:00 |????????????????? | 778 kB 23 kB/s eta 0:00 |????????????????? | 788 kB 20 kB/s eta 0:00 |????????????????? | 798 kB 20 kB/s eta 0:00 |????????????????? | 808 kB 20 kB/s eta 0:00 |?????????????????? | 819 kB 20 kB/s eta 0:0 |?????????????????? | 829 kB 20 kB/s eta 0:0 |?????????????????? | 839 kB 25 kB/s eta 0:0 |?????????????????? | 849 kB 25 kB/s eta 0:0 |?????????????????? | 860 kB 19 kB/s eta 0:0 |??????????????????? | 870 kB 19 kB/s eta 0: |??????????????????? | 880 kB 17 kB/s eta 0: |??????????????????? | 890 kB 17 kB/s eta 0: |??????????????????? | 901 kB 17 kB/s eta 0: |???????????????????? | 911 kB 17 kB/s eta 0 |???????????????????? | 921 kB 17 kB/s eta 0 |???????????????????? | 931 kB 12 kB/s eta 0 |???????????????????? | 942 kB 12 kB/s eta 0 |???????????????????? | 952 kB 12 kB/s eta 0 |????????????????????? | 962 kB 13 kB/s eta |????????????????????? | 972 kB 13 kB/s eta |????????????????????? | 983 kB 8.9 kB/s eta |????????????????????? | 993 kB 6.7 kB/s eta |?????????????????????? | 1.0 MB 6.7 kB/s et |?????????????????????? | 1.0 MB 6.7 kB/s et |?????????????????????? | 1.0 MB 6.7 kB/s et |?????????????????????? | 1.0 MB 6.7 kB/s et |?????????????????????? | 1.0 MB 8.4 kB/s et |??????????????????????? | 1.1 MB 8.4 kB/s e |??????????????????????? | 1.1 MB 8.4 kB/s e |??????????????????????? | 1.1 MB 8.8 kB/s e |??????????????????????? | 1.1 MB 8.8 kB/s e |??????????????????????? | 1.1 MB 24 kB/s et |???????????????????????? | 1.1 MB 24 kB/s e |???????????????????????? | 1.1 MB 16 kB/s e |???????????????????????? | 1.1 MB 16 kB/s e |???????????????????????? | 1.1 MB 14 kB/s e |????????????????????????? | 1.1 MB 14 kB/s |????????????????????????? | 1.2 MB 14 kB/s |????????????????????????? | 1.2 MB 14 kB/s |????????????????????????? | 1.2 MB 12 kB/s |????????????????????????? | 1.2 MB 12 kB/s |?????????????????????????? | 1.2 MB 12 kB/s |?????????????????????????? | 1.2 MB 12 kB/s |?????????????????????????? | 1.2 MB 12 kB/s |?????????????????????????? | 1.2 MB 19 kB/s |??????????????????????????? | 1.2 MB 19 kB/ |??????????????????????????? | 1.2 MB 20 kB/ |??????????????????????????? | 1.3 MB 15 kB/ |??????????????????????????? | 1.3 MB 15 kB/ |??????????????????????????? | 1.3 MB 15 kB/ |???????????????????????????? | 1.3 MB 15 kB |???????????????????????????? | 1.3 MB 20 kB |???????????????????????????? | 1.3 MB 20 kB |???????????????????????????? | 1.3 MB 14 kB |???????????????????????????? | 1.3 MB 14 kB |????????????????????????????? | 1.3 MB 14 k |????????????????????????????? | 1.4 MB 14 k |????????????????????????????? | 1.4 MB 14 k |????????????????????????????? | 1.4 MB 14 k |?????????????????????????????? | 1.4 MB 14 |?????????????????????????????? | 1.4 MB 14 |?????????????????????????????? | 1.4 MB 12 |?????????????????????????????? | 1.4 MB 9.4 |?????????????????????????????? | 1.4 MB 9.4 |??????????????????????????????? | 1.4 MB 9. |??????????????????????????????? | 1.4 MB 9. |??????????????????????????????? | 1.5 MB 9. |??????????????????????????????? | 1.5 MB 11 |????????????????????????????????| 1.5 MB 1 |????????????????????????????????| 1.5 MB 1 |????????????????????????????????| 1.5 MB 1 |????????????????????????????????| 1.5 MB 1 4 kB/s Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 20.1.1 Uninstalling pip-20.1.1: Successfully uninstalled pip-20.1.1 WARNING: The scripts pip.exe, pip3.8.exe and pip3.exe are installed in 'C:\Use rs\Administrator\AppData\Local\Programs\Python\Python38\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warn ing, use --no-warn-script-location. Successfully installed pip-20.2.2 C:\Users\******> ---------- components: Library (Lib) messages: 376017 nosy: Alex-Python-Programmer priority: normal severity: normal status: open title: Pip: Wrong Showing of Progressbar when Downloading Modules type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Aug 27 23:53:22 2020 From: report at bugs.python.org (Alex) Date: Fri, 28 Aug 2020 03:53:22 +0000 Subject: [New-bugs-announce] [issue41652] An Advice on Turning Ellipsis into Keyword Message-ID: <1598586802.42.0.262932705124.issue41652@roundup.psfhosted.org> New submission from Alex <2423067593 at qq.com>: In early versions of python, programmers can simply swap True and False by >>> True, False = False, True Then True and False and None become keywords so programmers can't change their value. ... is also a keyword, but Ellipsis is not. So the code below is right: >>> Ellipsis = 1 >>> print(Ellipsis) 1 If Ellipsis become a keyword, this will be better. ---------- components: Interpreter Core messages: 376018 nosy: Alex-Python-Programmer priority: normal severity: normal status: open title: An Advice on Turning Ellipsis into Keyword type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 28 00:40:03 2020 From: report at bugs.python.org (twoone3) Date: Fri, 28 Aug 2020 04:40:03 +0000 Subject: [New-bugs-announce] [issue41653] About the use of cpython console mode problem Message-ID: <1598589603.24.0.524762493055.issue41653@roundup.psfhosted.org> New submission from twoone3 <3197653242 at qq.com>: When I use the Py_Initialize function in cpython, the console is forced to become gbk encoding, hoping to be compatible with UTF-8 ---------- components: C API files: Screenshot_2020_0828_104656.png messages: 376019 nosy: twoone3 priority: normal severity: normal status: open title: About the use of cpython console mode problem type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file49430/Screenshot_2020_0828_104656.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 28 06:15:59 2020 From: report at bugs.python.org (Oleg Hoefling) Date: Fri, 28 Aug 2020 10:15:59 +0000 Subject: [New-bugs-announce] [issue41654] Segfault when raising MemoryError Message-ID: <1598609759.16.0.336877665683.issue41654@roundup.psfhosted.org> New submission from Oleg Hoefling : First of all, I guess this is a somewhat obscure error that is unlikely to occur in a usual context, nevertheless IMO worth reporting. We observed this when unit-testing custom exception reporting mechanism, raising different exceptions in different contexts and then analyzing whether they are processed correctly. This is a somewhat dull example I managed to extract from our tests: from pathlib import Path from unittest.mock import patch class TestException(MemoryError): pass class report_ctx: def __enter__(self): return self def __exit__(self, exc_type, exc_value, tb): report(exc_value) class raises: def __init__(self, ex): self.ex = ex def __enter__(self): return self def __exit__(self, exc_type, exc_value, tb): return issubclass(exc_type, self.ex) def report(ex): pass def error(): raise MemoryError modname = Path(__file__).stem for _ in range(10): with patch(f"{modname}.report"): with raises(MemoryError), report_ctx(): raise MemoryError with raises(TestException): raise TestException with raises(MemoryError): error() that yields: Fatal Python error: Segmentation fault Current thread 0x00007fcf0833b740 (most recent call first): File "/home/oleg.hoefling/projects/private/python-memoryerror-segfault/main.py", line 38 in File "", line 228 in _call_with_frames_removed File "", line 790 in exec_module File "", line 680 in _load_unlocked File "", line 986 in _find_and_load_unlocked File "", line 1007 in _find_and_load File "/usr/lib64/python3.9/unittest/mock.py", line 1236 in _importer File "/usr/lib64/python3.9/unittest/mock.py", line 1564 in File "/usr/lib64/python3.9/unittest/mock.py", line 1389 in __enter__ File "/home/oleg.hoefling/projects/private/python-memoryerror-segfault/main.py", line 36 in ---------- components: Interpreter Core messages: 376028 nosy: hoefling priority: normal severity: normal status: open title: Segfault when raising MemoryError type: crash versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 28 09:32:14 2020 From: report at bugs.python.org (Chrome) Date: Fri, 28 Aug 2020 13:32:14 +0000 Subject: [New-bugs-announce] [issue41655] new Node may not visited in lib2to3.refactor.RefactoringTool.traverse_by Message-ID: <1598621534.19.0.258305010682.issue41655@roundup.psfhosted.org> New submission from Chrome : `lib2to3.refactor.RefactoringTool.traverse_by` do a pre-order or post-order, and apply every candidate fixer to each node when traverse the tree. when a prior fixer add a new node that contains children, these children won't be visited by posterior fixers. ---------- components: 2to3 (2.x to 3.x conversion tool) messages: 376035 nosy: chrome priority: normal severity: normal status: open title: new Node may not visited in lib2to3.refactor.RefactoringTool.traverse_by type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 28 09:47:27 2020 From: report at bugs.python.org (Piyush Pravin) Date: Fri, 28 Aug 2020 13:47:27 +0000 Subject: [New-bugs-announce] [issue41656] Sets are storing elements in sorted order. Message-ID: <1598622447.24.0.949938355914.issue41656@roundup.psfhosted.org> New submission from Piyush Pravin : In documentation it is written that " Sets are unordered collection", but actually it is storing the elements in sorted order. ---------- assignee: docs at python components: Documentation files: dndndgndghbdgngdndgngtn.PNG messages: 376037 nosy: docs at python, piyushpravin1998 priority: normal severity: normal status: open title: Sets are storing elements in sorted order. type: resource usage versions: Python 3.7 Added file: https://bugs.python.org/file49432/dndndgndghbdgngdndgngtn.PNG _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 28 14:58:28 2020 From: report at bugs.python.org (Elian Mariano Gabriel) Date: Fri, 28 Aug 2020 18:58:28 +0000 Subject: [New-bugs-announce] [issue41657] Refactor for object source files variable in Makefile Message-ID: <1598641108.18.0.0642772004669.issue41657@roundup.psfhosted.org> New submission from Elian Mariano Gabriel : Refactoring in the Makefile is needed due a hard coded declaration to the 'OBJECT_OBJS' variable in the line 388. This hard coded declaration can be replaced by a pattern substitution function which assigns the 'OBJECT_OBJS' variable in this much simpler way: OBJECT_OBJS=$(patsubst %.c, %.o, $(wildcard Objects/*.c)) This assignment will facilitate the future builds because it is not need to add a new obj reference when created a new source code inside the 'Objects' folder. ---------- components: Build messages: 376045 nosy: ElianMariano priority: normal severity: normal status: open title: Refactor for object source files variable in Makefile type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 28 17:04:14 2020 From: report at bugs.python.org (Aliona Matveeva) Date: Fri, 28 Aug 2020 21:04:14 +0000 Subject: [New-bugs-announce] [issue41658] http.client not allowing non-ascii in headers Message-ID: <1598648654.13.0.540906759419.issue41658@roundup.psfhosted.org> New submission from Aliona Matveeva : http.client trying to decode any header with 'latin-1', which fails when there is any non-ascii symbols in it, for example, Cyrillic. I propose to check if it's non-ascii and then decode it with 'utf-8', works perfectly. ---------- components: Library (Lib) messages: 376047 nosy: yellalena priority: normal severity: normal status: open title: http.client not allowing non-ascii in headers versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 28 17:43:15 2020 From: report at bugs.python.org (Guido van Rossum) Date: Fri, 28 Aug 2020 21:43:15 +0000 Subject: [New-bugs-announce] [issue41659] PEG discrepancy on 'if {x} {a}: pass' Message-ID: <1598650995.75.0.684602655166.issue41659@roundup.psfhosted.org> New submission from Guido van Rossum : I just noticed a subtle discrepancy between the old parser and the PEG parser. Consider this syntax error: ``` if x {a}: pass ``` The old parser places the caret at the '{': ``` $ python3.8 -c 'if x { a } : pass' File "", line 1 if x { a } : pass ^ SyntaxError: invalid syntax ``` The PEG parser puts it at 'a': ``` $ python3.10 -c 'if x { a } : pass' File "", line 1 if x { a } : pass ^ SyntaxError: invalid syntax ``` I don't think we should put much effort into fixing it -- it's just a curiosity. I suspect it's got to do with some lookahead. ---------- assignee: lys.nikolaou messages: 376048 nosy: gvanrossum, lys.nikolaou priority: low severity: normal stage: needs patch status: open title: PEG discrepancy on 'if {x} {a}: pass' type: behavior versions: Python 3.10, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Aug 28 19:48:19 2020 From: report at bugs.python.org (Tim Peters) Date: Fri, 28 Aug 2020 23:48:19 +0000 Subject: [New-bugs-announce] [issue41660] multiprocessing.Manager objects lose connection info Message-ID: <1598658499.79.0.244870185265.issue41660@roundup.psfhosted.org> New submission from Tim Peters : This started on StackOverflow: https://stackoverflow.com/questions/63623651/how-to-properly-share-manager-dict-between-processes Here's a simpler program. Short course: an object of a subclass of mp.Process has an attribute of seemingly any type obtained from an mp.Manager(). The report above used a Manager.dict, and the program here a Manager.Value. When .start() is invoked, the first time that attribute is used in any way that requires communication with the Manager server, the program dies. The output below is from 3.8.5 on Windows; the report above is some Linux flavor. The tracebacks are very similar, the only obvious difference being that the implementation complains about a socket on Linux but about a named pipe on Windows. Note that there's no problem passing such things as explicit arguments to functions across processes. The loss here appears specific to the inscrutable under-the-covers pickle dance needed to create a "self" by magic on worker processes. The code: from multiprocessing import Process, Manager, Event class MyProducer(Process): def __init__(self, value, event): Process.__init__(self) self.val = value self.event = event def run(self): print("at producer start:", self.val.value) self.val.value = 42 self.event.set() class MyConsumer(Process): def __init__(self, value, event): Process.__init__(self) self.val = value self.event = event def run(self): self.event.wait() print("in consumer:", self.val.value) if __name__ == "__main__": state_value = Manager().Value('i', 666) print("at start:", state_value.value) state_ready = Event() producerprocess = MyProducer(state_value, state_ready) consumerprocess = MyConsumer(state_value, state_ready) producerprocess.start() consumerprocess.start() The output: at start: 666 Process MyProducer-2: Traceback (most recent call last): File "C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\managers.py", line 827, in _callmethod conn = self._tls.connection AttributeError: 'ForkAwareLocal' object has no attribute 'connection' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py", line 315, in _bootstrap self.run() File "C:\Code\temp.py", line 10, in run print("at producer start:", self.val.value) File "C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\managers.py", line 1154, in get return self._callmethod('get') File "C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\managers.py", line 831, in _callmethod self._connect() File "C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\managers.py", line 818, in _connect conn = self._Client(self._token.address, authkey=self._authkey) File "C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\connection.py", line 500, in Client c = PipeClient(address) File "C:\Users\Tim\AppData\Local\Programs\Python\Python38\lib\multiprocessing\connection.py", line 702, in PipeClient _winapi.WaitNamedPipe(address, 1000) FileNotFoundError: [WinError 2] The system cannot find the file specified ---------- components: Library (Lib) messages: 376051 nosy: tim.peters priority: normal severity: normal status: open title: multiprocessing.Manager objects lose connection info type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 29 02:15:05 2020 From: report at bugs.python.org (Andy Maier) Date: Sat, 29 Aug 2020 06:15:05 +0000 Subject: [New-bugs-announce] [issue41661] os.path.relpath does not document ValueError on Windows with different drives Message-ID: <1598681705.55.0.359436315051.issue41661@roundup.psfhosted.org> New submission from Andy Maier : I found that os.path.relpath() on Windows raises ValueError when the path and the start path are on different drives. This is to be expected, as there is no single root on Windows. On Python 3.7, the behavior is: >>> os.path.relpath('c:/abc', 'a:/') Traceback (most recent call last): File "", line 1, in File "...\Python\Python37\lib\ntpath.py", line 564, in relpath path_drive, start_drive)) ValueError: path is on mount 'c:', start on mount 'a:' The issue is that this ValueError and the reasons for it are not mentioned at all in the documentation for os.path.relpath(). Other os.path functions do document specific behaviors for different drives on Windows, for example os.path.commonpath(), so there is a precedence for documenting this. Also, it should be normal to document the possible exceptions that can be raised. I did read https://bugs.python.org/issue7195 from 2009 where the original issue discussed also lead to a request to update the documentation of os.path.relpath() to show the ValueError for this case, but that angle of the issue ended up being ignored back then, unfortunately. My suggestion is to add something like the following sentence the documentation: "On Windows, ValueError is raised when path and start are on different drives." ---------- assignee: docs at python components: Documentation messages: 376057 nosy: andymaier, docs at python priority: normal severity: normal status: open title: os.path.relpath does not document ValueError on Windows with different drives versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 29 09:05:08 2020 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 29 Aug 2020 13:05:08 +0000 Subject: [New-bugs-announce] [issue41662] Bugs in binding parameters in sqlite3 Message-ID: <1598706308.83.0.197807583291.issue41662@roundup.psfhosted.org> New submission from Serhiy Storchaka : There are few bugs in the code for binding parameters specified in the sqlite3 module: 1. If argument "parameters" is a list, PyList_GET_ITEM() is called in a loop, but the size of the list is read only once before loop. Since the list can be changed during iteration, it can cause reading past the end of the list. 2. If argument "parameters" is a custom sequence, all exceptions raised in __len__() (including KeybordInterrupt) are overridden by a ProgrammingError. ---------- components: Extension Modules messages: 376062 nosy: BTaskaya, ghaering, serhiy.storchaka priority: normal severity: normal status: open title: Bugs in binding parameters in sqlite3 type: behavior versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 29 14:28:07 2020 From: report at bugs.python.org (Chad Smith) Date: Sat, 29 Aug 2020 18:28:07 +0000 Subject: [New-bugs-announce] [issue41663] Support Windows pseudoterminals in pty and termios modules Message-ID: <1598725687.47.0.96007277971.issue41663@roundup.psfhosted.org> New submission from Chad Smith : The pty and termios modules do not support Windows. Current Python pty documentation suggest Windows might be supported: > The Linux code is supposed to work on other platforms, but hasn?t been tested yet. but I have confirmed that it is not while adding pty usage to gdbgui. The new Windows Psuedo Console, ConPTY, available in Windows 10, now makes this possible. Proof of existence of a common pty interface for all platforms exists for node with the node-pty npm package, which uses ConPTY. References: * ConPTY information, https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/ * Example ConPTY usage, https://github.com/microsoft/terminal/blob/master/samples/ConPTY/EchoCon/EchoCon/EchoCon.cpp * node-pty, https://github.com/Microsoft/node-pty * Python pty docs, https://docs.python.org/3/library/pty.html * gdbgui Windows pty issue, https://github.com/cs01/gdbgui/issues/348 ---------- messages: 376071 nosy: cs01, steve.dower priority: normal severity: normal status: open title: Support Windows pseudoterminals in pty and termios modules _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Aug 29 17:47:33 2020 From: report at bugs.python.org (Anit Rajpurohit) Date: Sat, 29 Aug 2020 21:47:33 +0000 Subject: [New-bugs-announce] [issue41664] re.sub does NOT substitute all the matching patterns when re.IGNORECASE is used Message-ID: <1598737653.28.0.435333490934.issue41664@roundup.psfhosted.org> New submission from Anit Rajpurohit : Usage of re flags leads to inconsistent results when 1. The pattern directly used in re.sub 2. The pattern is re.compile'd and used Note 1: Input string is all in the lowercase 'all is fair in love and war' Note 2: Results are always consistent in case of re.compile'd pattern ======================================= 1. The pattern directly used in re.sub ======================================= >>> import re >>> re.sub(r'[aeiou]', '#', 'all is fair in love and war') '#ll #s f##r #n l#v# #nd w#r' >>> >>> re.sub(r'[aeiou]', '#', 'all is fair in love and war', re.IGNORECASE) '#ll #s fair in love and war' >>> >>> re.sub(r'[aeiou]', '#', 'all is fair in love and war', re.IGNORECASE|re.DOTALL) '#ll #s f##r #n l#v# #nd w#r' >>> >>> ======================================= 2. The pattern is re.compile'd and used ======================================= >>> pattern = re.compile(r'[aeiou]', re.IGNORECASE) >>> re.sub(pattern, '#', 'all is fair in love and war') '#ll #s f##r #n l#v# #nd w#r' >>> >>> pattern = re.compile(r'[aeiou]') >>> re.sub(pattern, '#', 'all is fair in love and war') '#ll #s f##r #n l#v# #nd w#r' >>> >>> pattern = re.compile(r'[aeiou]', re.IGNORECASE | re.DOTALL) >>> re.sub(pattern, '#', 'all is fair in love and war') '#ll #s f##r #n l#v# #nd w#r' ---------- components: Regular Expressions messages: 376083 nosy: anitrajpurohit28, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: re.sub does NOT substitute all the matching patterns when re.IGNORECASE is used type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 30 02:06:34 2020 From: report at bugs.python.org (Damien Ruiz) Date: Sun, 30 Aug 2020 06:06:34 +0000 Subject: [New-bugs-announce] [issue41665] Function called Message-ID: <1598767594.85.0.0689417039156.issue41665@roundup.psfhosted.org> Change by Damien Ruiz : ---------- nosy: x_0euf priority: normal severity: normal status: open title: Function called _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 30 08:22:16 2020 From: report at bugs.python.org (M-o-T) Date: Sun, 30 Aug 2020 12:22:16 +0000 Subject: [New-bugs-announce] [issue41666] Problem in tutorial/introduction.html#strings Message-ID: <1598790136.78.0.89811884777.issue41666@roundup.psfhosted.org> New submission from M-o-T : Hi, I found a problem with this address https://docs.python.org/3/tutorial/introduction.html#strings In here >>> word[0:2] # characters from position 0 (included) to 2 (excluded) 'Py' >>> word[2:5] # characters from position 2 (included) to 5 (excluded) 'tho' In the second example word[2:5] becomes 'hto' ---------- messages: 376104 nosy: mohammadtavakoli1378 priority: normal severity: normal status: open title: Problem in tutorial/introduction.html#strings versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 30 16:08:36 2020 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Sun, 30 Aug 2020 20:08:36 +0000 Subject: [New-bugs-announce] [issue41667] The python PEG generator incorrectly handles empty sequences in gather rules Message-ID: <1598818116.29.0.0798714458289.issue41667@roundup.psfhosted.org> New submission from Pablo Galindo Salgado : Currently, empty sequences in gather rules make the conditional for gather rules fail as empty sequences evaluate as "False". We need to explicitly check for "None" (the failure condition) to avoid false negatives. ---------- messages: 376129 nosy: pablogsal priority: normal severity: normal status: open title: The python PEG generator incorrectly handles empty sequences in gather rules versions: Python 3.10, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 30 16:15:17 2020 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Sun, 30 Aug 2020 20:15:17 +0000 Subject: [New-bugs-announce] [issue41668] Expose eventfd for high-performance event notifier in Linux Message-ID: <1598818517.47.0.408259765239.issue41668@roundup.psfhosted.org> New submission from Pablo Galindo Salgado : The eventfd system calls can allow us to implement some Linux-specific high performance version of some event notifier abstractions in the standard library. eventfd() creates an "eventfd object" that can be used as an event wait/notify mechanism by user-space applications. The object contains an unsigned 64-bit integer counter that is maintained by the kernel. This acts as a file descriptor that can be used by the usual suspects (read/write/poll/close...). The advantage here is that the kernel maintains the counter and if used in conjunction with poll/epoll, it allows for a high-performance and scallabe event notification system. ---------- components: IO, Library (Lib) messages: 376130 nosy: pablogsal priority: normal severity: normal status: open title: Expose eventfd for high-performance event notifier in Linux versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 30 17:48:06 2020 From: report at bugs.python.org (Gregory Szorc) Date: Sun, 30 Aug 2020 21:48:06 +0000 Subject: [New-bugs-announce] [issue41669] Case mismatch between "include" and "Include" Message-ID: <1598824086.3.0.112428112748.issue41669@roundup.psfhosted.org> New submission from Gregory Szorc : On Windows, `sysconfig.get_path('include')` returns `Include` (capital I). However, the actual installation path is `include` (lowercase i). I believe the reason for the case mismatch is in this code in PC/layout/main.py: ``` if ns.include_dev: for dest, src in rglob(ns.source / "Include", "**/*.h"): yield "include/{}".format(dest), src src = ns.source / "PC" / "pyconfig.h" yield "include/pyconfig.h", src ``` The case mismatch is relevant for case sensitive filesystems. In my case, I was extracting a Windows Python install on Linux and then using the `sysconfig` value to locate directories within that install. Due to the case mismatch, Linux says `Include` doesn't exist since `sysconfig` points to "include." Case only renames can be a bit wonky to perform. I would suggest preserving what is shipped today and changing `sysconfig` to advertise lowercase "include." However, this would create a mismatch between the cpython source repo and built distributions. So maybe attempting the case-only rename is doable. Note that Windows will not allow you to have a file/directory varying only in case. i.e. you can have both an "include" and "Include." I can't recall if you can perform a case-only rename with a single system call (meaning it is atomic) or whether you need to go through a temporary directory. ---------- components: Windows messages: 376131 nosy: indygreg, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Case mismatch between "include" and "Include" type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 30 18:49:31 2020 From: report at bugs.python.org (Ned Batchelder) Date: Sun, 30 Aug 2020 22:49:31 +0000 Subject: [New-bugs-announce] [issue41670] Windows and Linux execute the same code differently Message-ID: <1598827771.16.0.682087136522.issue41670@roundup.psfhosted.org> New submission from Ned Batchelder : Coverage.py bug reports https://github.com/nedbat/coveragepy/issues/1022 and https://github.com/nedbat/coveragepy/issues/959 demonstrate the same Python code, with the same disassembly, executing differently. In https://discuss.python.org/t/same-python-version-different-optimizations-on-different-os/5098, Ammar Askar said: > For any core developer who wants to look into this, based on my preliminary research this seems to be related to opcode prediction and computed GOTOS. > > If you put #define USE_COMPUTED_GOTOS 0 above https://github.com/python/cpython/blob/master/Python/ceval.c#L1033 then this issue is re-creatable on Linux/Mac. > > It seems to be an issue relating to how f_lasti is updated. ---------- components: Interpreter Core keywords: 3.8regression messages: 376135 nosy: nedbat priority: normal severity: normal status: open title: Windows and Linux execute the same code differently type: behavior versions: Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Aug 30 18:53:18 2020 From: report at bugs.python.org (RalfM) Date: Sun, 30 Aug 2020 22:53:18 +0000 Subject: [New-bugs-announce] [issue41671] inspect.getdoc/.cleandoc doesn't always remove trailing blank lines Message-ID: <1598827998.17.0.2637020471.issue41671@roundup.psfhosted.org> New submission from RalfM : Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import inspect >>> def func1(): ... """This is func1. ... """ ... pass ... >>> inspect.getdoc(func1) 'This is func1.\n ' >>> >>> def func2(): ... """Line1 ... Line2 ... ... """ ... >>> inspect.getdoc(func2) 'Line1\nLine2 \n \n ' Note: The blank line between "Line2 " and the closing """ contains 11 spaces. The algorithm given in PEP 257 returns what I would expect, i.e. 'This is func1.' and 'Line1\nLine2' respectively. Strictly speaking, inspect.cleandoc doesn't claim to implement PEP 257. However, there is a comment "# Remove any trailing or leading blank lines." in the code of inspect.cleandoc, and this is obviously not done. Looking at the code, the reason seems to be twofold: 1. When removing the indentation, PEP 257 also does a .rstrip() on the lines, inspect.cleandoc doesn't. As a consequence, in inspect.cleandoc trailing lines with many spaces will still contain spaces after the indentation has been removed, thus are not empty and the "while lines and not lines[-1]" doesn't remove them. That explains func2 above. 2. If all lines but the first are blank (as in func1 above), indent / margin will be sys.maxint / sys.maxsize and no indentation will be removed. PEP 257 copies dedented lines to a new list. If no indentation needs to be removed, nothing but the first line will be copied, and so the trailing lines are gone. inspect.cleandoc dedents lines inplace. If no indentation needs to be removed the trailing lines with spaces remain and, as they contain spaces, the "while lines and not lines[-1]" doesn't remove them. There is another difference between PEP 257 and inspect.cleandoc: PEP 257 removes trailing whitespace on every line, inspect.cleandoc preserves it. I don't know whether that's intentional. I see this behaviour in 3.7 and 3.8, and the inspect.cleandoc code is unchanged in 3.9.0rc1. ---------- components: Library (Lib) messages: 376136 nosy: RalfM priority: normal severity: normal status: open title: inspect.getdoc/.cleandoc doesn't always remove trailing blank lines type: behavior versions: Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 05:41:11 2020 From: report at bugs.python.org (Norbert Cyran) Date: Mon, 31 Aug 2020 09:41:11 +0000 Subject: [New-bugs-announce] [issue41672] imaplib: wrong return type documented Message-ID: <1598866871.14.0.71273864789.issue41672@roundup.psfhosted.org> New submission from Norbert Cyran : Documentation on IMAP4 class specifies wrong return type of its commands: Each command returns a tuple: (type, [data, ...]) where type is usually 'OK' or 'NO', and data is either the text from the command response, or mandated results from the command. Each data is either a string, or a tuple. If a tuple, then the first part is the header of the response, and the second part contains the data (ie: ?literal? value). That's not valid for Python 3, as IMAP4 commands return bytes-like objects in data, what's shown in the example before:: >>> from imaplib import IMAP4 >>> with IMAP4("domain.org") as M: ... M.noop() ... ('OK', [b'Nothing Accomplished. d25if65hy903weo.87']) That of course can cause a lot of trouble due to incompatibility of strings and bytes. Suggested change is to replace string occurences to bytes-like object. I don't know what types are returned in case when tuple is returned though. ---------- assignee: docs at python components: Documentation messages: 376143 nosy: docs at python, norbertcyran priority: normal severity: normal status: open title: imaplib: wrong return type documented versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 08:56:22 2020 From: report at bugs.python.org (Eric Wieser) Date: Mon, 31 Aug 2020 12:56:22 +0000 Subject: [New-bugs-announce] [issue41673] Result of multiprocessing.heap.BufferWrapper.create_memoryview can point to freed memory Message-ID: <1598878582.68.0.23646842714.issue41673@roundup.psfhosted.org> New submission from Eric Wieser : The full definition of `multiprocessing.heap.BufferWrapper` is: class BufferWrapper(object): _heap = Heap() def __init__(self, size): if size < 0: raise ValueError("Size {0:n} out of range".format(size)) if sys.maxsize <= size: raise OverflowError("Size {0:n} too large".format(size)) block = BufferWrapper._heap.malloc(size) self._state = (block, size) util.Finalize(self, BufferWrapper._heap.free, args=(block,)) def create_memoryview(self): (arena, start, stop), size = self._state return memoryview(arena.buffer)[start:start+size] But this means that a `memoryview` can be constructed that point to free'd "memory", >>> b = BufferWrapper(10) >>> m = b.create_memoryview() >>> del b # free is called >>> b[0] # making this invalid It would be better if `m` would keep a reference to `b` so that it remains alive. `RawArray` works around this by placing a reference to `b` in `ctypes_obj._wrapper`, but this results in `b` being lost again if `m2 = memoryview(ctypes_obj); del ctypes_obj` is used. ---------- components: Library (Lib), ctypes messages: 376149 nosy: Eric Wieser priority: normal severity: normal status: open title: Result of multiprocessing.heap.BufferWrapper.create_memoryview can point to freed memory versions: Python 3.10, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 09:15:37 2020 From: report at bugs.python.org (Emmanuel Arias) Date: Mon, 31 Aug 2020 13:15:37 +0000 Subject: [New-bugs-announce] [issue41674] Doc tests failing for many PRs on GitHub Message-ID: <1598879737.34.0.734115433925.issue41674@roundup.psfhosted.org> New submission from Emmanuel Arias : Hi, This issue was reported by Mark Shannon on Python-dev mailing list Seems that there's an issue on doc build on Github pipeline https://github.com/python/cpython/pull/22026/checks?check_run_id=1050881634 https://github.com/python/cpython/pull/22025/checks?check_run_id=1050403463 ---------- messages: 376151 nosy: eamanu priority: normal severity: normal status: open title: Doc tests failing for many PRs on GitHub versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 09:51:22 2020 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Mon, 31 Aug 2020 13:51:22 +0000 Subject: [New-bugs-announce] [issue41675] Modernize siginterrupt calls Message-ID: <1598881882.83.0.824642954099.issue41675@roundup.psfhosted.org> New submission from Pablo Galindo Salgado : siginterrupt is deprecated: ./Modules/signalmodule.c:667:5: warning: ?siginterrupt? is deprecated: Use sigaction with SA_RESTART instead [-Wdeprecated-declarations] 667 | if (siginterrupt(signalnum, flag)<0) { ---------- messages: 376152 nosy: pablogsal priority: normal severity: normal status: open title: Modernize siginterrupt calls versions: Python 3.10, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 09:54:37 2020 From: report at bugs.python.org (Thomas Grainger) Date: Mon, 31 Aug 2020 13:54:37 +0000 Subject: [New-bugs-announce] [issue41676] asyncio.Event.wait broken link from asyncio.Event Message-ID: <1598882077.33.0.587005753181.issue41676@roundup.psfhosted.org> New submission from Thomas Grainger : https://docs.python.org/dev/library/asyncio-sync.html#asyncio.Event links to https://docs.python.org/dev/library/asyncio-task.html#asyncio.wait instead of https://docs.python.org/dev/library/asyncio-sync.html#asyncio.Event.wait ---------- assignee: docs at python components: Documentation messages: 376153 nosy: docs at python, graingert priority: normal severity: normal status: open title: asyncio.Event.wait broken link from asyncio.Event versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 11:29:10 2020 From: report at bugs.python.org (Michael Pelletier) Date: Mon, 31 Aug 2020 15:29:10 +0000 Subject: [New-bugs-announce] [issue41677] os.access() doesn't recognize lack of permissions on an SMB mountpoint Message-ID: <1598887750.34.0.874039613548.issue41677@roundup.psfhosted.org> New submission from Michael Pelletier : This emerged during a fault in a fileserver mounted on a Linux machine via a Samba client mount. The access to the mountpoint was being blocked by the fileserver, but os.access() wasn't able to recognize it as unreadable: >>> os.access('/opt/xray', os.R_OK) True >>> s = os.stat('/opt/xray') Traceback (most recent call last): File "", line 1, in PermissionError: [Errno 13] Permission denied: '/opt/xray' >>> Python version is 3.6.8. ---------- components: IO messages: 376156 nosy: mvpel priority: normal severity: normal status: open title: os.access() doesn't recognize lack of permissions on an SMB mountpoint type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 12:01:22 2020 From: report at bugs.python.org (Platon workaccount) Date: Mon, 31 Aug 2020 16:01:22 +0000 Subject: [New-bugs-announce] [issue41678] File-level, optionally external sorting Message-ID: <1598889682.73.0.396107473033.issue41678@roundup.psfhosted.org> New submission from Platon workaccount : Feature request: a convenient sorter of whole files with the possibility of disk usage. Here's the syntax in my mind: shutil.sort(src, dst, headers=0, key=None, reverse=False, allow_disk_use=False) ---------- messages: 376157 nosy: platon.work priority: normal severity: normal status: open title: File-level, optionally external sorting type: enhancement versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 12:11:52 2020 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Mon, 31 Aug 2020 16:11:52 +0000 Subject: [New-bugs-announce] [issue41679] Deprecation warning due to invalid escape sequences in Doc/tools/extensions/peg_highlight.py Message-ID: <1598890312.99.0.135296062189.issue41679@roundup.psfhosted.org> New submission from Karthikeyan Singaravelan : Following warnings are caused in Doc/tools/extensions/peg_highlight.py . These warnings show up during doc builds since the extension is used in the build. This is an easy issue to fix. ./python -Wall -m py_compile /root/cpython/Doc/tools/extensions/peg_highlight.py /root/cpython/Doc/tools/extensions/peg_highlight.py:62: DeprecationWarning: invalid escape sequence \s r"^\s*" + _name + "\s*" + "(\[.*\])?" + "\s*" + "(\(.+\))?" + "\s*(:)", /root/cpython/Doc/tools/extensions/peg_highlight.py:62: DeprecationWarning: invalid escape sequence \[ r"^\s*" + _name + "\s*" + "(\[.*\])?" + "\s*" + "(\(.+\))?" + "\s*(:)", /root/cpython/Doc/tools/extensions/peg_highlight.py:62: DeprecationWarning: invalid escape sequence \s r"^\s*" + _name + "\s*" + "(\[.*\])?" + "\s*" + "(\(.+\))?" + "\s*(:)", /root/cpython/Doc/tools/extensions/peg_highlight.py:62: DeprecationWarning: invalid escape sequence \( r"^\s*" + _name + "\s*" + "(\[.*\])?" + "\s*" + "(\(.+\))?" + "\s*(:)", /root/cpython/Doc/tools/extensions/peg_highlight.py:62: DeprecationWarning: invalid escape sequence \s r"^\s*" + _name + "\s*" + "(\[.*\])?" + "\s*" + "(\(.+\))?" + "\s*(:)", ---------- components: Build messages: 376158 nosy: pablogsal, xtreak priority: normal severity: normal status: open title: Deprecation warning due to invalid escape sequences in Doc/tools/extensions/peg_highlight.py type: behavior versions: Python 3.10 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 14:24:37 2020 From: report at bugs.python.org (Weyl) Date: Mon, 31 Aug 2020 18:24:37 +0000 Subject: [New-bugs-announce] [issue41680] Turtles in Python 3.8.5 crashes OSX 10.14.6 Message-ID: <1598898277.27.0.605010219391.issue41680@roundup.psfhosted.org> New submission from Weyl : The following python sequence will crash OSX 10.14.6 and Python 3.8 import turtle theScreen=turtle.Screen() mertle=turtle.Turtle() ---------- components: macOS messages: 376159 nosy: dulcimoo, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Turtles in Python 3.8.5 crashes OSX 10.14.6 versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 14:40:25 2020 From: report at bugs.python.org (Hanish) Date: Mon, 31 Aug 2020 18:40:25 +0000 Subject: [New-bugs-announce] [issue41681] f-string error description seems wrong Message-ID: <1598899225.8.0.488933679404.issue41681@roundup.psfhosted.org> New submission from Hanish : There seems to an error in the `f-string` error description when one do: >>> f'{1:,,}' Traceback (most recent call last): File "", line 1, in ValueError: Cannot specify both ',' and '_'. >>> The error seems to be that, i am not specifying both ',' and '_', but it does seem to think so. This also seems to be happening for `str.format`: >>> '{:,,}'.format(1) Traceback (most recent call last): File "", line 1, in ValueError: Cannot specify both ',' and '_'. So i was just wondering if this is an issue worth raising :) Thank you ---------- components: Interpreter Core messages: 376160 nosy: eric.smith, han-solo priority: normal severity: normal status: open title: f-string error description seems wrong 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 Mon Aug 31 21:20:55 2020 From: report at bugs.python.org (Kyle Stanley) Date: Tue, 01 Sep 2020 01:20:55 +0000 Subject: [New-bugs-announce] [issue41682] test_asyncio: Proactor Message-ID: <1598923255.6.0.989955407462.issue41682@roundup.psfhosted.org> Change by Kyle Stanley : ---------- nosy: aeros priority: normal severity: normal status: open title: test_asyncio: Proactor _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Aug 31 22:55:56 2020 From: report at bugs.python.org (Prasanth R) Date: Tue, 01 Sep 2020 02:55:56 +0000 Subject: [New-bugs-announce] [issue41683] Python3: Installation error on Ubunti-18 Message-ID: <1598928956.49.0.0670717412104.issue41683@roundup.psfhosted.org> New submission from Prasanth R : Got this error on Ubuntu-18 alone ``` _PYTHON_PROJECT_BASE=python3-3.8.3/Python-3.8.3 _PYTHON_HOST_PLATFORM=linux-x86_64 PYTHONPATH=python3-3.8.3/Python-3.8.3/build/lib.linux-x86_64-3.8/sysconfigdata:./Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__linux_x86_64-linux-gnu python3.8 -m ensurepip \ $ensurepip --root=toolchain/ ; \ fi ERROR: Exception: Traceback (most recent call last): File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py", line 188, in main status = self.run(options, args) File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_internal/commands/install.py", line 286, in run with self._build_session(options) as session: File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py", line 101, in _build_session session = PipSession( File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_internal/download.py", line 559, in __init__ self.headers["User-Agent"] = user_agent() File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_internal/download.py", line 144, in user_agent zip(["name", "version", "id"], distro.linux_distribution()), File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 122, in linux_distribution return _distro.linux_distribution(full_distribution_name) File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 677, in linux_distribution self.version(), File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 737, in version self.lsb_release_attr('release'), File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 899, in lsb_release_attr return self._lsb_release_info.get(attribute, '') File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 552, in __get__ ret = obj.__dict__[self._fname] = self._f(obj) File "/tmp/tmp48him7rr/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 1012, in _lsb_release_info stdout = subprocess.check_output(cmd, stderr=devnull) File "python3-3.8.3/Python-3.8.3/Lib/subprocess.py", line 411, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "python3-3.8.3/Python-3.8.3/Lib/subprocess.py", line 512, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1. Makefile:1189: recipe for target 'install' failed make[1]: *** [install] Error 2 make[1]: Leaving directory 'python3-3.8.3/Python-3.8.3' ``` ---------- components: Build messages: 376177 nosy: prasanth priority: normal severity: normal status: open title: Python3: Installation error on Ubunti-18 type: compile error versions: Python 3.8 _______________________________________ Python tracker _______________________________________