[issue43416] Add README files in Include/cpython and Include/internal

2021-03-06 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : I always hesitate in what subdirectory of Include/ to add a declaration of new private API. What is more "private"? It would be nice to add README files in these directories which describe what API should be declared here and what is the difference betwe

[issue42128] Structural Pattern Matching (PEP 634)

2021-03-06 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- pull_requests: +23539 pull_request: https://github.com/python/cpython/pull/24771 ___ Python tracker ___ _

[issue43415] Typo

2021-03-06 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue43417] ast.unparse: Simplify buffering logic

2021-03-06 Thread Batuhan Taskaya
New submission from Batuhan Taskaya : Currently, buffer is just an instance-level list that is used in various places to avoid directly writing stuff into the real source buffer, though the design is pretty complicated and hard to use. There are various use cases (like omitting the empty spac

[issue43417] ast.unparse: Simplify buffering logic

2021-03-06 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- keywords: +patch pull_requests: +23540 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24772 ___ Python tracker ___

[issue43391] The comments have invalid license information (broken Python 2.4 URL for Python 3)

2021-03-06 Thread Marc-Andre Lemburg
Change by Marc-Andre Lemburg : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ __

[issue43418] FTPLib module crashes when server returns byte message instead of string

2021-03-06 Thread Hugo Chia
New submission from Hugo Chia : https://github.com/cowrie/cowrie/issues/1394 https://github.com/cowrie/cowrie/pull/1396 Above are some of the links mentioning the issue with the FTPLib module. It happens when the FTP server returns a byte message instead of a string. Ftplib expects a string

[issue43419] contextvars does not work properly in asyncio REPL.

2021-03-06 Thread Lanfon
New submission from Lanfon : Demonstration (via python -m asyncio): asyncio REPL 3.9.0 (default, Oct 18 2020, 00:21:26) [Clang 11.0.0 (clang-1100.0.33.16)] on darwin Use "await" directly instead of "asyncio.run()". Type "help", "copyright", "credits" or "license" for more information. >>> impo

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Sergey B Kirpichev
New submission from Sergey B Kirpichev : fractions.py uses naive algorithms for doing arithmetics. It may worth implementing less trivial versions for addtion/substraction and multiplication (e.g. Henrici algorithm and so on), described here: https://www.eecis.udel.edu/~saunders/courses/822/98f

[issue43421] os.device_encoding(fd) should support any console fd in Windows

2021-03-06 Thread Eryk Sun
New submission from Eryk Sun : In Windows, os.device_encoding() is hard coded to map file descriptor 0 and descriptors 1 and 2 respectively to the console's input and output code page if isatty(fd) is true. But isatty() is true for any character device, such as "NUL". Also any fd might be a c

[issue43419] contextvars does not work properly in asyncio REPL.

2021-03-06 Thread Lanfon
Change by Lanfon : -- keywords: +patch pull_requests: +23541 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24773 ___ Python tracker ___ _

[issue43406] Possible race condition between signal catching and signal.signal

2021-03-06 Thread miss-islington
miss-islington added the comment: New changeset 4715be8a4384159e47fb09e5f3bd077734842655 by Antoine Pitrou in branch '3.8': [3.8] bpo-43406: Fix possible race condition where ``PyErr_CheckSignals`` tries to execute a non-Python signal handler (GH-24756) (GH-24762) https://github.com/python/c

[issue43406] Possible race condition between signal catching and signal.signal

2021-03-06 Thread miss-islington
miss-islington added the comment: New changeset 1385f8355a036fd65aaf9c7e7ab48467ca922bcf by Miss Islington (bot) in branch '3.9': [3.9] bpo-43406: Fix possible race condition where ``PyErr_CheckSignals`` tries to execute a non-Python signal handler (GH-24756) (GH-24761) https://github.com/py

[issue43406] Possible race condition between signal catching and signal.signal

2021-03-06 Thread Antoine Pitrou
Change by Antoine Pitrou : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ __

[issue43332] Make http.client._tunnel send one byte string over the network

2021-03-06 Thread Zveinn
Zveinn added the comment: Hey! First of all, thank you for not shitting all over me <3 I have never really used python and the only reason I found this is because I was developing a tool that accepted a LOT of CONNECT requests for python and I just happened to stumble upon this little nug

[issue43422] Revert _decimal C API changes

2021-03-06 Thread Antoine Pitrou
New submission from Antoine Pitrou : Stefan Krah (who doesn't have access rights here, and is the author of the C _decimal module) asked me to transmit me this request: """ The capsule API does not meet my testing standards, since I've focused on the upstream mpdecimal in the last couple of mon

[issue41369] Update to libmpdec-2.5.1

2021-03-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: Stefan wrote me that the changes which complete this update are here: https://github.com/python/cpython/compare/master...skrah:libmpdec-2.5.1 I can turn this diff into a PR but first I want to gather feedback here. Mark, Serhiy, Raymond, what do you say? --

[issue43413] tuple subclasses allow kwargs

2021-03-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Hmm, but in my experience, tuple on Python 3.6 doesn't take keyword arguments > either: They do. >>> tuple(sequence='abc') ('a', 'b', 'c') >>> list(sequence='abc') ['a', 'b', 'c'] >>> int(x='123') 123 >>> bool(x='123') True >>> float(x='123') 123.0 It

[issue14841] os.get_terminal_size() should check stdin as a fallback

2021-03-06 Thread Eryk Sun
Change by Eryk Sun : -- components: +Extension Modules, Library (Lib) versions: +Python 3.10, Python 3.9 -Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker ___

[issue30295] msvcrt SetErrorMode not documented

2021-03-06 Thread Eryk Sun
Change by Eryk Sun : -- components: +Library (Lib) type: -> enhancement versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker

[issue43422] Revert _decimal C API changes

2021-03-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: +1 fron me. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2021-03-06 Thread Eryk Sun
Eryk Sun added the comment: The solution for bpo-36779 changed init_timezone() to get tzname directly from WinAPI GetTimeZoneInformation(). Unfortunately the implementer didn't think to also support time.tzset(), so the value may be stale with no way to refresh it, or possibly different fro

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: Here's some code to try out: from math import gcd from fractions import Fraction import operator import math class Henrici(Fraction): 'Reformulate _mul to reduce the size of intermediate products' # Original has 2 multiplications, 1 gcd calls, and

[issue37771] No equivalent of `inspect.getcoroutinestate` for PyAsyncGenASend instances

2021-03-06 Thread Thomas Grainger
Change by Thomas Grainger : -- nosy: +alex.gronholm, graingert ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43245] Add keyword argument support to ChainMap.new_child()

2021-03-06 Thread Kamil Turek
Change by Kamil Turek : -- nosy: +kamilturek ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue43423] Subprocess IndexError possible in _communicate

