]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
4 years agobpo-42323: Fix math.nextafter() on AIX (GH-24381)
Victor Stinner [Fri, 29 Jan 2021 22:04:50 +0000 (23:04 +0100)] 
bpo-42323: Fix math.nextafter() on AIX (GH-24381)

math_nextafter_impl() must return a Python object, not a C double.

4 years agobpo-41282: Add deprecation warning and docs for distutils (PEP 632) (GH-24355)
Steve Dower [Fri, 29 Jan 2021 21:48:55 +0000 (21:48 +0000)] 
bpo-41282: Add deprecation warning and docs for distutils (PEP 632) (GH-24355)

4 years agoFixing typos in turtle.rst (GH-24376)
Jules Lasne [Fri, 29 Jan 2021 21:40:45 +0000 (22:40 +0100)] 
Fixing typos in turtle.rst (GH-24376)

Automerge-Triggered-By: GH:JulienPalard
4 years agobpo-43008: Add 'Patch by Ken Hilton' (GH-24370)
Terry Jan Reedy [Fri, 29 Jan 2021 18:02:05 +0000 (13:02 -0500)] 
bpo-43008: Add 'Patch by Ken Hilton' (GH-24370)

4 years agoFixed typo in turtle.rst (GH-24371)
Jules Lasne [Fri, 29 Jan 2021 17:46:39 +0000 (18:46 +0100)] 
Fixed typo in turtle.rst (GH-24371)

Found it while translating it to french 🤷

Automerge-Triggered-By: GH:JulienPalard
4 years agobpo-42979: Use _Py_CheckSlotResult() to check slots result (GH-24356)
Victor Stinner [Fri, 29 Jan 2021 15:53:03 +0000 (16:53 +0100)] 
bpo-42979: Use _Py_CheckSlotResult() to check slots result (GH-24356)

When Python is built in debug mode (with C assertions), calling a
type slot like sq_length (__len__() in Python) now fails with a fatal
error if the slot succeeded with an exception set, or failed with no
exception set. The error message contains the slot, the type name,
and the current exception (if an exception is set).

* Check the result of all slots using _Py_CheckSlotResult().
* No longer pass op_name to ternary_op() in release mode.
* Replace operator with dunder Python method name in error messages.
  For example, replace "*" with "__mul__".
* Fix compiler_exit_scope() when an exception is set.
* Fix bytearray.extend() when an exception is set: don't call
  bytearray_setslice() with an exception set.

4 years agobpo-42990: Introduce 'frame constructor' struct to simplify API for PyEval_CodeEval...
Mark Shannon [Fri, 29 Jan 2021 13:24:55 +0000 (13:24 +0000)] 
bpo-42990: Introduce 'frame constructor' struct to simplify API for PyEval_CodeEval and friends (GH-24298)

* Introduce 'frame constructor' to simplify API for frame creation

* Embed struct using a macro to conform to PEP 7

4 years agobpo-23544: Disable IDLE Stack Viewer when running user code (GH-17163)
Zackery Spytz [Thu, 28 Jan 2021 23:13:22 +0000 (16:13 -0700)] 
bpo-23544: Disable IDLE Stack Viewer when running user code (GH-17163)

Starting stack viewer when user code is running, including when Debugger is active, hangs or crashes IDLE.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
4 years agobpo-42955: Remove sub-packages from sys.stdlib_module_names (GH-24353)
Victor Stinner [Wed, 27 Jan 2021 23:03:23 +0000 (00:03 +0100)] 
bpo-42955: Remove sub-packages from sys.stdlib_module_names (GH-24353)

4 years agobpo-42979: Enhance abstract.c assertions checking slot result (GH-24352)
Victor Stinner [Wed, 27 Jan 2021 16:39:16 +0000 (17:39 +0100)] 
bpo-42979: Enhance abstract.c assertions checking slot result (GH-24352)

* bpo-42979: Enhance abstract.c assertions checking slot result

Add _Py_CheckSlotResult() function which fails with a fatal error if
a slot function succeeded with an exception set or failed with no
exception set: write the slot name, the type name and the current
exception (if an exception is set).

4 years agobpo-42979: _zoneinfo exec function checks for PyDateTime_IMPORT failure (GH-24333)
Hai Shi [Wed, 27 Jan 2021 10:23:33 +0000 (18:23 +0800)] 
bpo-42979: _zoneinfo exec function checks for PyDateTime_IMPORT failure (GH-24333)

Importing datetime can fail.

4 years agobpo-43031: Set a timeout when running tests in PGO build (GH-24339)
Victor Stinner [Wed, 27 Jan 2021 10:16:15 +0000 (11:16 +0100)] 
bpo-43031: Set a timeout when running tests in PGO build (GH-24339)

Pass --timeout=$(TESTTIMEOUT) option to the default profile task
"./python -m test --pgo" command.

