]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
4 years agobpo-43687: Py_Initialize() creates singletons earlier (GH-25147)
Victor Stinner [Fri, 2 Apr 2021 13:28:13 +0000 (15:28 +0200)] 
bpo-43687: Py_Initialize() creates singletons earlier (GH-25147)

Reorganize pycore_interp_init() to initialize singletons before the
the first PyType_Ready() call. Fix an issue when Python is configured
using --without-doc-strings.

4 years agoDocument PyCode_Addr2Line function. (GH-25111)
Mark Shannon [Fri, 2 Apr 2021 12:24:57 +0000 (13:24 +0100)] 
Document PyCode_Addr2Line function. (GH-25111)

* Document PyCode_Addr2Line function.

* Clarify when to use PEP 626 line iterators.

4 years agobpo-43510: Fix emitting EncodingWarning from _io module. (GH-25146)
Inada Naoki [Fri, 2 Apr 2021 08:38:59 +0000 (17:38 +0900)] 
bpo-43510: Fix emitting EncodingWarning from _io module. (GH-25146)

I forget to check PyErr_WarnEx() return value. But it will fail when -Werror is used.

4 years agobpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25142)
Inada Naoki [Fri, 2 Apr 2021 03:53:46 +0000 (12:53 +0900)] 
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25142)

* test__xxsubinterpreters
* test_builtin
* test_doctest
* test_exceptions
* test_opcodes
* test_support
* test_argparse
* test_baseexception
* test_bdb
* test_bool
* test_asdl_parser

4 years agobpo-43700: Replace Zulip badge with Discourse badge (GH-25141)
Erlend Egeberg Aasland [Fri, 2 Apr 2021 03:30:40 +0000 (05:30 +0200)] 
bpo-43700: Replace Zulip badge with Discourse badge (GH-25141)

Automerge-Triggered-By: GH:zware
4 years agobpo-43651: Fix test_compileall with PEP 597 (GH-25128)
Inada Naoki [Fri, 2 Apr 2021 00:01:57 +0000 (09:01 +0900)] 
bpo-43651: Fix test_compileall with PEP 597 (GH-25128)

4 years agobpo-43651: Fix EncodingWarning in lib2to3/pgen2/pgen.py (GH-25127)
Inada Naoki [Thu, 1 Apr 2021 23:59:15 +0000 (08:59 +0900)] 
bpo-43651: Fix EncodingWarning in lib2to3/pgen2/pgen.py (GH-25127)

4 years agobpo-43651: Fix EncodingWarning in test_warnings (GH-25126)
Inada Naoki [Thu, 1 Apr 2021 23:57:05 +0000 (08:57 +0900)] 
bpo-43651: Fix EncodingWarning in test_warnings (GH-25126)

4 years agobpo-26053: Fix test_pdb.test_issue26053() (GH-25139)
Irit Katriel [Thu, 1 Apr 2021 19:05:51 +0000 (20:05 +0100)] 
bpo-26053: Fix test_pdb.test_issue26053() (GH-25139)