2021-03-06 Thread Chris Griffith
New submission from Chris Griffith : It is possible to run into an IndexError in the subprocess module's _communicate function. ``` return run( File "subprocess.py", line 491, in run File "subprocess.py", line 1024, in communicate File "subprocess.py", line 1418, in _communicate Inde

[issue43423] Subprocess IndexError possible in _communicate

2021-03-06 Thread Chris Griffith
Change by Chris Griffith : -- keywords: +patch pull_requests: +23542 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24777 ___ Python tracker ___ _

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: Note that Fraction arithmetic has a huge administrative overhead. The cost of the underlying multiplications and divisions won't dominate the total time until the numerators and denominators are very large. For the proposed optimization, this implies that

[issue43423] Subprocess IndexError possible in _communicate

2021-03-06 Thread Eryk Sun
Eryk Sun added the comment: The presumption I suppose is that these statements only execute if self.stdout_thread and/or self.stderr_thread completes successfully. I suppose that the read could fail or get canceled via CancelSynchronousIo(). Of course in that case you have a bigger problem t

[issue43216] Removal of @asyncio.coroutine in Python 3.10

2021-03-06 Thread Thomas Grainger
Change by Thomas Grainger : -- nosy: +graingert ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: The cost to the common case for small components is about 20%: $ python3.10 -m timeit -r11 -s 'from fractions import Fraction as F' -s 'a=F(10,3)' -s 'b=F(6, 5)' 'a * b' 20 loops, best of 11: 1.8 usec per loop $ python3.10 -m timeit -r11 -s 'from patc

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: Without the guards the incremental cost drops to 10%. $ python3.10 -m timeit -r11 -s 'from patched_noguards import Fraction as F' -s 'a=F(10,3)' -s 'b=F(6, 5)' 'a * b' 10 loops, best of 11: 2.02 usec per loop -- __

[issue43372] ctypes: test_frozentable fails when make regen-frozen

2021-03-06 Thread Neil Schemenauer
Neil Schemenauer added the comment: New changeset 87ec26b812e9c4095c017dc60f246eda37b83ab2 by Neil Schemenauer in branch 'master': bpo-43372: Use _freeze_importlib for regen-frozen. (GH-24759) https://github.com/python/cpython/commit/87ec26b812e9c4095c017dc60f246eda37b83ab2 --