4 years agobpo-43033: Fix the handling of PyObject_SetAttrString() in _zoneinfo.c (GH-24345)
Zackery Spytz [Wed, 27 Jan 2021 08:16:20 +0000 (01:16 -0700)] 
bpo-43033: Fix the handling of PyObject_SetAttrString() in _zoneinfo.c (GH-24345)

4 years agobpo-43008: Make IDLE respect sys.excepthook (GH-24302)
Ken [Tue, 26 Jan 2021 23:55:52 +0000 (07:55 +0800)] 
bpo-43008: Make IDLE respect sys.excepthook (GH-24302)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
4 years agobpo-38250: [Enum] only include .rst test if file available (GH-24342)
Ethan Furman [Tue, 26 Jan 2021 20:52:52 +0000 (12:52 -0800)] 
bpo-38250: [Enum] only include .rst test if file available (GH-24342)

* [Enum] only include .rst test if file available

In order to ensure the ReST documentation is up to date for Enum,
use doctest to check it -- but only if the .rst files have not
been stripped.

4 years agobpo-33387: update documentation for exception handling opcode changes (GH-24334)
Irit Katriel [Tue, 26 Jan 2021 10:17:13 +0000 (10:17 +0000)] 
bpo-33387: update documentation for exception handling opcode changes (GH-24334)

* bpo-33387: remove obsolete comment

* bpo-33387: update SETUP_WITH opcode documentation

4 years agoFix minor typo in the rest format in the enum docs (GH-24335)
Pablo Galindo [Mon, 25 Jan 2021 23:23:30 +0000 (23:23 +0000)] 
Fix minor typo in the rest format in the enum docs (GH-24335)

4 years agoDocument new parenthesized with statements (GH-24281)
Pablo Galindo [Mon, 25 Jan 2021 23:15:51 +0000 (23:15 +0000)] 
Document new parenthesized with statements (GH-24281)

4 years agoTypo in comment (GH-24199)
borispopoff [Mon, 25 Jan 2021 22:51:48 +0000 (23:51 +0100)] 
Typo in comment (GH-24199)

Automerge-Triggered-By: GH:Mariatta
4 years agobpo-38250: [Enum] single-bit flags are canonical (GH-24215)
Ethan Furman [Mon, 25 Jan 2021 22:26:19 +0000 (14:26 -0800)] 
bpo-38250: [Enum] single-bit flags are canonical (GH-24215)

Flag members are now divided by one-bit verses multi-bit, with multi-bit being treated as aliases. Iterating over a flag only returns the contained single-bit flags.

Iterating, repr(), and str() show members in definition order.

When constructing combined-member flags, any extra integer values are either discarded (CONFORM), turned into ints (EJECT) or treated as errors (STRICT). Flag classes can specify which of those three behaviors is desired:

>>> class Test(Flag, boundary=CONFORM):
...     ONE = 1
...     TWO = 2
...
>>> Test(5)
<Test.ONE: 1>

Besides the three above behaviors, there is also KEEP, which should not be used unless necessary -- for example, _convert_ specifies KEEP as there are flag sets in the stdlib that are incomplete and/or inconsistent (e.g. ssl.Options). KEEP will, as the name suggests, keep all bits; however, iterating over a flag with extra bits will only return the canonical flags contained, not the extra bits.

Iteration is now in member definition order.  If member definition order
matches increasing value order, then a more efficient method of flag
decomposition is used; otherwise, sort() is called on the results of
that method to get definition order.

``re`` module:

repr() has been modified to support as closely as possible its previous
output; the big difference is that inverted flags cannot be output as
before because the inversion operation now always returns the comparable
positive result; i.e.

   re.A|re.I|re.M|re.S is ~(re.L|re.U|re.S|re.T|re.DEBUG)

in both of the above terms, the ``value`` is 282.

re's tests have been updated to reflect the modifications to repr().

4 years agobpo-42955: Rename module_names to sys.stdlib_module_names (GH-24332)
Victor Stinner [Mon, 25 Jan 2021 22:12:50 +0000 (23:12 +0100)] 
bpo-42955: Rename module_names to sys.stdlib_module_names (GH-24332)

* Rename _Py_module_names to _Py_stdlib_module_names.
* Rename Python/module_names.h to Python/stdlib_module_names.h.