4 years agobpo-43677: Fix a minor error in Doc/howto/descriptor.rst (#25123)
Zackery Spytz [Thu, 1 Apr 2021 17:03:33 +0000 (11:03 -0600)] 
bpo-43677: Fix a minor error in Doc/howto/descriptor.rst (#25123)

It should be PyMethod_Type, not Py_MethodType.

4 years agobpo-26053: Fix args echoed by pdb run command (#22033)
Irit Katriel [Thu, 1 Apr 2021 15:25:59 +0000 (16:25 +0100)] 
bpo-26053: Fix args echoed by pdb run command (#22033)

4 years agobpo-27129: Use instruction offsets, not byte offsets, in bytecode and internally...
Mark Shannon [Thu, 1 Apr 2021 15:00:31 +0000 (16:00 +0100)] 
bpo-27129: Use instruction offsets, not byte offsets, in bytecode and internally. (GH-25069)

* Use instruction offset, rather than bytecode offset. Streamlines interpreter dispatch a bit, and removes most EXTENDED_ARGs for jumps.

* Change some uses of PyCode_Addr2Line to PyFrame_GetLineNumber

4 years agobpo-43688: Fix Py_LIMITED_API version of xxlimited (GH-25135)
Victor Stinner [Thu, 1 Apr 2021 13:09:33 +0000 (15:09 +0200)] 
bpo-43688: Fix Py_LIMITED_API version of xxlimited (GH-25135)

xxlimited targets Python 3.10, not Python 3.16: fix the hexadecimal
version number used in the Py_LIMITED_API macro.

4 years agobpo-43690: stable_abi.py no longer parses macros (GH-25136)
Victor Stinner [Thu, 1 Apr 2021 12:13:42 +0000 (14:13 +0200)] 
bpo-43690: stable_abi.py no longer parses macros (GH-25136)

The stable_abi.py script no longer parse macros. Macro targets can be
static inline functions which are not part of the stable ABI, only
part of the limited C API.

Run "make regen-limited-abi" to exclude PyType_HasFeature from
Doc/data/stable_abi.dat.

4 years agobpo-43688: Run make regen-limited-abi (GH-25134)
Victor Stinner [Thu, 1 Apr 2021 09:29:46 +0000 (11:29 +0200)] 
bpo-43688: Run make regen-limited-abi (GH-25134)

4 years agoFix typos in 3.10 "What's new" (GH-25104)
Don Kirkby [Thu, 1 Apr 2021 06:00:30 +0000 (23:00 -0700)] 
Fix typos in 3.10 "What's new" (GH-25104)

4 years agoWhen printing stats, move radix tree info to its own section. (GH-25125)
Tim Peters [Thu, 1 Apr 2021 03:46:31 +0000 (22:46 -0500)] 
When printing stats, move radix tree info to its own section. (GH-25125)

When printing stats, move radix tree info to its own section.
Restore that the breakdown of bytes in arenas exactly accounts for the total of arena bytes allocated.
Add an assert so that invariant doesn't break again.

4 years agobpo-43651: Fix EncodingWarning in test_io (GH-25097)
Inada Naoki [Thu, 1 Apr 2021 02:25:04 +0000 (11:25 +0900)] 
bpo-43651: Fix EncodingWarning in test_io (GH-25097)

4 years agobpo-43651: Fix EncodingWarning in test_file and test_file_eintr (GH-25109)
Inada Naoki [Thu, 1 Apr 2021 02:23:03 +0000 (11:23 +0900)] 
bpo-43651: Fix EncodingWarning in test_file and test_file_eintr (GH-25109)

4 years agobpo-42955: Add _overlapped to sys.stdlib_module_names (GH-25122)
Victor Stinner [Thu, 1 Apr 2021 00:28:23 +0000 (02:28 +0200)] 
bpo-42955: Add _overlapped to sys.stdlib_module_names (GH-25122)

4 years agoEnum: add (re)import of Flag for doctests (GH-25118)
Ethan Furman [Wed, 31 Mar 2021 16:20:08 +0000 (09:20 -0700)] 
Enum: add (re)import of Flag for doctests (GH-25118)

Fix issue with CI doctest forgetting that ``Flag`` had already been imported.

4 years agoDisambiguate that -m also terminates the option list in the manpage. (GH-25100)
Julien Palard [Wed, 31 Mar 2021 12:31:38 +0000 (14:31 +0200)] 
Disambiguate that -m also terminates the option list in the manpage. (GH-25100)

4 years agobpo-37945: Fix test_locale.test_getsetlocale_issue1813() (#25110)
Victor Stinner [Wed, 31 Mar 2021 11:01:46 +0000 (13:01 +0200)] 
bpo-37945: Fix test_locale.test_getsetlocale_issue1813() (#25110)

Skip the test if setlocale() fails.

4 years agoDocument GH-24624
Łukasz Langa [Wed, 31 Mar 2021 10:22:03 +0000 (12:22 +0200)] 
Document GH-24624

4 years agobpo-43179: Generalise alignment for optimised string routines (GH-24624)
Jessica Clarke [Wed, 31 Mar 2021 10:12:39 +0000 (11:12 +0100)] 
bpo-43179: Generalise alignment for optimised string routines (GH-24624)

* Remove m68k-specific hack from ascii_decode

On m68k, alignments of primitives is more relaxed, with 4-byte and
8-byte types only requiring 2-byte alignment, thus using sizeof(size_t)
does not work. Instead, use the portable alternative.

Note that this is a minimal fix that only relaxes the assertion and the
condition for when to use the optimised version remains overly strict.
Such issues will be fixed tree-wide in the next commit.

NB: In C11 we could use _Alignof(size_t) instead, but for compatibility
we use autoconf.

* Optimise string routines for architectures with non-natural alignment

C only requires that sizeof(x) is a multiple of alignof(x), not that the
two are equal. Thus anywhere where we optimise based on alignment we
should be using alignof(x) not sizeof(x).

This is more annoying than it would be in C11 where we could just use
_Alignof(x) (and alignof(x) in C++11), but since we still require only
C99 we must plumb the information all the way from autoconf through the
various typedefs and defines.

4 years agoRevert "bpo-43510: PEP 597: Accept `encoding="locale"` in binary mode (GH-25103)...
Inada Naoki [Wed, 31 Mar 2021 09:49:41 +0000 (18:49 +0900)] 
Revert "bpo-43510: PEP 597: Accept `encoding="locale"` in binary mode (GH-25103)" (#25108)

This reverts commit ff3c9739bd69aa8b58007e63c9e40e6708b4761e.

4 years agobpo-43510: PEP 597: Accept `encoding="locale"` in binary mode (GH-25103)
Inada Naoki [Wed, 31 Mar 2021 05:26:08 +0000 (14:26 +0900)] 
bpo-43510: PEP 597: Accept `encoding="locale"` in binary mode (GH-25103)

It make `encoding="locale"` usable everywhere `encoding=None` is
allowed.

4 years agobpo-42225: IDLE - document two unix-related problems. (#25078)
Terry Jan Reedy [Wed, 31 Mar 2021 05:19:38 +0000 (01:19 -0400)] 
bpo-42225: IDLE - document two unix-related problems. (#25078)

1. Bad IP masquerade rules can prevent startup.
2. X cannot handle some complex colored chars.

4 years agobpo-40066: Enum: modify `repr()` and `str()` (GH-22392)
Ethan Furman [Wed, 31 Mar 2021 04:17:26 +0000 (21:17 -0700)] 
bpo-40066: Enum: modify `repr()` and `str()` (GH-22392)

* Enum: streamline repr() and str(); improve docs

- repr() is now ``enum_class.member_name``
- stdlib global enums are ``module_name.member_name``
- str() is now ``member_name``
- add HOW-TO section for ``Enum``
- change main documentation to be an API reference

4 years agobpo-43399: Fix ElementTree.extend not working on iterators (GH-24751)
Alex Prengère [Tue, 30 Mar 2021 21:11:29 +0000 (23:11 +0200)] 
bpo-43399: Fix ElementTree.extend not working on iterators (GH-24751)

4 years agobpo-41369: Finish updating the vendored libmpdec to version 2.5.1 (GH-24962)
Antoine Pitrou [Tue, 30 Mar 2021 16:11:06 +0000 (18:11 +0200)] 
bpo-41369: Finish updating the vendored libmpdec to version 2.5.1 (GH-24962)

Complete the update to libmpdec-2.5.1.

Co-authored-by: Stefan Krah <skrah@bytereef.org>
4 years agobpo-42134: Raise ImportWarning when calling find_module() in the import system (GH...
Brett Cannon [Tue, 30 Mar 2021 15:43:03 +0000 (08:43 -0700)] 
bpo-42134: Raise ImportWarning when calling find_module() in the import system (GH-25044)

4 years agobpo-43125: Fix: return expected type (str), not original value (bytes) in email/base6...
Grégory Starck [Tue, 30 Mar 2021 08:37:37 +0000 (04:37 -0400)] 
bpo-43125: Fix: return expected type (str), not original value (bytes) in email/base64mime.py::body_encode (GH-24476)

4 years agobpo-43637: Fix a possible memory leak in winreg.SetValueEx() (GH-25038)
Zackery Spytz [Tue, 30 Mar 2021 06:22:34 +0000 (00:22 -0600)] 
bpo-43637: Fix a possible memory leak in winreg.SetValueEx() (GH-25038)

4 years agobpo-33164: blake2: Fix Coverity scan (GH-25060)
Inada Naoki [Tue, 30 Mar 2021 03:25:28 +0000 (12:25 +0900)] 
bpo-33164: blake2: Fix Coverity scan (GH-25060)

4 years agobpo-37448: Use radix tree for pymalloc address_in_range(). (GH-14474)
Neil Schemenauer [Tue, 30 Mar 2021 02:51:15 +0000 (19:51 -0700)] 
bpo-37448: Use radix tree for pymalloc address_in_range(). (GH-14474)

The radix tree approach is a relatively simple and memory sanitary
alternative to the old (slightly) unsanitary address_in_range().
To disable the radix tree map, set a preprocessor flag as follows:
-DWITH_PYMALLOC_RADIX_TREE=0.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
4 years agobpo-43631: Update to OpenSSL 1.1.1k (GH-25024)
Christian Heimes [Tue, 30 Mar 2021 00:00:34 +0000 (02:00 +0200)] 
bpo-43631: Update to OpenSSL 1.1.1k (GH-25024)

- [x] Build OpenSSL 1.1.1k for macOS
- [x] Build OpenSSL 1.1.1k for Windows

I have also updated multissl tester and various CI configurations to use latest OpenSSL. The versions were all over the place.

Signed-off-by: Christian Heimes <christian@python.org>
Automerge-Triggered-By: GH:tiran
4 years agoFix tokenizer error when raw decoding null bytes (GH-25080)
Pablo Galindo [Mon, 29 Mar 2021 23:24:49 +0000 (00:24 +0100)] 
Fix tokenizer error when raw decoding null bytes (GH-25080)

4 years agobpo-43660: Fix crash when displaying exceptions with custom values for sys.stderr...
Pablo Galindo [Mon, 29 Mar 2021 22:38:51 +0000 (23:38 +0100)] 
bpo-43660: Fix crash when displaying exceptions with custom values for sys.stderr (GH-25075)

4 years agobpo-43659: Fix test_curses on AIX (GH-25074)
Michael Felt [Mon, 29 Mar 2021 19:06:24 +0000 (21:06 +0200)] 
bpo-43659:  Fix test_curses on AIX (GH-25074)

curses.update_lines_cols() is only defined when the curses library
provides either resizeterm() or resize_term() functions which are optional
and are not provided on AIX.

4 years agobpo-35930: Raising an exception raised in a "future" instance will create reference...
Jesús Cea [Mon, 29 Mar 2021 17:22:13 +0000 (19:22 +0200)] 
bpo-35930: Raising an exception raised in a "future" instance will create reference cycles (#24995)

Before: https://lists.es.python.org/pipermail/general/attachments/20201229/0c14bc58/attachment-0002.png

After: https://lists.es.python.org/pipermail/general/attachments/20201229/0c14bc58/attachment-0003.png

4 years agobpo-43648: Remove redundant datefmt option in logging file config (GH-25051)
Harry [Mon, 29 Mar 2021 14:16:19 +0000 (15:16 +0100)] 
bpo-43648: Remove redundant datefmt option in logging file config (GH-25051)

[bpo-43648](): Remove redundant datefmt option in logging file config

Automerge-Triggered-By: GH:vsajip
4 years agobpo-43433: Preserve query and fragment in the URL of the server in ServerProxy. ...
Serhiy Storchaka [Mon, 29 Mar 2021 13:39:31 +0000 (16:39 +0300)] 
bpo-43433: Preserve query and fragment in the URL of the server in ServerProxy. (GH-25057)

4 years agobpo-40645: Fix reference leak in the _hashopenssl extension (GH-25063)
Pablo Galindo [Mon, 29 Mar 2021 13:17:40 +0000 (14:17 +0100)] 
bpo-40645: Fix reference leak in the _hashopenssl extension (GH-25063)

4 years agobpo-42988: Remove the pydoc getfile feature (GH-25015)
Victor Stinner [Mon, 29 Mar 2021 12:40:40 +0000 (14:40 +0200)] 
bpo-42988: Remove the pydoc getfile feature (GH-25015)

CVE-2021-3426: Remove the "getfile" feature of the pydoc module which
could be abused to read arbitrary files on the disk (directory
traversal vulnerability). Moreover, even source code of Python
modules can contain sensitive data like passwords. Vulnerability
reported by David Schwörer.

4 years agobpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)
Inada Naoki [Mon, 29 Mar 2021 03:28:14 +0000 (12:28 +0900)] 
bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)

See [PEP 597](https://www.python.org/dev/peps/pep-0597/).

* Add `-X warn_default_encoding` and `PYTHONWARNDEFAULTENCODING`.
* Add EncodingWarning
* Add io.text_encoding()
* open(), TextIOWrapper() emits EncodingWarning when encoding is omitted and warn_default_encoding is enabled.
* _pyio.TextIOWrapper() uses UTF-8 as fallback default encoding used when failed to import locale module. (used during building Python)
* bz2, configparser, gzip, lzma, pathlib, tempfile modules use io.text_encoding().
* What's new entry

4 years agobpo-25643: Refactor the C tokenizer into smaller, logical units (GH-25050)
Pablo Galindo [Sun, 28 Mar 2021 22:48:05 +0000 (23:48 +0100)] 
bpo-25643: Refactor the C tokenizer into smaller, logical units (GH-25050)

4 years agobpo-31907: [doc] clarify that str.format() does not support arbitrary expressions...
Irit Katriel [Sun, 28 Mar 2021 20:47:20 +0000 (21:47 +0100)] 
bpo-31907: [doc] clarify that str.format() does not support arbitrary expressions (#25053)

4 years agobpo-43644: Add docs for importlib.resources.as_file. (#25048)
Jason R. Coombs [Sun, 28 Mar 2021 00:25:53 +0000 (20:25 -0400)] 
bpo-43644: Add docs for importlib.resources.as_file. (#25048)

4 years agobpo-43562: fix test_ssl to skip on unreachable network (GH-24937)
Carl Meyer [Sat, 27 Mar 2021 21:52:28 +0000 (15:52 -0600)] 
bpo-43562: fix test_ssl to skip on unreachable network (GH-24937)

This test checks result code of the connection directly, so it never raises an exception that can be suppressed by `support.transient_internet`. Directly support skipping the test in case of unreachable network.

4 years agobpo-39231: correct tutorial annotations section (GH-25029)
Irit Katriel [Sat, 27 Mar 2021 17:20:58 +0000 (17:20 +0000)] 
bpo-39231: correct tutorial annotations section (GH-25029)

4 years agobpo-43466: Unsupported static build hack (GH-25002)
Christian Heimes [Sat, 27 Mar 2021 17:03:54 +0000 (18:03 +0100)] 
bpo-43466: Unsupported static build hack (GH-25002)

Add undocumented hack to statically link ssl and hashlib modules with
OpenSSL.

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-39616: clarify SSLContext.check_hostname effect (GH-18484)
Ville Skyttä [Sat, 27 Mar 2021 14:20:11 +0000 (16:20 +0200)] 
bpo-39616: clarify SSLContext.check_hostname effect (GH-18484)

It doesn't actually affect whether match_hostname() is called (it
never is in this context any longer), but whether hostname
verification occurs in the first place.

4 years agobpo-40645: use C implementation of HMAC (GH-24920)
Christian Heimes [Sat, 27 Mar 2021 13:55:03 +0000 (14:55 +0100)] 
bpo-40645: use C implementation of HMAC (GH-24920)

- [x] fix tests
- [ ] add test scenarios for old/new code.

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43617: Check autoconf-archive package in configure.ac (GH-25016)
Christian Heimes [Sat, 27 Mar 2021 13:44:04 +0000 (14:44 +0100)] 
bpo-43617: Check autoconf-archive package in configure.ac (GH-25016)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43636: Validate the version tag in _PyType_Lookup (GH-25032)
Pablo Galindo [Sat, 27 Mar 2021 03:51:46 +0000 (03:51 +0000)] 
bpo-43636: Validate the version tag in _PyType_Lookup (GH-25032)

4 years agobpo-43354: xmlrpc: Fix type documentation for Fault.faultCode (GH-24707)
Jürgen Gmach [Fri, 26 Mar 2021 21:09:09 +0000 (22:09 +0100)] 
bpo-43354: xmlrpc: Fix type documentation for Fault.faultCode (GH-24707)

The type of `faultCode` has to be an `int` instead of a `str`.

cf http://xmlrpc.com/spec.md

Pinging @pganssle

4 years agobpo-42136: Deprecate module_repr() as found in importlib (GH-25022)
Brett Cannon [Fri, 26 Mar 2021 18:55:07 +0000 (11:55 -0700)] 
bpo-42136: Deprecate module_repr() as found in importlib (GH-25022)

4 years agobpo-43620: Remove reference to os.sep from os.path.join() doc (#25025)
Jared Sutton [Fri, 26 Mar 2021 16:02:32 +0000 (12:02 -0400)] 
bpo-43620: Remove reference to os.sep from os.path.join() doc (#25025)

- removed ambiguous reference to os.sep from os.path.join() doc

4 years agoRevert "bpo-40521: Remove freelist from collections.deque() (GH-21073)" (GH-24944)
Raymond Hettinger [Thu, 25 Mar 2021 20:32:23 +0000 (13:32 -0700)] 
Revert "bpo-40521: Remove freelist from collections.deque() (GH-21073)" (GH-24944)

This reverts commit 32f2eda85957365d208f499b730d30b7eb419741.
It can be re-applied if the subinterpreter PEP is approved.
Otherwise, the commit degraded performance with no offsetting
benefit.

4 years agobpo-43416: Add Include/README.rst (GH-24884)
Erlend Egeberg Aasland [Thu, 25 Mar 2021 16:16:31 +0000 (17:16 +0100)] 
bpo-43416: Add Include/README.rst (GH-24884)

4 years ago"exists" -> "exist" in What's New 3.10 (GH-25019)
blopblopy [Thu, 25 Mar 2021 16:14:22 +0000 (18:14 +0200)] 
"exists" -> "exist" in What's New 3.10 (GH-25019)

4 years agoMove big block of macros out of function to improve readability. (GH-25020)
Mark Shannon [Thu, 25 Mar 2021 12:00:30 +0000 (12:00 +0000)] 
Move big block of macros out of function to improve readability. (GH-25020)

4 years agoDoc: io: Remove "In-memory streams" section (GH-24927)
Inada Naoki [Thu, 25 Mar 2021 07:23:50 +0000 (16:23 +0900)] 
Doc: io: Remove "In-memory streams" section (GH-24927)

4 years agoAC: Update unsupported_special_methods (GH-24956)
Dong-hee Na [Thu, 25 Mar 2021 00:19:23 +0000 (09:19 +0900)] 
AC: Update unsupported_special_methods (GH-24956)

4 years agobpo-43198: Revert 3dd2157 that removed freeslot tracking. (#25010)
Raymond Hettinger [Wed, 24 Mar 2021 22:33:27 +0000 (15:33 -0700)] 
bpo-43198:  Revert 3dd2157 that removed freeslot tracking. (#25010)

4 years agobpo-41064: Improve syntax error for invalid usage of '**' in f-strings (GH-25006)
Pablo Galindo [Wed, 24 Mar 2021 19:34:17 +0000 (19:34 +0000)] 
bpo-41064: Improve syntax error for invalid usage of '**' in f-strings (GH-25006)

4 years agoOnly check evalbreaker after calls and on backwards egdes. Makes sure that __exit__...
Mark Shannon [Wed, 24 Mar 2021 17:56:12 +0000 (17:56 +0000)] 
Only check evalbreaker after calls and on backwards egdes. Makes sure that __exit__ or __aexit__ is called in with statments in case of interrupt. (GH-18334)

4 years agoFix typo in fuzzer.c (GH-25013)
Ikko Ashimine [Wed, 24 Mar 2021 15:47:21 +0000 (00:47 +0900)] 
Fix typo in fuzzer.c (GH-25013)

4 years agobpo-42137: have ModuleType.__repr__ prefer __spec__ over module_repr() (GH-24953)
Brett Cannon [Wed, 24 Mar 2021 15:26:56 +0000 (08:26 -0700)] 
bpo-42137: have ModuleType.__repr__ prefer __spec__ over module_repr() (GH-24953)

This is to work towards the removal of the use of  module_repr() in Python 3.12 (documented as deprecated since 3.4).

4 years agobpo-42914: add a pprint underscore_numbers option (GH-24864)
sblondon [Wed, 24 Mar 2021 08:23:20 +0000 (09:23 +0100)] 
bpo-42914: add a pprint underscore_numbers option (GH-24864)

pprint() gains a new boolean underscore_numbers kwarg to emit
integers with thousands separated by an underscore character
for improved readability (for example 1_000_000 instead of 1000000).

4 years agobpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008)
Pablo Galindo [Wed, 24 Mar 2021 01:42:13 +0000 (01:42 +0000)] 
bpo-31861: Fix reference leak in builtin_anext_impl() (GH-25008)

4 years agobpo-43244: Remove the pyarena.h header (GH-25007)
Victor Stinner [Wed, 24 Mar 2021 01:23:01 +0000 (02:23 +0100)] 
bpo-43244: Remove the pyarena.h header (GH-25007)

Remove the pyarena.h header file with functions:

* PyArena_New()
* PyArena_Free()
* PyArena_Malloc()
* PyArena_AddPyObject()

These functions were undocumented, excluded from the limited C API,
and were only used internally by the compiler.

Add pycore_pyarena.h header. Rename functions:

* PyArena_New() => _PyArena_New()
* PyArena_Free() => _PyArena_Free()
* PyArena_Malloc() => _PyArena_Malloc()
* PyArena_AddPyObject() => _PyArena_AddPyObject()

4 years agobpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005)
Pablo Galindo [Wed, 24 Mar 2021 00:30:02 +0000 (00:30 +0000)] 
bpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005)

4 years agobpo-43244: Remove parser_interface.h header file (GH-25001)
Victor Stinner [Wed, 24 Mar 2021 00:29:09 +0000 (01:29 +0100)] 
bpo-43244: Remove parser_interface.h header file (GH-25001)

Remove parser functions using the "struct _mod" type, because the
AST C API was removed:

* PyParser_ASTFromFile()
* PyParser_ASTFromFileObject()
* PyParser_ASTFromFilename()
* PyParser_ASTFromString()
* PyParser_ASTFromStringObject()

These functions were undocumented and excluded from the limited C
API.

Add pycore_parser.h internal header file. Rename functions:

* PyParser_ASTFromFileObject() => _PyParser_ASTFromFile()
* PyParser_ASTFromStringObject() => _PyParser_ASTFromString()

These functions are no longer exported (replace PyAPI_FUNC() with
extern).

Remove also _PyPegen_run_parser_from_file() function. Update
test_peg_generator to use _PyPegen_run_parser_from_file_pointer()
instead.

4 years agobpo-43452: Document the PyType_Lookup optimizations in the What's New for 3.10 (GH...
Pablo Galindo [Wed, 24 Mar 2021 00:04:52 +0000 (00:04 +0000)] 
bpo-43452: Document the PyType_Lookup optimizations in the What's New for 3.10 (GH-24949)

4 years agobpo-31861: Complete the C-API docs for PyObject_GetAiter and PyAiter_Check (GH-25004)
Pablo Galindo [Tue, 23 Mar 2021 23:57:03 +0000 (23:57 +0000)] 
bpo-31861: Complete the C-API docs for PyObject_GetAiter and PyAiter_Check (GH-25004)

4 years agobpo-43244: Add pycore_compile.h header file (GH-25000)
Victor Stinner [Tue, 23 Mar 2021 23:51:50 +0000 (00:51 +0100)] 
bpo-43244: Add pycore_compile.h header file (GH-25000)

Remove the compiler functions using "struct _mod" type, because the
public AST C API was removed:

* PyAST_Compile()
* PyAST_CompileEx()
* PyAST_CompileObject()
* PyFuture_FromAST()
* PyFuture_FromASTObject()

These functions were undocumented and excluded from the limited C API.

Rename functions:

* PyAST_CompileObject() => _PyAST_Compile()
* PyFuture_FromASTObject() => _PyFuture_FromAST()

Moreover, _PyFuture_FromAST() is no longer exported (replace
PyAPI_FUNC() with extern). _PyAST_Compile() remains exported for
test_peg_generator.

Remove also compatibility functions:

* PyAST_Compile()
* PyAST_CompileEx()
* PyFuture_FromAST()

4 years agobpo-31861: Add aiter and anext to builtins (#23847)
Joshua Bronson [Tue, 23 Mar 2021 22:47:21 +0000 (18:47 -0400)] 
bpo-31861: Add aiter and anext to builtins (#23847)

Co-authored-by: jab <jab@users.noreply.github.com>
Co-authored-by: Daniel Pope <mauve@mauveweb.co.uk>
Co-authored-by: Justin Wang <justin39@gmail.com>
4 years agobpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933)
Victor Stinner [Tue, 23 Mar 2021 19:47:40 +0000 (20:47 +0100)] 
bpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933)

These functions were undocumented and excluded from the limited C
API.

Most names defined by these header files were not prefixed by "Py"
and so could create names conflicts. For example, Python-ast.h
defined a "Yield" macro which was conflict with the "Yield" name used
by the Windows <winbase.h> header.

Use the Python ast module instead.

* Move Include/asdl.h to Include/internal/pycore_asdl.h.
* Move Include/Python-ast.h to Include/internal/pycore_ast.h.
* Remove ast.h header file.
* pycore_symtable.h no longer includes Python-ast.h.

4 years agobpo-41718: Update runpy startup time What's New (GH-24998)
Victor Stinner [Tue, 23 Mar 2021 19:22:40 +0000 (20:22 +0100)] 
bpo-41718: Update runpy startup time What's New (GH-24998)

4 years agobpo-41718: runpy now imports pkgutil in functions (GH-24996)
Victor Stinner [Tue, 23 Mar 2021 18:22:57 +0000 (19:22 +0100)] 
bpo-41718: runpy now imports pkgutil in functions (GH-24996)

Reduce the number of modules imported by "python3 -m module".

The runpy module no longer imports at startup (in the module body),
but only in functions using it: _get_code_from_file() and run_path().

4 years agobpo-41718: subprocess imports grp and pwd on demand (GH-24987)
Victor Stinner [Tue, 23 Mar 2021 16:42:51 +0000 (17:42 +0100)] 
bpo-41718: subprocess imports grp and pwd on demand (GH-24987)

The shutil and subprocess modules now only import the grp and pwd
modules when they are needed, which is not the case by default in
subprocess.

4 years agoClarify attribute docs on types.ModuleType (GH-24974)
Brett Cannon [Tue, 23 Mar 2021 15:25:39 +0000 (08:25 -0700)] 
Clarify attribute docs on types.ModuleType (GH-24974)

4 years agobpo-41718: libregrtest avoids importing datetime (GH-24985)
Victor Stinner [Tue, 23 Mar 2021 00:40:31 +0000 (01:40 +0100)] 
bpo-41718: libregrtest avoids importing datetime (GH-24985)

* libregrtest reimplements datetime.timedelta.__str__()
* support.testresult only imports datetime if USE_XML is true.

4 years agobpo-41718: Disable support.testresult XML output by default (GH-24982)
Victor Stinner [Tue, 23 Mar 2021 00:11:31 +0000 (01:11 +0100)] 
bpo-41718: Disable support.testresult XML output by default (GH-24982)

RegressionTestResult.USE_XML must now be set to True to get the JUnit
XML output.

Reduce the number of imports when --junit-xml=FILE option is not
used: 153 => 144 (-9).

4 years agobpo-41718: libregrtest runtest avoids import_helper (GH-24983)
Victor Stinner [Tue, 23 Mar 2021 00:08:49 +0000 (01:08 +0100)] 
bpo-41718: libregrtest runtest avoids import_helper (GH-24983)

Inline import_helper.unload() in libregrtest.runtest to avoid one
import.

4 years agobpo-41718: Reduce libregrtest runtest imports (GH-24980)
Victor Stinner [Mon, 22 Mar 2021 23:17:05 +0000 (00:17 +0100)] 
bpo-41718: Reduce libregrtest runtest imports (GH-24980)

Move clear_caches() from libregrtest.refleak to libregrtest.utils to
avoid importing libregrtest.refleak when it's not needed.

clear_caches() now only calls re.purge() if 're' is in sys.modules.

4 years agobpo-41718: regrtest saved_test_environment avoids imports (GH-24934)
Victor Stinner [Mon, 22 Mar 2021 22:52:13 +0000 (23:52 +0100)] 
bpo-41718: regrtest saved_test_environment avoids imports (GH-24934)

Reduce the number of modules imported by libregrtest.

saved_test_environment no longer imports modules at startup, but try
to get them from sys.modules. If an module is missing, skip the test.
It also sets directly support.environment_altered.

runtest() now now two saved_test_environment instances: one before
importing the test module, one after importing it.

Remove imports from test.libregrtest.save_env:

* asyncio
* logging
* multiprocessing
* shutil
* sysconfig
* urllib.request
* warnings

When a test method imports a module (ex: warnings) and the test
has a side effect (ex: add a warnings filter), the side effect is not
detected, because the module was not imported when Python
enters the saved_test_environment context manager.

4 years agobpo-43555: Report the column offset for invalid line continuation character (GH-24939)
Pablo Galindo [Mon, 22 Mar 2021 17:28:11 +0000 (17:28 +0000)] 
bpo-43555: Report the column offset for invalid line continuation character (GH-24939)

4 years agobpo-43591: Fix error location in interactive mode for errors at the end of the line...
Pablo Galindo [Mon, 22 Mar 2021 16:24:39 +0000 (16:24 +0000)] 
bpo-43591: Fix error location in interactive mode for errors at the end of the line (GH-24973)

Co-authored-by: Erlend Egeberg Aasland
4 years agoRevert "bpo-40521: Make dtoa bigint free list per-interpreter (GH-24821)" (GH-24964)
Victor Stinner [Mon, 22 Mar 2021 10:58:59 +0000 (11:58 +0100)] 
Revert "bpo-40521: Make dtoa bigint free list per-interpreter (GH-24821)" (GH-24964)

This reverts commit 5bd1059184b154d339f1bd53d23c98b5bcf14c8c.

4 years agobpo-43575: Use PEP 590 vectorcall to speed up map() (GH-24955)
Dong-hee Na [Mon, 22 Mar 2021 10:01:14 +0000 (19:01 +0900)] 
bpo-43575: Use PEP 590 vectorcall to speed up map() (GH-24955)

4 years agobpo-43551: Fix PyImport_Import() for subinterpreters (GH-24929)
junyixie [Mon, 22 Mar 2021 09:47:10 +0000 (17:47 +0800)] 
bpo-43551: Fix PyImport_Import() for subinterpreters (GH-24929)

Avoid static variables.

4 years agobpo-35134: Add include/cpython/compile.h (GH-24922)
Hai Shi [Mon, 22 Mar 2021 08:32:11 +0000 (16:32 +0800)] 
bpo-35134: Add include/cpython/compile.h (GH-24922)

Move C API excluded from the limited C API from Include/compile.h
to a new Include/cpython/compile.h header file.

4 years agobpo-43420: Simple optimizations for Fraction's arithmetics (GH-24779)
Sergey B Kirpichev [Mon, 22 Mar 2021 02:30:55 +0000 (05:30 +0300)] 
bpo-43420: Simple optimizations for Fraction's arithmetics (GH-24779)

bpo-43420: Implement standard transformations in + - * / that can often reduce the size of intermediate integers needed. For rationals with large components, this can yield dramatic speed improvements, but for small rationals can run 10-20% slower, due to increased fixed overheads in the longer-winded code. If those slowdowns turn out to be a problem, see the PR discussion for low-level implementation tricks that could cut other fixed overheads.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
4 years agobpo-43569: Add test/test_importlib/namespacedata01 to TESTSUBDIRS (GH-24952)
Jason R. Coombs [Sun, 21 Mar 2021 17:26:45 +0000 (13:26 -0400)] 
bpo-43569: Add test/test_importlib/namespacedata01 to TESTSUBDIRS (GH-24952)

4 years agobpo-43422: Revert _decimal C API addition (GH-24960) 24519/head
Antoine Pitrou [Sun, 21 Mar 2021 16:27:54 +0000 (17:27 +0100)] 
bpo-43422: Revert _decimal C API addition (GH-24960)

Stefan Krah requested the reversal of these (unreleased) changes, quoting him:
> The capsule API does not meet my testing standards, since I've focused
on the upstream mpdecimal in the last couple of months.
> Additionally, I'd like to refine the API, perhaps together with the
Arrow community.

Automerge-Triggered-By: GH:pitrou
4 years agobpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback (GH-24957)
Christian Heimes [Sun, 21 Mar 2021 15:13:09 +0000 (16:13 +0100)] 
bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback (GH-24957)

OpenSSL copies the internal message callback from SSL_CTX->msg_callback to
SSL->msg_callback. SSL_set_SSL_CTX() does not update SSL->msg_callback
to use the callback value of the new context.

PySSL_set_context() now resets the callback and _PySSL_msg_callback()
resets thread state in error path.

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-43542: Add heif/heic formats in mimetypes (GH-24917)
Ilya Stepin [Sat, 20 Mar 2021 23:06:27 +0000 (02:06 +0300)] 
bpo-43542: Add heif/heic formats in mimetypes (GH-24917)

* bpo-43542: Add heif/heic formats in mimetypes

Add HEIF and HEIC format to list of media types. It has IANA registration.

IANA: https://www.iana.org/assignments/media-types/image/heic
HEIF Github: https://github.com/nokiatech/heif

Co-authored-by: Gregory P. Smith <greg@krypto.org>