[issue43372] ctypes: test_frozentable fails when make regen-frozen

2021-03-06 Thread Neil Schemenauer
Change by Neil Schemenauer : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42246] Implement PEP 626 -- Precise line numbers for debugging

2021-03-06 Thread Neil Schemenauer
Neil Schemenauer added the comment: New changeset 87ec26b812e9c4095c017dc60f246eda37b83ab2 by Neil Schemenauer in branch 'master': bpo-43372: Use _freeze_importlib for regen-frozen. (GH-24759) https://github.com/python/cpython/commit/87ec26b812e9c4095c017dc60f246eda37b83ab2 --

[issue40982] copytree example in shutil

2021-03-06 Thread Zackery Spytz
Change by Zackery Spytz : -- keywords: +patch nosy: +ZackerySpytz nosy_count: 3.0 -> 4.0 pull_requests: +23543 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24778 ___ Python tracker

[issue43424] Document the `controller.name` field in `webbrowser` module

2021-03-06 Thread Ilya Grigoriev
New submission from Ilya Grigoriev : The object `webbrowser.get()` returns has, and had for a long time, a useful but undocumented field `name`. I wonder if it would be OK to document it as something like `a system-dependent name for the browser`. This would go here: https://docs.python.org/3

[issue29982] tempfile.TemporaryDirectory fails to delete itself

2021-03-06 Thread C.A.M. Gerlach
C.A.M. Gerlach added the comment: In addition to transient failures, this can also occur when, for example, files opened in the temporary directory (perhaps by library or application code not under direct control of the caller) haven't been properly cleaned up and their file handles don't ge

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2021-03-06 Thread C.A.M. Gerlach
C.A.M. Gerlach added the comment: To note, the proposal on [BPO-29982](https://bugs.python.org/issue29982) should hopefully address one of the two use-cases described by Anthony Sotittle, `ignore_errors=True`, in a cleaner fashion that takes advantage of the existing higher-level functionali

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: I have similar timings (for a draft version of PR, see f.patch) as for the last comment, though the small-dens overhead seems to be bigger(~20%): $ python3.10 -m timeit -r11 -s 'from fractions import Fraction as F' -s 'a=F(10,3)' -s 'b=F(6, 5)' 'a * b' 50

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- pull_requests: +23544 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24779 ___ Python tracker ___ __

[issue43425] test_peg_generator.test_c_parser emits DeprecationWarning due to distutils

2021-03-06 Thread Karthikeyan Singaravelan
New submission from Karthikeyan Singaravelan : distutils was deprecated for removal in Python 3.10. It is used in test_peg_generator.test_c_parser which emits a deprecation warning. It also seems to be used in test_support for missing_compiler_executable that will emit a deprecation warning.

[issue43426] test_importlib.test_windows emits deprecation warning over usage of distutils

2021-03-06 Thread Karthikeyan Singaravelan
New submission from Karthikeyan Singaravelan : test_windows uses distutil which emits a deprecation warning due to distutils being deprecated. sysconfig.get_platform and distutils.util.get_host_platform seem to be identical though distutils.util.get_platform has an extra if clause for nt syst

[issue41282] Deprecate and remove distutils

2021-03-06 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I have created below issues where deprecation warning is emitted due to distutils usage in tests. Probably there are other places that need an update to setuptools like setup.py used by make that emits deprecation warning during building cpython.

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Aaron Meurer
Change by Aaron Meurer : -- nosy: +asmeurer ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue43405] DeprecationWarnings in test_unicode

2021-03-06 Thread Inada Naoki
Inada Naoki added the comment: New changeset 8aabfa8550692a76d8a96e138c48faf5a7b2752c by Zackery Spytz in branch 'master': bpo-43405: Fix DeprecationWarnings in test_unicode (GH-24754) https://github.com/python/cpython/commit/8aabfa8550692a76d8a96e138c48faf5a7b2752c --

[issue43405] DeprecationWarnings in test_unicode

2021-03-06 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ P

[issue41361] Converting collections.deque methods to Argument Clinic

2021-03-06 Thread Dennis Sweeney
Dennis Sweeney added the comment: If the argument clinic is too disruptive, would it be okay to inline the equivalent code like this? diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 90bafb0ea8..d75388abc8 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: > 1 loop, best of 11: 257 msec per loop > $ ... from patched ... > 10 loops, best of 11: 33.2 msec per loop Looks worth it :-) -- ___ Python tracker