4 years agobpo-42383: pdb: do not fail to restart the target if the current directory changed...
Andrey Bienkowski [Mon, 25 Jan 2021 21:08:01 +0000 (21:08 +0000)] 
bpo-42383: pdb: do not fail to restart the target if the current directory changed (#23412)

This commit only adds tests and a news entry. The actual bug was fixed in the earlier commit.

4 years agobpo-37319: Improve documentation, code and tests of randrange. (GH-19112)
Serhiy Storchaka [Mon, 25 Jan 2021 21:02:04 +0000 (23:02 +0200)] 
bpo-37319: Improve documentation, code and tests of randrange. (GH-19112)

4 years agobpo-42869: Avoid an HTTP redirection. (GH-24174)
Julien Palard [Mon, 25 Jan 2021 14:50:14 +0000 (15:50 +0100)] 
bpo-42869: Avoid an HTTP redirection. (GH-24174)

4 years agobpo-42843: Keep Sphinx 1.8 and Sphinx 2 compatibility (GH-24282)
Julien Palard [Mon, 25 Jan 2021 14:46:06 +0000 (15:46 +0100)] 
bpo-42843: Keep Sphinx 1.8 and Sphinx 2 compatibility (GH-24282)

4 years agobpo-42955: Fix sys.module_names doc (GH-24329)
Victor Stinner [Mon, 25 Jan 2021 12:59:02 +0000 (13:59 +0100)] 
bpo-42955: Fix sys.module_names doc (GH-24329)

Replace versionchanged markup with versionadded.

4 years agobpo-42955: Add sys.modules_names (GH-24238)
Victor Stinner [Mon, 25 Jan 2021 12:24:42 +0000 (13:24 +0100)] 
bpo-42955: Add sys.modules_names (GH-24238)

Add sys.module_names, containing the list of the standard library
module names.

4 years agobpo-43013: Fix old tkinter module names in idlelib (GH-24326)
Terry Jan Reedy [Mon, 25 Jan 2021 11:33:18 +0000 (06:33 -0500)] 
bpo-43013: Fix old tkinter module names in idlelib (GH-24326)

Lowercase 'tkColorChooser', 'tkFileDialog', 'tkSimpleDialog', and
'tkMessageBox' and remove 'tk'.  Just lowercase 'tkFont' as 'font'
is already used.  Adjust import.

4 years agobpo-27772: Make preceding width with 0 valid in string format. (GH-11270)
Serhiy Storchaka [Mon, 25 Jan 2021 09:56:33 +0000 (11:56 +0200)] 
bpo-27772: Make preceding width with 0 valid in string format. (GH-11270)

Previously it was an error with confusing error message.

4 years ago bpo-43013: Update idlelib code to 3.x (GH-24315)
Terry Jan Reedy [Sun, 24 Jan 2021 19:08:50 +0000 (14:08 -0500)] 
 bpo-43013: Update idlelib code to 3.x  (GH-24315)

Remove 9 remaining '(object)' occurrences in class headers in idlelib
and 25 '()' occurrences in idlelib.idle_test class headers.

4 years agobpo-43014: Improve performance of tokenize.tokenize by 20-30%
Anthony Sottile [Sun, 24 Jan 2021 09:23:17 +0000 (01:23 -0800)] 
bpo-43014: Improve performance of tokenize.tokenize by 20-30%

4 years agoRemove full stop from a bytes-related SyntaxError message (GH-24300)
numbermaniac [Sat, 23 Jan 2021 22:56:57 +0000 (09:56 +1100)] 
Remove full stop from a bytes-related SyntaxError message (GH-24300)

4 years agocloses bpo-43011: Fix DeprecationWarnings in test_ctypes (GH-24305)
Zackery Spytz [Sat, 23 Jan 2021 16:34:01 +0000 (09:34 -0700)] 
closes bpo-43011: Fix DeprecationWarnings in test_ctypes (GH-24305)

4 years agobpo-42996: Update a reference to PKCS #5 in hashlib docs to version 2.1 (GH-24289) 12244/head
Illia Volochii [Fri, 22 Jan 2021 12:06:00 +0000 (14:06 +0200)] 
bpo-42996: Update a reference to PKCS #5 in hashlib docs to version 2.1 (GH-24289)

RFC 8018 superseded RFC 8018.

Automerge-Triggered-By: GH:tiran
4 years agobpo-41798: Allocate the _curses._C_API on the heap memory (GH-24186)
Hai Shi [Fri, 22 Jan 2021 10:06:43 +0000 (18:06 +0800)] 
bpo-41798: Allocate the _curses._C_API on the heap memory (GH-24186)

4 years agobpo-40304: Correct type(name, bases, dict) doc (GH-19553)
Борис Верховский [Fri, 22 Jan 2021 05:47:23 +0000 (00:47 -0500)] 
bpo-40304: Correct type(name, bases, dict) doc (GH-19553)

Co-authored-by: Éric Araujo <merwok@netwok.org>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com>
4 years agobpo-42384: pdb: correctly populate sys.path[0] (GH-23338)
Andrey Bienkowski [Fri, 22 Jan 2021 01:19:51 +0000 (01:19 +0000)] 
bpo-42384: pdb: correctly populate sys.path[0] (GH-23338)

Automerge-Triggered-By: GH:gvanrossum
4 years agobpo-31904: setup.py: fix cross-compilation on VxWorks (GH-24191)
pxinwr [Fri, 22 Jan 2021 00:55:52 +0000 (08:55 +0800)] 
bpo-31904: setup.py: fix cross-compilation on VxWorks (GH-24191)

Add library search path by wr-cc in add_cross_compiling_paths().

4 years agobpo-33289: Return RGB triplet of ints instead of floats from tkinter.colorchooser...
Cheryl Sabella [Thu, 21 Jan 2021 19:14:04 +0000 (14:14 -0500)] 
bpo-33289: Return RGB triplet of ints instead of floats from tkinter.colorchooser (GH-6578)

4 years agoAdd a What's New entry for the new parser error improvements (GH-24280)
Pablo Galindo [Thu, 21 Jan 2021 17:36:35 +0000 (17:36 +0000)] 
Add a What's New entry for the new parser error improvements (GH-24280)

4 years agoFix typo in what's new. bidst_wheel -> bdist_wheel (GH-24234)
ravcio [Thu, 21 Jan 2021 10:23:46 +0000 (11:23 +0100)] 
Fix typo in what's new. bidst_wheel -> bdist_wheel (GH-24234)

bidst_wheel -> bdist_wheel

Automerge-Triggered-By: GH:Mariatta
4 years agobpo-42392: Mention loop removal in whatsnew for 3.10 (GH-24256)
Ken Jin [Thu, 21 Jan 2021 00:16:12 +0000 (16:16 -0800)] 
bpo-42392: Mention loop removal in whatsnew for 3.10 (GH-24256)

@vstinner [noticed on python-dev](https://mail.python.org/archives/list/python-dev@python.org/thread/O3T7SK3BGMFWMLCQXDODZJSBL42AUWTR/) that there is no what's new or porting entry for removal of asyncio ``loop`` parameter.

This patch adds a basic guide.

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
4 years agobpo-40176: Improve error messages for unclosed string literals (GH-19346)
Batuhan Taskaya [Wed, 20 Jan 2021 21:38:47 +0000 (00:38 +0300)] 
bpo-40176: Improve error messages for unclosed string literals (GH-19346)

Automerge-Triggered-By: GH:isidentical
4 years agobpo-42864: Simplify the tokenizer exceptions after generic SyntaxError (GH-24273)
Pablo Galindo [Wed, 20 Jan 2021 19:11:56 +0000 (19:11 +0000)] 
bpo-42864: Simplify the tokenizer exceptions after generic SyntaxError (GH-24273)

Automerge-Triggered-By: GH:pablogsal
4 years agobpo-42856: Add --with-wheel-pkg-dir=PATH configure option (GH-24210)
Victor Stinner [Wed, 20 Jan 2021 16:07:21 +0000 (17:07 +0100)] 
bpo-42856: Add --with-wheel-pkg-dir=PATH configure option (GH-24210)

Add --with-wheel-pkg-dir=PATH option to the ./configure script. If
specified, the ensurepip module looks for setuptools and pip wheel
packages in this directory: if both are present, these wheel packages
are used instead of ensurepip bundled wheel packages.

Some Linux distribution packaging policies recommend against bundling
dependencies. For example, Fedora installs wheel packages in the
/usr/share/python-wheels/ directory and don't install the
ensurepip._bundled package.

ensurepip: Remove unused runpy import.

4 years agobpo-42323: Fix math.nextafter() for NaN on AIX (GH-24265)
Victor Stinner [Wed, 20 Jan 2021 14:20:13 +0000 (15:20 +0100)] 
bpo-42323: Fix math.nextafter() for NaN on AIX (GH-24265)

4 years agobpo-42780: Fix set_inheritable() for O_PATH file descriptors on Linux (GH-24172)
cptpcrd [Wed, 20 Jan 2021 14:05:51 +0000 (09:05 -0500)] 
bpo-42780: Fix set_inheritable() for O_PATH file descriptors on Linux (GH-24172)

4 years agoFix typos in unittest documentation (GH-24194)
Conchylicultor [Wed, 20 Jan 2021 13:08:37 +0000 (14:08 +0100)] 
Fix typos in unittest documentation (GH-24194)

* addCleanupClass  -> addClassCleanup
* doCleanupsClass -> doClassCleanups

4 years agobpo-42864: Fix compiler warning in the tokenizer with the new paren stack for column...
Pablo Galindo [Wed, 20 Jan 2021 12:53:52 +0000 (12:53 +0000)] 
bpo-42864: Fix compiler warning in the tokenizer with the new paren stack for column numbers (GH-24266)

4 years agobpo-42048: Clinic Howto: Document AC's defining_class converter (GH-23978)
Erlend Egeberg Aasland [Wed, 20 Jan 2021 11:19:57 +0000 (12:19 +0100)] 
bpo-42048: Clinic Howto: Document AC's defining_class converter (GH-23978)

4 years agobpo-41798: Allocate unicodedata CAPI on the heap (GH-24128)
Erlend Egeberg Aasland [Wed, 20 Jan 2021 11:03:53 +0000 (12:03 +0100)] 
bpo-41798: Allocate unicodedata CAPI on the heap (GH-24128)

4 years agoDoc: os.path.abspath and Path.resolve are also different (GH-23276)
Hong Xu [Wed, 20 Jan 2021 10:20:00 +0000 (02:20 -0800)] 
Doc: os.path.abspath and Path.resolve are also different (GH-23276)

4 years agobpo-42005: profile and cProfile catch BrokenPipeError (GH-22643)
Zhiming Wang [Wed, 20 Jan 2021 08:56:21 +0000 (16:56 +0800)] 
bpo-42005: profile and cProfile catch BrokenPipeError (GH-22643)

4 years agobpo-41995: Handle allocation failure in _tracemalloc and _zoneinfo (GH-22635)
Yunlongs [Wed, 20 Jan 2021 08:38:28 +0000 (16:38 +0800)] 
bpo-41995: Handle allocation failure in _tracemalloc and _zoneinfo (GH-22635)

4 years agobpo-42864: Improve error messages regarding unclosed parentheses (GH-24161)
Pablo Galindo [Tue, 19 Jan 2021 23:59:33 +0000 (23:59 +0000)] 
bpo-42864: Improve error messages regarding unclosed parentheses (GH-24161)

4 years agobpo-42923: _Py_DumpExtensionModules() ignores stdlib ext (GH-24254)
Victor Stinner [Tue, 19 Jan 2021 22:35:27 +0000 (23:35 +0100)] 
bpo-42923: _Py_DumpExtensionModules() ignores stdlib ext (GH-24254)

4 years agobpo-42955: Add Python/module_names.h (GH-24258)
Victor Stinner [Tue, 19 Jan 2021 22:04:49 +0000 (23:04 +0100)] 
bpo-42955: Add Python/module_names.h (GH-24258)

Add a private list of all stdlib modules: _Py_module_names.

* Add Tools/scripts/generate_module_names.py script.
* Makefile: Add "make regen-module-names" command.
* setup.py: Add --list-module-names option.
* GitHub Action and Travis CI also runs "make regen-module-names",
  not ony "make regen-all", to ensure that the module names remains
  up to date.

4 years agobpo-41713: Remove PyOS_InitInterrupts() from python3dll.c (GH-24257)
Victor Stinner [Tue, 19 Jan 2021 17:27:01 +0000 (18:27 +0100)] 
bpo-41713: Remove PyOS_InitInterrupts() from python3dll.c (GH-24257)

4 years agoAdd a clarification for the object-domain allocators regarding pointer validity ...
Pablo Galindo [Tue, 19 Jan 2021 13:09:06 +0000 (13:09 +0000)] 
Add a clarification for the object-domain allocators regarding pointer validity (GH-24253)

4 years agobpo-41818: Close file descriptors in test_openpty (#GH-24119)
Petr Viktorin [Tue, 19 Jan 2021 13:03:12 +0000 (14:03 +0100)] 
bpo-41818: Close file descriptors in test_openpty (#GH-24119)

When stdin is a TTY, the test added in commit c13d89955d9a2942c6355d6839d7096323244136
is expected to fail. However, when it failed, it did not close
its file descriptors. This is flagged by the refleak tests (but
only when stdin is a TTY, which doesn't seem to be the case on CI).

4 years agoAdd a paragraph about allocation domains to the C-API docs (GH-24252)
Pablo Galindo [Mon, 18 Jan 2021 22:20:57 +0000 (22:20 +0000)] 
Add a paragraph about allocation domains to the C-API docs (GH-24252)

4 years agocloses bpo-42938: Replace snprintf with Python unicode formatting in ctypes param...
Benjamin Peterson [Mon, 18 Jan 2021 20:47:05 +0000 (14:47 -0600)] 
closes bpo-42938: Replace snprintf with Python unicode formatting in ctypes param reprs. (24239)

4 years agobpo-36143: make regen-all now also runs regen-keyword (GH-24245)
Victor Stinner [Mon, 18 Jan 2021 20:23:35 +0000 (21:23 +0100)] 
bpo-36143: make regen-all now also runs regen-keyword (GH-24245)

4 years agobpo-42923: Dump extension modules on fatal error (GH-24207)
Victor Stinner [Mon, 18 Jan 2021 19:47:13 +0000 (20:47 +0100)] 
bpo-42923: Dump extension modules on fatal error (GH-24207)

The Py_FatalError() function and the faulthandler module now dump the
list of extension modules on a fatal error.

Add _Py_DumpExtensionModules() and _PyModule_IsExtension() internal
functions.

4 years agobpo-42944 Fix Random.sample when counts is not None (GH-24235)
jonanifranco [Mon, 18 Jan 2021 18:04:29 +0000 (19:04 +0100)] 
bpo-42944 Fix Random.sample when counts is not None (GH-24235)

4 years agobpo-42923: Py_FatalError() avoids fprintf() (GH-24242)
Victor Stinner [Mon, 18 Jan 2021 17:34:56 +0000 (18:34 +0100)] 
bpo-42923: Py_FatalError() avoids fprintf() (GH-24242)

* Replace buffered fprintf() with unbuffered _Py_write_noraise()
  in Py_FatalError().
* _Py_DumpHexadecimal() now accepts uintptr_t.

4 years agobpo-42923: Add Py_FatalError() test in test_capi (GH-24240)
Victor Stinner [Mon, 18 Jan 2021 17:24:29 +0000 (18:24 +0100)] 
bpo-42923: Add Py_FatalError() test in test_capi (GH-24240)

Move faulthandler._fatal_error() to _testcapi.fatal_error().

4 years agobpo-42931: randbytes missing from random.__all__ (GH-24219)
Setrak Balian [Fri, 15 Jan 2021 17:50:42 +0000 (17:50 +0000)] 
bpo-42931: randbytes missing from random.__all__ (GH-24219)

4 years agobpo-42934: use TracebackException(compact=True) in unittest.TestResult (GH-24221)
Irit Katriel [Fri, 15 Jan 2021 15:59:44 +0000 (15:59 +0000)] 
bpo-42934: use TracebackException(compact=True) in unittest.TestResult (GH-24221)

4 years agoMark instructions at end of class scope as artificial. (GH-24222)
Mark Shannon [Fri, 15 Jan 2021 13:52:00 +0000 (13:52 +0000)] 
Mark instructions at end of class scope as artificial. (GH-24222)

4 years agobpo-42877: add the 'compact' param to TracebackException's __init__ (#24179)
Irit Katriel [Fri, 15 Jan 2021 02:45:02 +0000 (02:45 +0000)] 
bpo-42877: add the 'compact' param to TracebackException's __init__ (#24179)

Use it to reduce the time and memory taken up by several of traceback's module-level functions.

4 years agobpo-42827: Fix crash on SyntaxError in multiline expressions (GH-24140)
Lysandros Nikolaou [Thu, 14 Jan 2021 21:36:30 +0000 (23:36 +0200)] 
bpo-42827: Fix crash on SyntaxError in multiline expressions (GH-24140)

When trying to extract the error line for the error message there
are two distinct cases:

1. The input comes from a file, which means that we can extract the
   error line by using `PyErr_ProgramTextObject` and which we already
   do.
2. The input does not come from a file, at which point we need to get
   the source code from the tokenizer:
   * If the tokenizer's current line number is the same with the line
     of the error, we get the line from `tok->buf` and we're ready.
   * Else, we can extract the error line from the source code in the
     following two ways:
     * If the input comes from a string we have all the input
       in `tok->str` and we can extract the error line from it.
     * If the input comes from stdin, i.e. the interactive prompt, we
       do not have access to the previous line. That's why a new
       field `tok->stdin_content` is added which holds the whole input for the
       current (multiline) statement or expression. We can then extract the
       error line from `tok->stdin_content` like we do in the string case above.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
4 years agoDocs: Remove stray semicolon in init.rst (GH-23974)
Ken Jin [Thu, 14 Jan 2021 15:57:08 +0000 (23:57 +0800)] 
Docs: Remove stray semicolon in init.rst (GH-23974)

Removed stray semicolon which was causing the docs to render weirdly (it's the function right under the one [here](https://docs.python.org/3/c-api/init.html#c._PyInterpreterState_GetEvalFrameFunc)).

4 years agobpo-39273: Expose BUTTON5_* constants in the curses module if available (GH-17996)
Zackery Spytz [Thu, 14 Jan 2021 09:40:09 +0000 (02:40 -0700)] 
bpo-39273: Expose BUTTON5_* constants in the curses module if available (GH-17996)

4 years agobpo-40956: Fix sqlite3.Cursor.fetchmany() default value (GH-24214)
Erlend Egeberg Aasland [Wed, 13 Jan 2021 23:17:33 +0000 (00:17 +0100)] 
bpo-40956: Fix sqlite3.Cursor.fetchmany() default value (GH-24214)

4 years agobpo-42924: Fix incorrect copy in bytearray_repeat (GH-24208)
Tobias Holl [Wed, 13 Jan 2021 16:16:40 +0000 (17:16 +0100)] 
bpo-42924: Fix incorrect copy in bytearray_repeat (GH-24208)

Before, using the * operator to repeat a bytearray would copy data from the start of
the internal buffer (ob_bytes) and not from the start of the actual data (ob_start).

4 years agoEliminate NOPs in extended blocks. (GH-24209)
Mark Shannon [Wed, 13 Jan 2021 15:05:04 +0000 (15:05 +0000)] 
Eliminate NOPs in extended blocks. (GH-24209)

4 years agobpo-42908: Mark cleanup code at end of try-except and with artificial (#24202)
Mark Shannon [Wed, 13 Jan 2021 12:05:43 +0000 (12:05 +0000)] 
bpo-42908: Mark cleanup code at end of try-except and with artificial (#24202)

* Mark bytecodes at end of try-except as artificial.

* Make sure that the CFG is consistent throughout optimiization.

* Extend line-number propagation logic so that implicit returns after 'try-except' or 'with' have the correct line numbers.

* Update importlib

4 years agobpo-1635741: Fix PyModule_AddObjectRef to use EXPORT_FUNC (GH-24205)
Dong-hee Na [Wed, 13 Jan 2021 10:15:40 +0000 (19:15 +0900)] 
bpo-1635741: Fix PyModule_AddObjectRef to use EXPORT_FUNC (GH-24205)

4 years agobpo-42901: [Enum] move member creation to `__set_name__` (GH-24196)
Ethan Furman [Wed, 13 Jan 2021 07:47:57 +0000 (23:47 -0800)] 
bpo-42901: [Enum] move member creation to `__set_name__` (GH-24196)

`type.__new__` calls `__set_name__` and `__init_subclass__`, which means
that any work metaclasses do after calling `super().__new__()` will not
be available to those two methods.  In particular, `Enum` classes that
want to make use of `__init_subclass__` will not see any members.

Almost all customization is therefore moved to before the
`type.__new__()` call, including changing all members to a proto member
descriptor with a `__set_name__` that will do the final conversion of a
member to be an instance of the `Enum` class.

4 years agobpo-37324: Remove ABC aliases from collections (GH-23754)
Hugo van Kemenade [Tue, 12 Jan 2021 23:16:37 +0000 (01:16 +0200)] 
bpo-37324: Remove ABC aliases from collections (GH-23754)

Remove deprecated aliases to Abstract Base Classes from the
collections module.

4 years agobpo-42848: remove recursion from TracebackException (GH-24158)
Irit Katriel [Tue, 12 Jan 2021 22:14:27 +0000 (22:14 +0000)] 
bpo-42848: remove recursion from TracebackException (GH-24158)

4 years agobpo-42874: Remove grep -qE options for Solaris 10 compatibility (GH-24200)
Paul Ganssle [Tue, 12 Jan 2021 18:17:52 +0000 (13:17 -0500)] 
bpo-42874: Remove grep -qE options for Solaris 10 compatibility (GH-24200)

According to [bpo-42874](), some versions of grep do not support the `-q` and `-E` options. Although both options are used elsewhere in the configure script, this particular bit of validation can be achieved without them,
so there's no real harm in using a grep call with no flags.

Would be good to get some people taking advantage of the `--with-tzpath` arguments in the wild to try this out.. Local testing seems to indicate that this does the same thing, but I don't know that we have any buildbots using this option. Maybe @pablogsal?

[bpo-42874]():

4 years agobpo-41994: Fix refcount issues in Python/import.c (GH-22632)
Serhiy Storchaka [Tue, 12 Jan 2021 14:43:32 +0000 (16:43 +0200)] 
bpo-41994: Fix refcount issues in Python/import.c (GH-22632)

https://bugs.python.org/issue41994

4 years agobpo-42882: Add test_embed.test_unicode_id_init() (GH-24198)
Victor Stinner [Tue, 12 Jan 2021 10:26:26 +0000 (11:26 +0100)] 
bpo-42882: Add test_embed.test_unicode_id_init() (GH-24198)

Test that _PyUnicode_FromId() works when Python is initialized
multiples times.

4 years agobpo-42882: _PyRuntimeState_Init() leaves unicode next_index unchanged (GH-24193)
Victor Stinner [Tue, 12 Jan 2021 09:29:45 +0000 (10:29 +0100)] 
bpo-42882: _PyRuntimeState_Init() leaves unicode next_index unchanged (GH-24193)

Fix the _PyUnicode_FromId() function (_Py_IDENTIFIER(var) API) when
Py_Initialize() / Py_Finalize() is called multiple times:
preserve _PyRuntime.unicode_ids.next_index value.

Use _PyRuntimeState_INIT macro instead memset(0) to reset
_PyRuntimeState members to zero.

4 years agobpo-42870: Document change in argparse help output. (GH-24190)
Tomáš Hrnčiar [Tue, 12 Jan 2021 00:41:35 +0000 (01:41 +0100)] 
bpo-42870: Document change in argparse help output. (GH-24190)

4 years agoFix various ParamSpec errors in typing (GH-24176)
Ken Jin [Mon, 11 Jan 2021 00:11:41 +0000 (08:11 +0800)] 
Fix various ParamSpec errors in typing (GH-24176)

1. ParamSpec -> TypeVar for ``typing.Concatenate``
2. ParamSpec's call signature should align with its documentation.
Noticed in GH-24169

4 years agobpo-33065: Fix problem debugging user classes with __repr__ method (GH-24183)
Terry Jan Reedy [Sun, 10 Jan 2021 06:59:47 +0000 (01:59 -0500)] 
bpo-33065: Fix problem debugging user classes with __repr__ method (GH-24183)

If __repr__ uses instance attributes, as normal, and one steps
through the __init__ method, debugger may try to get repr before
the instance attributes exist.  reprlib.repr handles the error.

4 years agobpo-24464: Fix sqlite3.enable_shared_cache() deprecation wrapper (GH-24170)
Erlend Egeberg Aasland [Sat, 9 Jan 2021 11:25:55 +0000 (12:25 +0100)] 
bpo-24464: Fix sqlite3.enable_shared_cache() deprecation wrapper (GH-24170)

4 years agobpo-42802: Remove distutils bdist_wininst command (GH-24043)
Victor Stinner [Fri, 8 Jan 2021 23:35:01 +0000 (00:35 +0100)] 
bpo-42802: Remove distutils bdist_wininst command (GH-24043)

The distutils bdist_wininst command deprecated in Python 3.8 has been
removed. The distutils bidst_wheel command is now recommended to
distribute binary packages on Windows.

* Remove Lib/distutils/command/bdist_wininst.py
* Remove PC/bdist_wininst/ project
* Remove Lib/distutils/command/wininst-*.exe programs
* Remove all references to bdist_wininst

4 years agoFix a typo in docs for typing.Concatenate (#24169)
Johan Dahlin [Fri, 8 Jan 2021 18:08:21 +0000 (15:08 -0300)] 
Fix a typo in docs for typing.Concatenate (#24169)

Return param spec should be R, not T

4 years agobpo-42866: Add traverse func to _multibytecodec.MultibyteCodec (GH-24166)
Victor Stinner [Fri, 8 Jan 2021 14:43:59 +0000 (15:43 +0100)] 
bpo-42866: Add traverse func to _multibytecodec.MultibyteCodec (GH-24166)

Convert _multibytecodec.MultibyteCodec type to a GC type and adds a
traverse function.

4 years agobpo-42866: Fix refleak in CJK getcodec() (GH-24165)
Victor Stinner [Fri, 8 Jan 2021 14:01:38 +0000 (15:01 +0100)] 
bpo-42866: Fix refleak in CJK getcodec() (GH-24165)

Fix a reference leak in the getcodec() function of CJK codecs.

4 years agobpo-42846: Convert CJK codec extensions to multiphase init (GH-24157)
Victor Stinner [Thu, 7 Jan 2021 23:15:22 +0000 (00:15 +0100)] 
bpo-42846: Convert CJK codec extensions to multiphase init (GH-24157)

Convert the 6 CJK codec extension modules (_codecs_cn, _codecs_hk,
_codecs_iso2022, _codecs_jp, _codecs_kr and _codecs_tw) to the
multiphase initialization API (PEP 489).

Remove getmultibytecodec() local cache: always import
_multibytecodec. It should be uncommon to get a codec. For example,
this function is only called once per CJK codec module.

Fix a reference leak in register_maps() error path.

4 years agobpo-42860: Remove type error from grammar (GH-24156)
Lysandros Nikolaou [Thu, 7 Jan 2021 22:31:25 +0000 (00:31 +0200)] 
bpo-42860: Remove type error from grammar (GH-24156)

This is only there so that alternative implementations written in statically-typed languages can use this grammar without
having type errors in the way.

Automerge-Triggered-By: GH:lysnikolaou
4 years agobpo-42851: [Enum] remove brittle __init_subclass__ support (GH-24154)
Ethan Furman [Thu, 7 Jan 2021 21:17:55 +0000 (13:17 -0800)] 
bpo-42851: [Enum] remove brittle __init_subclass__ support (GH-24154)

Solution to support calls to `__init_subclass__` with members defined is too brittle and breaks with certain mixins.

4 years agoUpdate frame.f_lineno before any call to the (C) tracing function. (GH-24150)
Mark Shannon [Thu, 7 Jan 2021 16:49:02 +0000 (16:49 +0000)] 
Update frame.f_lineno before any call to the (C) tracing function.  (GH-24150)

* Minimizes breakage of C extensions and ensures PyFrame_GetLineNumber is efficient.

4 years agobpo-42783: Documentation for asyncio.sleep(0) (#24002)
Simon Willison [Thu, 7 Jan 2021 02:03:18 +0000 (18:03 -0800)] 
bpo-42783: Documentation for asyncio.sleep(0) (#24002)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
4 years agobpo-42847: Normalise Lib/sqlite3/test/* file encodings (GH-24147)
Erlend Egeberg Aasland [Thu, 7 Jan 2021 00:36:35 +0000 (01:36 +0100)] 
bpo-42847: Normalise Lib/sqlite3/test/* file encodings (GH-24147)

Convert from ISO-8859-1 to UTF-8.