]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years ago[3.11] Fix typos in docs and comments (#109619) (#109622)
Alex Waygood [Wed, 20 Sep 2023 17:50:48 +0000 (18:50 +0100)] 
[3.11] Fix typos in docs and comments (#109619) (#109622)

Co-authored-by: Heinz-Alexander Fuetterer <35225576+afuetterer@users.noreply.github.com>
2 years ago[3.11] gh-103053: Skip test_freeze_simple_script() on PGO build (#109591) (#109616)
Victor Stinner [Wed, 20 Sep 2023 15:45:23 +0000 (17:45 +0200)] 
[3.11] gh-103053: Skip test_freeze_simple_script() on PGO build (#109591) (#109616)

gh-103053: Skip test_freeze_simple_script() on PGO build (#109591)

Skip test_freeze_simple_script() of test_tools.test_freeze if Python
is built with "./configure --enable-optimizations", which means with
Profile Guided Optimization (PGO): it just makes the test too slow.
The freeze tool is tested by many other CIs with other (faster)
compiler flags.

test.pythoninfo now gets also get_build_info() of
test.libregrtests.utils.

(cherry picked from commit 81cd1bd713624c3d26b647f3d28f2fd905887a0d)

2 years ago[3.11] gh-108973: Fix asyncio SubprocessProtocol doc (#109431) (#109610)
Victor Stinner [Wed, 20 Sep 2023 14:15:08 +0000 (16:15 +0200)] 
[3.11] gh-108973: Fix asyncio SubprocessProtocol doc (#109431) (#109610)

gh-108973: Fix asyncio SubprocessProtocol doc (#109431)

SubprocessProtocol process_exited() method can be called before
pipe_data_received() and pipe_connection_lost() methods. Document it
and adapt the example in the doc.

Co-authored-by: Davide Rizzo <sorcio@gmail.com>
(cherry picked from commit ced6924630037f1e5b3d1dbef2b600152fb07fbb)

2 years ago[3.11] Fix error handling in _PySys_UpdateConfig() (GH-109524) (GH-109551)
Miss Islington (bot) [Mon, 18 Sep 2023 18:24:41 +0000 (11:24 -0700)] 
[3.11] Fix error handling in _PySys_UpdateConfig() (GH-109524) (GH-109551)

(cherry picked from commit c829975428253568d47ebfc3104fa7386b5e0b58)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] gh-108843: fix ast.unparse for f-string with many quotes (#108980)
Shantanu [Mon, 18 Sep 2023 14:11:56 +0000 (07:11 -0700)] 
[3.11] gh-108843: fix ast.unparse for f-string with many quotes (#108980)

* [3.11] gh-108843: fix ast.unparse for f-string with many quotes

* 📜🤖 Added by blurb_it.

* simplify

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years ago[3.11] gh-109408: Azure Pipelines: test 3.12 branch (GH-109453) (#109536)
Miss Islington (bot) [Mon, 18 Sep 2023 13:03:44 +0000 (06:03 -0700)] 
[3.11] gh-109408: Azure Pipelines: test 3.12 branch (GH-109453) (#109536)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] Fix extraneous backslashes in hashlib docs (GH-109468) (#109531)
Miss Islington (bot) [Mon, 18 Sep 2023 07:34:20 +0000 (00:34 -0700)] 
[3.11] Fix extraneous backslashes in hashlib docs (GH-109468) (#109531)

Fix extraneous backslashes in hashlib docs (GH-109468)
(cherry picked from commit ce5b3e19e6fb940fa72db1b98a8df80f6e464265)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2 years ago[3.11] gh-109408: Remove Ubuntu unit tests from Azure Pipelines (GH-109452) (#109520)
Hugo van Kemenade [Sun, 17 Sep 2023 19:24:26 +0000 (13:24 -0600)] 
[3.11] gh-109408: Remove Ubuntu unit tests from Azure Pipelines (GH-109452) (#109520)

(cherry picked from commit a75daed7e004ee9a53b160307c4c072656176a02)

2 years ago[3.11] gh-109451: Fix wrong format specifier in logging documentation (GH-109465...
Miss Islington (bot) [Sat, 16 Sep 2023 14:39:06 +0000 (07:39 -0700)] 
[3.11] gh-109451: Fix wrong format specifier in logging documentation (GH-109465) (GH-109482)

(cherry picked from commit 929cc4e4a0999b777e1aa94f9c007db720e67f43)

2 years ago[3.11] gh-109414: Add some basic information about venvs in the introduction. (GH...
Miss Islington (bot) [Sat, 16 Sep 2023 10:14:07 +0000 (03:14 -0700)] 
[3.11] gh-109414: Add some basic information about venvs in the introduction. (GH-109440) (GH-109480)

(cherry picked from commit a6846d45ff3c836bc859c40e7684b57df991dc05)

2 years ago[3.11] gh-109474: Update two Unix packaging URLs (GH-109307) (#109478)
Miss Islington (bot) [Sat, 16 Sep 2023 07:56:16 +0000 (00:56 -0700)] 
[3.11] gh-109474: Update two Unix packaging URLs  (GH-109307) (#109478)

gh-109474: Update two Unix packaging URLs  (GH-109307)

update packaging URLs

fix a broken URL for fedora RPM packaging guide and fix a URL redirect for Slackware packaging guide.
(cherry picked from commit 0b38ce440bd76b3d25b6d042ee9613841fb4a947)

Co-authored-by: partev <petrosyan@gmail.com>
2 years ago[3.11] Fix date.__repr__() docstring (#109422) (#109449)
Victor Stinner [Fri, 15 Sep 2023 13:29:57 +0000 (15:29 +0200)] 
[3.11] Fix date.__repr__() docstring (#109422) (#109449)

Fix date.__repr__() docstring (#109422)

(cherry picked from commit 5eec58a9e57383128ade7b527965b1efc474735b)

Co-authored-by: Christopher Yeh <chrisyeh96@users.noreply.github.com>
2 years ago[3.11] Docs: Superseded modules: list only module names (GH-109439) (#109446)
Miss Islington (bot) [Fri, 15 Sep 2023 13:10:07 +0000 (06:10 -0700)] 
[3.11] Docs: Superseded modules: list only module names (GH-109439) (#109446)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] gh-109395: Remove skipped macOS builds from Azure Pipelines (GH-109400) (...
Miss Islington (bot) [Fri, 15 Sep 2023 09:18:54 +0000 (02:18 -0700)] 
[3.11] gh-109395: Remove skipped macOS builds from Azure Pipelines (GH-109400) (#109442)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years ago[3.11] gh-109395: Remove skipped coverage job from Azure Pipelines (GH-109412) (...
Miss Islington (bot) [Fri, 15 Sep 2023 09:10:41 +0000 (02:10 -0700)] 
[3.11] gh-109395: Remove skipped coverage job from Azure Pipelines (GH-109412) (#109434)

gh-109395: Remove skipped coverage job from Azure Pipelines (GH-109412)
(cherry picked from commit fa493900fbf19cbfac44164f3d8acb4f598ff3c1)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] gh-60283: Check for redefined test names in CI (#109161) (#109366)
Hugo van Kemenade [Fri, 15 Sep 2023 05:45:23 +0000 (23:45 -0600)] 
[3.11] gh-60283: Check for redefined test names in CI (#109161) (#109366)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
(cherry picked from commit 3cb9a8edca6e3fa0f0045b03a9a6444cf8f7affe)

2 years ago[3.11] gh-108822: Fix regrtest clear_caches() (#109432)
Victor Stinner [Fri, 15 Sep 2023 00:07:28 +0000 (02:07 +0200)] 
[3.11] gh-108822: Fix regrtest clear_caches() (#109432)

gh-108822: Fix regrtest clear_caches()

Python 3.11 doesn't have fractions._hash_algorithm cache.

2 years ago[3.11] gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (GH-109423) (#109427)
Miss Islington (bot) [Thu, 14 Sep 2023 22:52:40 +0000 (15:52 -0700)] 
[3.11] gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (GH-109423) (#109427)

gh-109396: Fix test_socket.test_hmac_sha1() in FIPS mode (GH-109423)

Use a longer key: FIPS mode requires at least of at least 112 bits.
The previous key was only 32 bits.
(cherry picked from commit e091b9f20fa8e409003af79f3c468b8225e6dcd3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] gh-101100: Fix sphinx warnings in `turtle.rst` (GH-109394) (#109417)
Miss Islington (bot) [Thu, 14 Sep 2023 18:41:26 +0000 (11:41 -0700)] 
[3.11] gh-101100: Fix sphinx warnings in `turtle.rst` (GH-109394) (#109417)

(cherry picked from commit 21e80f4c1925aaafae199840f8737b5c39a82c70)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years ago[3.11] gh-109351: Fix crash when compiling AST with invalid NamedExpr (GH-109352...
Miss Islington (bot) [Wed, 13 Sep 2023 16:32:08 +0000 (09:32 -0700)] 
[3.11] gh-109351: Fix crash when compiling AST with invalid NamedExpr (GH-109352) (#109380)

gh-109351: Fix crash when compiling AST with invalid NamedExpr (GH-109352)
(cherry picked from commit 79101edb03b7381b514126c68acabfcbbba2f842)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years ago[3.11] gh-104736: Fix test_gdb tests on ppc64le with clang (GH-109360) (#109362)
Miss Islington (bot) [Wed, 13 Sep 2023 04:48:44 +0000 (21:48 -0700)] 
[3.11] gh-104736: Fix test_gdb tests on ppc64le with clang (GH-109360) (#109362)

gh-104736: Fix test_gdb tests on ppc64le with clang (GH-109360)

Fix test_gdb on Python built with LLVM clang 16 on Linux ppc64le (ex:
Fedora 38). Search patterns in gdb "bt" command output to detect
when gdb fails to retrieve the traceback. For example, skip a test if
"Backtrace stopped: frame did not save the PC" is found.
(cherry picked from commit 44d9a71ea246e7c3fb478d9be62c16914be6c545)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] Update workflow permissions in require-pr-label Action (GH-109342) (#109354)
Mariatta [Wed, 13 Sep 2023 04:24:43 +0000 (21:24 -0700)] 
[3.11] Update workflow permissions in require-pr-label Action (GH-109342) (#109354)

Change the permission from `read` to `write`..
(cherry picked from commit 44c8699196c1951037bc549c895ea5af26c7254e)

2 years ago[3.11] GH-104395: Add a link in 'Meta Information' to the docs download page (GH...
Miss Islington (bot) [Tue, 12 Sep 2023 20:41:39 +0000 (13:41 -0700)] 
[3.11] GH-104395: Add a link in 'Meta Information' to the docs download page (GH-104443) (#109346)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] gh-109184: update traceback module doc w.r.t notes (message is no longer alway...
Irit Katriel [Tue, 12 Sep 2023 17:08:38 +0000 (18:08 +0100)] 
[3.11] gh-109184: update traceback module doc w.r.t notes (message is no longer always at the end) (#109201) (#109336)

gh-109184: update traceback module doc w.r.t notes (message is no longer always at the end) (#109201)

(cherry picked from commit 0e76cc359ba5d5e29d7c75355d7c1bc7e817eecf)

2 years ago[3.11] gh-84867: Do not load tests from TestCase and FunctionTestCase (GH-100497...
Miss Islington (bot) [Tue, 12 Sep 2023 14:05:58 +0000 (07:05 -0700)] 
[3.11] gh-84867: Do not load tests from TestCase and FunctionTestCase (GH-100497) (GH-109328)

(cherry picked from commit 66d1d7eb067d445f1ade151f4a6db3864dd9109f)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years ago[3.11] gh-109179: Fix traceback display for SyntaxErrors with notes (#109197) (#109283)
Irit Katriel [Tue, 12 Sep 2023 09:57:28 +0000 (10:57 +0100)] 
[3.11] gh-109179: Fix traceback display for SyntaxErrors with notes (#109197) (#109283)

gh-109179: Fix traceback display for SyntaxErrors with notes (#109197)

(cherry picked from commit ecd21a629a2a30bcae89902f7cad5670e9441e2c)

2 years ago[3.11] gh-107322: zipapp: Remove the suggestion to remove .dist-info directories...
Miss Islington (bot) [Tue, 12 Sep 2023 05:53:15 +0000 (22:53 -0700)] 
[3.11] gh-107322: zipapp: Remove the suggestion to remove .dist-info directories (GH-107296) (#109282)

Co-authored-by: wim glenn <hey@wimglenn.com>
2 years ago[3.11] gh-109295: Fix test_os.test_access_denied() for TEMP=cwd (GH-109299) (#109303)
Miss Islington (bot) [Tue, 12 Sep 2023 02:00:36 +0000 (19:00 -0700)] 
[3.11] gh-109295: Fix test_os.test_access_denied() for TEMP=cwd (GH-109299) (#109303)

gh-109295: Fix test_os.test_access_denied() for TEMP=cwd (GH-109299)

Fix test_os.test_access_denied() when the TEMP environment variable
is equal to the current working directory. Run the test using a
different filename, since self.fname already exists in this case.
(cherry picked from commit 7dedfd36dc16d9e1e15d7d0b0a636dd401a5a543)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] gh-109295: Clean up multiprocessing in test_asyncio and test_compileall (GH...
Miss Islington (bot) [Tue, 12 Sep 2023 01:53:59 +0000 (18:53 -0700)] 
[3.11] gh-109295: Clean up multiprocessing in test_asyncio and test_compileall (GH-109298) (#109302)

gh-109295: Clean up multiprocessing in test_asyncio and test_compileall (GH-109298)

test_asyncio and test_compileall now clean up multiprocessing by
calling multiprocessing _cleanup_tests(): explicitly clean up
resources and stop background processes like the resource tracker.
(cherry picked from commit 09ea4b8706165fd9474165090a0ba86509abd6c8)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] gh-108987: Fix _thread.start_new_thread() race condition (#109135) (#109272)
Victor Stinner [Mon, 11 Sep 2023 17:33:08 +0000 (19:33 +0200)] 
[3.11] gh-108987: Fix _thread.start_new_thread() race condition (#109135) (#109272)

gh-108987: Fix _thread.start_new_thread() race condition (#109135)

Fix _thread.start_new_thread() race condition. If a thread is created
during Python finalization, the newly spawned thread now exits
immediately instead of trying to access freed memory and lead to a
crash.

thread_run() calls PyEval_AcquireThread() which checks if the thread
must exit. The problem was that tstate was dereferenced earlier in
_PyThreadState_Bind() which leads to a crash most of the time.

Move _PyThreadState_CheckConsistency() from thread_run() to
_PyThreadState_Bind().

(cherry picked from commit 517cd82ea7d01b344804413ef05610934a43a241)

2 years ago[3.11] gh-90805: Make sure test_functools works with and without _functoolsmodule...
Miss Islington (bot) [Mon, 11 Sep 2023 16:35:41 +0000 (09:35 -0700)] 
[3.11] gh-90805: Make sure test_functools works with and without _functoolsmodule (GH-108644) (GH-109274)

(cherry picked from commit baa6dc8e388e71b2a00347143ecefb2ad3a8e53b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years ago[3.11] Test DocTestFinder directly instead of calling support.run_doctest() (GH-10891...
Miss Islington (bot) [Mon, 11 Sep 2023 11:30:24 +0000 (04:30 -0700)] 
[3.11] Test DocTestFinder directly instead of calling support.run_doctest() (GH-108917) (GH-109260)

(cherry picked from commit 0abc935086931d4915ea3c45cffffecb31e7a45c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] gh-107219: Fix concurrent.futures terminate_broken() (GH-109244) (#109255)
Miss Islington (bot) [Mon, 11 Sep 2023 08:52:17 +0000 (01:52 -0700)] 
[3.11] gh-107219: Fix concurrent.futures terminate_broken() (GH-109244) (#109255)

gh-107219: Fix concurrent.futures terminate_broken() (GH-109244)

Fix a race condition in concurrent.futures. When a process in the
process pool was terminated abruptly (while the future was running or
pending), close the connection write end. If the call queue is
blocked on sending bytes to a worker process, closing the connection
write end interrupts the send, so the queue can be closed.

Changes:

* _ExecutorManagerThread.terminate_broken() now closes
  call_queue._writer.
* multiprocessing PipeConnection.close() now interrupts
  WaitForMultipleObjects() in _send_bytes() by cancelling the
  overlapped operation.
(cherry picked from commit a9b1f84790e977fb09f75b148c4c4f5924a6ef99)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] gh-109230: test_pyexpat no longer depends on the current directory (GH-109233...
Miss Islington (bot) [Sun, 10 Sep 2023 22:46:47 +0000 (15:46 -0700)] 
[3.11] gh-109230: test_pyexpat no longer depends on the current directory (GH-109233) (#109242)

gh-109230: test_pyexpat no longer depends on the current directory (GH-109233)

Fix test_pyexpat.test_exception(): it can now be run from a directory
different than Python source code directory. Before, the test failed
in this case.

Skip the test if Modules/pyexpat.c source is not available. Skip also
the test on Python implementations other than CPython.
(cherry picked from commit e55aab95786e0e9fb36a9a1122d2d0fb3d2403cd)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] gh-109237: Fix test_site for non-ASCII working directory (GH-109238) (#109240)
Miss Islington (bot) [Sun, 10 Sep 2023 22:39:49 +0000 (15:39 -0700)] 
[3.11] gh-109237: Fix test_site for non-ASCII working directory (GH-109238) (#109240)

gh-109237: Fix test_site for non-ASCII working directory (GH-109238)

Fix test_site.test_underpth_basic() when the working directory
contains at least one non-ASCII character: encode the "._pth" file to
UTF-8 and enable the UTF-8 Mode to use UTF-8 for the child process
stdout.
(cherry picked from commit cbb3a6f8ada3d133c3ab9f9465b65067fce5bb42)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] gh-50644: Forbid pickling of codecs streams (GH-109180) (GH-109232)
Miss Islington (bot) [Sun, 10 Sep 2023 17:41:19 +0000 (10:41 -0700)] 
[3.11] gh-50644: Forbid pickling of codecs streams (GH-109180) (GH-109232)

Attempts to pickle or create a shallow or deep copy of codecs streams
now raise a TypeError.

Previously, copying failed with a RecursionError, while pickling
produced wrong results that eventually caused unpickling to fail with
a RecursionError.
(cherry picked from commit d6892c2b9263b39ea1c7905667942914b6a24b2c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] gh-109207: Fix SystemError when printing symtable entry object. (GH-109225...
Miss Islington (bot) [Sun, 10 Sep 2023 13:50:22 +0000 (06:50 -0700)] 
[3.11] gh-109207: Fix SystemError when printing symtable entry object. (GH-109225) (GH-109228)

(cherry picked from commit 429749969621b149c1a7c3c004bd44f52bec8f44)

Co-authored-by: 云line <31395137+yunline@users.noreply.github.com>
2 years ago[3.11] gh-107924: re-order os.sendfile() flag documentation (#107926) (#109178)
Hugo van Kemenade [Sat, 9 Sep 2023 09:34:18 +0000 (03:34 -0600)] 
[3.11] gh-107924: re-order os.sendfile() flag documentation (#107926) (#109178)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2 years ago[3.11] Check the result of PySet_Contains() for error in Python/symtable.c (GH-109146...
Serhiy Storchaka [Fri, 8 Sep 2023 19:28:18 +0000 (22:28 +0300)] 
[3.11] Check the result of PySet_Contains() for error in Python/symtable.c (GH-109146) (GH-109158)

(cherry picked from commit 87a7faf6b68c8076e640a9a1347a255f132d8382)

2 years ago[3.11] GH-109067: fix randomly failing `test_async_gen_asyncio_gc_aclose_09` test...
Miss Islington (bot) [Fri, 8 Sep 2023 17:02:57 +0000 (10:02 -0700)] 
[3.11] GH-109067: fix randomly failing `test_async_gen_asyncio_gc_aclose_09` test (GH-109142) (#109150)

GH-109067: fix randomly failing `test_async_gen_asyncio_gc_aclose_09` test (GH-109142)

Use `asyncio.sleep(0)` instead of short sleeps.
(cherry picked from commit ccd48623d4860e730a16f3f252d67bfea8c1e905)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2 years ago[3.11] gh-106922: Fix error location for constructs with spaces and parentheses ...
Miss Islington (bot) [Fri, 8 Sep 2023 16:56:10 +0000 (09:56 -0700)] 
[3.11] gh-106922: Fix error location for constructs with spaces and parentheses (GH-108959) (#109148)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2 years ago[3.11] gh-104690: thread_run() checks for tstate dangling pointer (#109056) (#109134)
Victor Stinner [Fri, 8 Sep 2023 11:10:33 +0000 (13:10 +0200)] 
[3.11] gh-104690: thread_run() checks for tstate dangling pointer (#109056) (#109134)

gh-104690: thread_run() checks for tstate dangling pointer (#109056)

thread_run() of _threadmodule.c now calls
_PyThreadState_CheckConsistency() to check if tstate is a dangling
pointer when Python is built in debug mode.

Rename ceval_gil.c is_tstate_valid() to
_PyThreadState_CheckConsistency() to reuse it in _threadmodule.c.

(cherry picked from commit f63d37877ad166041489a968233b57540f8456e8)

2 years ago[3.11] gh-108962: Skip test_tempfile.test_flags() if not supported (GH-108964) (...
Miss Islington (bot) [Fri, 8 Sep 2023 07:07:54 +0000 (00:07 -0700)] 
[3.11] gh-108962: Skip test_tempfile.test_flags() if not supported (GH-108964) (#108968)

gh-108962: Skip test_tempfile.test_flags() if not supported (GH-108964)

Skip test_tempfile.test_flags() if chflags() fails with "OSError:
[Errno 45] Operation not supported" (ex: on FreeBSD 13).
(cherry picked from commit cd2ef21b076b494224985e266c5f5f8b37c66618)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] gh-108682: [Enum] raise TypeError if super().__new__ called in custom __new__...
Ethan Furman [Fri, 8 Sep 2023 01:57:48 +0000 (18:57 -0700)] 
[3.11] gh-108682: [Enum] raise TypeError if super().__new__ called in custom __new__ (GH-108704) (GH-108739)

When overriding the `__new__` method of an enum, the underlying data type should be created directly; i.e. .

    member = object.__new__(cls)
    member = int.__new__(cls, value)
    member = str.__new__(cls, value)

Calling `super().__new__()` finds the lookup version of `Enum.__new__`, and will now raise an exception when detected.

(cherry picked from commit d48760b2f1e28dd3c1a35721939f400a8ab619b8)

2 years ago[3.11] gh-68403: Fix test_coverage in test_trace (GH-108910) (GH-109105)
Miss Islington (bot) [Thu, 7 Sep 2023 19:10:19 +0000 (12:10 -0700)] 
[3.11] gh-68403: Fix test_coverage in test_trace (GH-108910) (GH-109105)

Its behavior no longer affected by test running options such as -m.
(cherry picked from commit 7e1a7abb9831965cdec477e62dbe4f8415b8a582)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] gh-75743: Restore test_timeout.testConnectTimeout() (GH-109087) (#109102)
Miss Islington (bot) [Thu, 7 Sep 2023 18:55:50 +0000 (11:55 -0700)] 
[3.11] gh-75743: Restore test_timeout.testConnectTimeout() (GH-109087) (#109102)

gh-75743: Restore test_timeout.testConnectTimeout() (GH-109087)

This un-skips this test now that pythontest.net implements appropriate firewall
rules for it.
(cherry picked from commit 1829a3c9a3712b6a68a3a449e4a08787c73da51d)

Co-authored-by: Ee Durbin <ewdurbin@gmail.com>
2 years ago[3.11] gh-88943: Improve syntax error for non-ASCII character that follows a numerica...
Serhiy Storchaka [Thu, 7 Sep 2023 14:54:07 +0000 (17:54 +0300)] 
[3.11] gh-88943: Improve syntax error for non-ASCII character that follows a numerical literal (GH-109081) (GH-109091)

It now points on the invalid non-ASCII character, not on the valid numerical literal.
(cherry picked from commit b2729e93e9d73503b1fda4ea4fecd77c58909091)

2 years ago[3.11] gh-102823: Document return type of floor division on floats (GH-102824) (...
Miss Islington (bot) [Thu, 7 Sep 2023 14:34:30 +0000 (07:34 -0700)] 
[3.11] gh-102823: Document return type of floor division on floats (GH-102824) (#109093)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] gh-103186: Suppress RuntimeWarning about unclosed async iterator in test_sys_s...
Serhiy Storchaka [Thu, 7 Sep 2023 14:16:13 +0000 (17:16 +0300)] 
[3.11] gh-103186: Suppress RuntimeWarning about unclosed async iterator in test_sys_settrace (GH-109075) (GH-109086)

(cherry picked from commit d485551c9d1792ff3539eef1d6374bd4c01dcd5d)

2 years ago[3.11] gh-103186: Remove debug print in test_sys_settrace (GH-109077) (GH-109085)
Miss Islington (bot) [Thu, 7 Sep 2023 14:13:42 +0000 (07:13 -0700)] 
[3.11] gh-103186: Remove debug print in test_sys_settrace (GH-109077) (GH-109085)

(cherry picked from commit e4bb0026b9a21d066e7a5c4716ea4d755b95d2d5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] gh-71770: Add more details on behavior of configparser's default_section ...
Miss Islington (bot) [Thu, 7 Sep 2023 14:03:20 +0000 (07:03 -0700)] 
[3.11] gh-71770: Add more details on behavior of configparser's default_section (GH-31562) (#109089)

Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] GH-90915: Document that SystemExit doesn't trigger sys.excepthook (GH-31357...
Miss Islington (bot) [Thu, 7 Sep 2023 13:23:08 +0000 (06:23 -0700)] 
[3.11] GH-90915: Document that SystemExit doesn't trigger sys.excepthook (GH-31357) (#109083)

Co-authored-by: Colin Watson <cjwatson@debian.org>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] socket documentation fix - rename triple to 3-tuple (GH-24722) (#109074)
Miss Islington (bot) [Thu, 7 Sep 2023 10:44:35 +0000 (03:44 -0700)] 
[3.11] socket documentation fix - rename triple to 3-tuple (GH-24722) (#109074)

Co-authored-by: Ori Hoch <ori@uumpa.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] bpo-38157: Add example about per file output for mock_open. (GH-16090) (#109072)
Miss Islington (bot) [Thu, 7 Sep 2023 09:32:28 +0000 (02:32 -0700)] 
[3.11] bpo-38157: Add example about per file output for mock_open. (GH-16090) (#109072)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] test.pythoninfo logs freedesktop_os_release() (GH-109057) (#109063)
Miss Islington (bot) [Thu, 7 Sep 2023 06:13:34 +0000 (23:13 -0700)] 
[3.11] test.pythoninfo logs freedesktop_os_release() (GH-109057) (#109063)

test.pythoninfo logs freedesktop_os_release() (GH-109057)
(cherry picked from commit babdced23fc299b7607ac76abfdd7a81050f8359)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] gh-108915: Removes extra backslashes in str.split docstring (GH-109044) (...
Shantanu [Thu, 7 Sep 2023 06:07:57 +0000 (23:07 -0700)] 
[3.11] gh-108915: Removes extra backslashes in str.split docstring (GH-109044) (#109062)

[3.11] gh-108915: Removes extra backslashes in str.split docstring (GH-109044).
(cherry picked from commit e7d5433f944a5725aa82595f9251abfc8a63d333)

Co-authored-by: Daniel Weiss <134341009+justdan6@users.noreply.github.com>
2 years ago[3.11] Docs: Fix typo in datetime.tzinfo docstring (GH-107257) (#109055)
Mikhail Samylov [Thu, 7 Sep 2023 05:32:55 +0000 (08:32 +0300)] 
[3.11] Docs: Fix typo in datetime.tzinfo docstring (GH-107257) (#109055)

2 years ago[3.11] gh-109015: Add test.support.socket_helper.tcp_blackhole() (#109016) (#109042)
Victor Stinner [Thu, 7 Sep 2023 00:34:16 +0000 (02:34 +0200)] 
[3.11] gh-109015: Add test.support.socket_helper.tcp_blackhole() (#109016) (#109042)

gh-109015: Add test.support.socket_helper.tcp_blackhole() (#109016)

Skip test_asyncio, test_imaplib and test_socket tests if FreeBSD TCP
blackhole is enabled (net.inet.tcp.blackhole=2).

(cherry picked from commit a52a3509770f29f940cda9307704908949912276)

2 years ago[3.11] gh-107755: Document the correct default value of slice step (GH-107756) (...
Miss Islington (bot) [Thu, 7 Sep 2023 00:11:53 +0000 (17:11 -0700)] 
[3.11] gh-107755: Document the correct default value of slice step (GH-107756) (#108956)

gh-107755: Document the correct default value of slice step (GH-107756)

Document the correct default value of slice step.
(cherry picked from commit 9bf350b0662fcf1a8b43b9293e6c8ecf3c711561)

Co-authored-by: wim glenn <hey@wimglenn.com>
2 years ago[3.11] GH-108202: Document ``calendar``'s command-line interface (GH-109020) (#109031)
Miss Islington (bot) [Thu, 7 Sep 2023 00:11:06 +0000 (17:11 -0700)] 
[3.11] GH-108202: Document ``calendar``'s command-line interface (GH-109020) (#109031)

GH-108202: Document ``calendar``'s command-line interface (GH-109020)
(cherry picked from commit f0f96a9f40762499811681d405b6f922b6ed7a55)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] gh-108740: Fix "make regen-all" race condition (#108741) (#109021)
Victor Stinner [Wed, 6 Sep 2023 21:00:30 +0000 (23:00 +0200)] 
[3.11] gh-108740: Fix "make regen-all" race condition (#108741) (#109021)

gh-108740: Fix "make regen-all" race condition (#108741)

Fix a race condition in "make regen-all". The deepfreeze.c source and
files generated by Argument Clinic are now generated or updated
before generating "global objects". Previously, some identifiers may
miss depending on the order in which these files were generated.

* "make regen-global-objects": Make sure that deepfreeze.c is
  generated and up to date, and always run "make clinic".
* "make regen-deepfreeze" now only updates deepfreeze.c (C file).
  It doesn't build deepfreeze.o (object) anymore.
* Remove misleading messages in "make regen-global-objects" and
  "make clinic". They are now outdated, these commands are now
  safe to use.

Backport notes:

* Omit Doc/using/configure.rst changes.
* no need to change "make clinic", it didn't run
  generate_global_objects.py script before.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
(cherry picked from commit db1ee6a19ab62191c16ecb732cb4dcaede98a902)

2 years ago[3.11] gh-109002: Ensure only one wheel for each vendored package (GH-109003) (#109006)
Miss Islington (bot) [Wed, 6 Sep 2023 18:01:25 +0000 (11:01 -0700)] 
[3.11] gh-109002: Ensure only one wheel for each vendored package (GH-109003) (#109006)

Output with one wheel:
```
❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py
Verifying checksum for /Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl.
Expected digest: 7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be
Actual digest:   7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be
::notice file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl::Successfully verified the checksum of the pip wheel.
```

Output with two wheels:
```
❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py
::error file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl::Found more than one wheel for package pip.

::error file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl::Found more than one wheel for package pip.
```

Output without wheels:
```
❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py
::error file=::Could not find a pip wheel on disk.
```
(cherry picked from commit f8a047941f2e4a1848700c21d58a08c9ec6a9c68)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years ago[3.11] gh-108851: Fix tomllib recursion tests (#108853) (#109013)
Victor Stinner [Wed, 6 Sep 2023 16:40:39 +0000 (18:40 +0200)] 
[3.11] gh-108851: Fix tomllib recursion tests (#108853) (#109013)

gh-108851: Fix tomllib recursion tests (#108853)

* Add get_recursion_available() and get_recursion_depth() functions
  to the test.support module.
* Change infinite_recursion() default max_depth from 75 to 100.
* Fix test_tomllib recursion tests for WASI buildbots: reduce the
  recursion limit and compute the maximum nested array/dict depending
  on the current available recursion limit.
* test.pythoninfo logs sys.getrecursionlimit().
* Enhance test_sys tests on sys.getrecursionlimit()
  and sys.setrecursionlimit().

Backport notes:

* Set support.infinite_recursion() minimum to 4 frames.
* test_support.test_get_recursion_depth() uses limit-2, apparently
  f-string counts for 2 frames in Python 3.11.
* test_sys.test_setrecursionlimit_to_depth() tests depth+2 instead of
  depth+1.

(cherry picked from commit 8ff11425783806f8cb78e99f667546b1f7f3428e)

2 years ago[3.11] gh-91960: Skip test_gdb if gdb cannot retrive Python frames (GH-108999) (...
Miss Islington (bot) [Wed, 6 Sep 2023 15:32:36 +0000 (08:32 -0700)] 
[3.11] gh-91960: Skip test_gdb if gdb cannot retrive Python frames (GH-108999) (#109011)

gh-91960: Skip test_gdb if gdb cannot retrive Python frames (GH-108999)

Skip test_gdb if gdb is unable to retrieve Python frame objects: if a
frame is "<optimized out>". When Python is built with "clang -Og",
gdb can fail to retrive the 'frame' parameter of
_PyEval_EvalFrameDefault(). In this case, tests like py_bt() are
likely to fail. Without getting access to Python frames,
python-gdb.py is mostly clueless on retrieving the Python traceback.
Moreover, test_gdb is no longer skipped on macOS if Python is built
with Clang.
(cherry picked from commit fbce43a251488f666be9794c908a6613bf8ae260)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] gh-108983: Add more PEP 526 tests to `test_grammar` (GH-108984) (#109001)
Miss Islington (bot) [Wed, 6 Sep 2023 14:09:54 +0000 (07:09 -0700)] 
[3.11] gh-108983: Add more PEP 526 tests to `test_grammar` (GH-108984) (#109001)

gh-108983: Add more PEP 526 tests to `test_grammar` (GH-108984)
(cherry picked from commit 1fb20d42c58924e2e941622b3539645c7b843e0e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years ago[3.11] gh-108857: improve markup in inspect.Signature.replace() docs (GH-108862)...
Miss Islington (bot) [Wed, 6 Sep 2023 00:39:09 +0000 (17:39 -0700)] 
[3.11] gh-108857: improve markup in inspect.Signature.replace() docs (GH-108862) (#108970)

gh-108857: improve markup in inspect.Signature.replace() docs (GH-108862)
(cherry picked from commit 6f8411cfd68134ccae01b0b4cb332578008a69e3)

Co-authored-by: nabin2004 <107109731+nabin2004@users.noreply.github.com>
2 years ago[3.11] gh-107565: Update Windows build to use OpenSSL 3.0.10 (GH-108932)
Zachary Ware [Tue, 5 Sep 2023 16:54:23 +0000 (11:54 -0500)] 
[3.11] gh-107565: Update Windows build to use OpenSSL 3.0.10 (GH-108932)

2 years ago[3.11] gh-108416: Mark slow but not CPU bound test methods with requires_resource...
Serhiy Storchaka [Tue, 5 Sep 2023 15:27:55 +0000 (18:27 +0300)] 
[3.11] gh-108416: Mark slow but not CPU bound test methods with requires_resource('walltime') (GH-108480) (GH-108924)

(cherry picked from commit 1e0d62793a84001e92f1c80b511d3a212b435acc)

2 years ago[3.11] gh-89392: Use unittest test runner for doctests in test_getopt (GH-108916...
Miss Islington (bot) [Tue, 5 Sep 2023 15:08:14 +0000 (08:08 -0700)] 
[3.11] gh-89392: Use unittest test runner for doctests in test_getopt (GH-108916) (GH-108920)

(cherry picked from commit f980cc19b9cafc09ef21e906871f810a1c89e62f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] gh-89392: Use normal unittest runner in test_type_cache (GH-108911) (GH-108914)
Miss Islington (bot) [Tue, 5 Sep 2023 14:11:49 +0000 (07:11 -0700)] 
[3.11] gh-89392: Use normal unittest runner in test_type_cache (GH-108911) (GH-108914)

(cherry picked from commit eaabaac7c099884f92428a7bb04ffa1f1d6080dd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] gh-89392: Remove support of test_main() in libregrtest (GH-108876) (GH-108898)
Serhiy Storchaka [Tue, 5 Sep 2023 06:54:12 +0000 (09:54 +0300)] 
[3.11] gh-89392: Remove support of test_main() in libregrtest (GH-108876) (GH-108898)

(cherry picked from commit 04a0830b00879efe057e3dfe75e9aa9c0caf1a26)

2 years ago[3.11] gh-89392: Fix running test_pep646_syntax as script (GH-108875) (GH-108877)
Miss Islington (bot) [Tue, 5 Sep 2023 06:41:15 +0000 (23:41 -0700)] 
[3.11] gh-89392: Fix running test_pep646_syntax as script (GH-108875) (GH-108877)

(cherry picked from commit f3b6608ba2b1db6ac449f656bf439bda8d66eb9f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] CI: Bump GitHub Actions (GH-108879) (#108891)
Hugo van Kemenade [Tue, 5 Sep 2023 00:21:07 +0000 (18:21 -0600)] 
[3.11] CI: Bump GitHub Actions (GH-108879) (#108891)

Bump GitHub Actions

2 years ago[3.11] bpo-45229: Make ElementTree tests discoverable (GH-108859) (GH-108874)
Serhiy Storchaka [Mon, 4 Sep 2023 10:43:12 +0000 (13:43 +0300)] 
[3.11] bpo-45229: Make ElementTree tests discoverable (GH-108859) (GH-108874)

(cherry picked from commit 074ac1f72e392a576516639f650bac0519d1cb52)

2 years ago[3.11] gh-89392: Remove test_main() in test_netrc (GH-108860) (GH-108868)
Miss Islington (bot) [Mon, 4 Sep 2023 10:20:24 +0000 (03:20 -0700)] 
[3.11] gh-89392: Remove test_main() in test_netrc (GH-108860) (GH-108868)

(cherry picked from commit 76f3c043b6c5971d5a13fc6decf87a80ddf7ef95)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] gh-89392: Make test_pep646_syntax discoverable (GH-108861) (GH-108869)
Miss Islington (bot) [Mon, 4 Sep 2023 10:11:33 +0000 (03:11 -0700)] 
[3.11] gh-89392: Make test_pep646_syntax discoverable (GH-108861) (GH-108869)

(cherry picked from commit d0b22f6bd84239e50b43709f98f2bb950222cfe5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] gh-108822: Backport libregrtest changes from the main branch (#108820)
Victor Stinner [Sun, 3 Sep 2023 17:21:53 +0000 (19:21 +0200)] 
[3.11] gh-108822: Backport libregrtest changes from the main branch (#108820)

* Revert "[3.11] gh-101634: regrtest reports decoding error as failed test (#106169) (#106175)"

This reverts commit d5418e97fc524420011a370ba3c2c3cf6a89a74f.

* Revert "[3.11] bpo-46523: fix tests rerun when `setUp[Class|Module]` fails (GH-30895) (GH-103342)"

This reverts commit ecb09a849689764193e0115d27e220f82b5f6d9f.

* Revert "gh-95027: Fix regrtest stdout encoding on Windows (GH-98492)"

This reverts commit b2aa28eec56d07b9c6777b02b7247cf21839de9f.

* Revert "[3.11] gh-94026: Buffer regrtest worker stdout in temporary file (GH-94253) (GH-94408)"

This reverts commit 0122ab235b5acb52dd99fd05d8802a00f438b828.

* Revert "Run Tools/scripts/reindent.py (GH-94225)"

This reverts commit f0f3a424afb00a15ce8c0140dd218f5b33929be6.

* Revert "gh-94052: Don't re-run failed tests with --python option (GH-94054)"

This reverts commit 1347607db12012f6458ffcba48d8ad797083812e.

* Revert "[3.11] gh-84461: Fix Emscripten umask and permission issues (GH-94002) (GH-94006)"

This reverts commit 10731849184a3101ed18683b0128d689f1671c3f.

* gh-93353: regrtest checks for leaked temporary files (#93776)

When running tests with -jN, create a temporary directory per process
and mark a test as "environment changed" if a test leaks a temporary
file or directory.

(cherry picked from commit e566ce5496f1bad81c431aaee65e36d5e44771c5)

* gh-93353: Fix regrtest for -jN with N >= 2 (GH-93813)

(cherry picked from commit 36934a16e86f34d69ba2d41630fb5b4d06d59cff)

* gh-93353: regrtest supports checking tmp files with -j2 (#93909)

regrtest now also implements checking for leaked temporary files and
directories when using -jN for N >= 2. Use tempfile.mkdtemp() to
create the temporary directory. Skip this check on WASI.

(cherry picked from commit 4f85cec9e2077681b3dacc3108e646d509b720bf)

* gh-84461: Fix Emscripten umask and permission issues (GH-94002)

- Emscripten's default umask is too strict, see
  https://github.com/emscripten-core/emscripten/issues/17269
- getuid/getgid and geteuid/getegid are stubs that always return 0
  (root). Disable effective uid/gid syscalls and fix tests that use
  chmod() current user.
- Cannot drop X bit from directory.

(cherry picked from commit 2702e408fd0e0dd7aec396b4cf8c7ce9caae81d8)

* gh-94052: Don't re-run failed tests with --python option (#94054)

(cherry picked from commit 0ff7b996f5d836e63cdaf652c7aa734285261096)

* Run Tools/scripts/reindent.py (#94225)

Reindent files which were not properly formatted (PEP 8: 4 spaces).

Remove also some trailing spaces.

(cherry picked from commit e87ada48a9e5d9d03f9759138869216df0d7383a)

* gh-94026: Buffer regrtest worker stdout in temporary file (GH-94253)

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit 199ba233248ab279f445e0809c2077976f0711bc)

* gh-96465: Clear fractions hash lru_cache under refleak testing (GH-96689)

Automerge-Triggered-By: GH:zware
(cherry picked from commit 9c8f3794337457b1d905a9fa0f38c2978fe32abd)

* gh-95027: Fix regrtest stdout encoding on Windows (#98492)

On Windows, when the Python test suite is run with the -jN option,
the ANSI code page is now used as the encoding for the stdout
temporary file, rather than using UTF-8 which can lead to decoding
errors.

(cherry picked from commit ec1f6f5f139868dc2c1116a7c7c878c38c668d53)

* gh-98903: Test suite fails with exit code 4 if no tests ran (#98904)

The Python test suite now fails wit exit code 4 if no tests ran. It
should help detecting typos in test names and test methods.

* Add "EXITCODE_" constants to Lib/test/libregrtest/main.py.
* Fix a typo: "NO TEST RUN" becomes "NO TESTS RAN"

(cherry picked from commit c76db37c0d23174cbffd6fa978d39693890ef020)

* gh-100086: Add build info to test.libregrtest (#100093)

The Python test runner (libregrtest) now logs Python build information like
"debug" vs "release" build, or LTO and PGO optimizations.

(cherry picked from commit 3c892022472eb975360fb3f0caa6f6fcc6fbf220)

* bpo-46523: fix tests rerun when `setUp[Class|Module]` fails (#30895)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 995386071f96e4cfebfa027a71ca9134e4651d2a)

* gh-82054: allow test runner to split test_asyncio to execute in parallel by sharding. (#103927)

This runs test_asyncio sub-tests in parallel using sharding from Cinder. This suite is typically the longest-pole in runs because it is a test package with a lot of further sub-tests otherwise run serially. By breaking out the sub-tests as independent modules we can run a lot more in parallel.

After porting we can see the direct impact on a multicore system.

Without this change:
  Running make test is 5 min 26 seconds
With this change:
  Running make test takes 3 min 39 seconds

That'll vary based on system and parallelism. On a `-j 4` run similar to what CI and buildbot systems often do, it reduced the overall test suite completion latency by 10%.

The drawbacks are that this implementation is hacky and due to the sorting of the tests it obscures when the asyncio tests occur and involves changing CPython test infrastructure but, the wall time saved it is worth it, especially in low-core count CI runs as it pulls a long tail. The win for productivity and reserved CI resource usage is significant.

Future tests that deserve to be refactored into split up suites to benefit from are test_concurrent_futures and the way the _test_multiprocessing suite gets run for all start methods. As exposed by passing the -o flag to python -m test to get a list of the 10 longest running tests.

---------

Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google, LLC]
(cherry picked from commit 9e011e7c77dad7d0bbb944c44891531606caeb21)

* Display the sanitizer config in the regrtest header. (#105301)

Display the sanitizers present in libregrtest.

Having this in the CI output for tests with the relevant environment
variable displayed will help make it easier to do what we need to
create an equivalent local test run.

(cherry picked from commit 852348ab65783601e0844b6647ea033668b45c11)

* gh-101634: regrtest reports decoding error as failed test (#106169)

When running the Python test suite with -jN option, if a worker stdout
cannot be decoded from the locale encoding report a failed testn so the
exitcode is non-zero.

(cherry picked from commit 2ac3eec103cf450aaaebeb932e51155d2e7fb37b)

* gh-108223: test.pythoninfo and libregrtest log Py_NOGIL (#108238)

Enable with --disable-gil --without-pydebug:

    $ make pythoninfo|grep NOGIL
    sysconfig[Py_NOGIL]: 1

    $ ./python -m test
    ...
    == Python build: nogil debug
    ...

(cherry picked from commit 5afe0c17ca14df430736e549542a4b85e7e7c7ac)

* gh-90791: test.pythoninfo logs ASAN_OPTIONS env var (#108289)

* Cleanup libregrtest code logging ASAN_OPTIONS.
* Fix a typo on "ASAN_OPTIONS" vs "MSAN_OPTIONS".

(cherry picked from commit 3a1ac87f8f89d3206b46a0df4908afae629d669d)

* gh-108388: regrtest splits test_asyncio package (#108393)

Currently, test_asyncio package is only splitted into sub-tests when
using command "./python -m test". With this change, it's also
splitted when passing it on the command line:
"./python -m test test_asyncio".

Remove the concept of "STDTESTS". Python is now mature enough to not
have to bother with that anymore. Removing STDTESTS simplify the
code.

(cherry picked from commit 174e9da0836844a2138cc8915dd305cb2cd7a583)

* regrtest computes statistics (#108793)

test_netrc, test_pep646_syntax and test_xml_etree now return results
in the test_main() function.

Changes:

* Rewrite TestResult as a dataclass with a new State class.
* Add test.support.TestStats class and Regrtest.stats_dict attribute.
* libregrtest.runtest functions now modify a TestResult instance
  in-place.
* libregrtest summary lists the number of run tests and skipped
  tests, and denied resources.
* Add TestResult.has_meaningful_duration() method.
* Compute TestResult duration in the upper function.
* Use time.perf_counter() instead of time.monotonic().
* Regrtest: rename 'resource_denieds' attribute to 'resource_denied'.
* Rename CHILD_ERROR to MULTIPROCESSING_ERROR.
* Use match/case syntadx to have different code depending on the
  test state.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit d4e534cbb35678c82b3a1276826af55d7bfc23b6)

* gh-108822: Add Changelog entry for regrtest statistics (#108821)

---------

Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Zachary Ware <zach@python.org>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Joshua Herman <zitterbewegung@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years ago[3.11] Reorder some test's decorators (GH-108804) (GH-108845)
Miss Islington (bot) [Sun, 3 Sep 2023 13:01:49 +0000 (06:01 -0700)] 
[3.11] Reorder some test's decorators (GH-108804) (GH-108845)

For example, do not demand the 'cpu' resource if the test cannot be run
due to non-working threads.
(cherry picked from commit 509bb61977cc8a4487efd3f9cdd63d9f7b86be62)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years ago[3.11] [3.12] gh-63760: Don't declare gethostname() on Solaris (GH-108817) (GH-108824...
Miss Islington (bot) [Sun, 3 Sep 2023 06:53:02 +0000 (23:53 -0700)] 
[3.11] [3.12] gh-63760: Don't declare gethostname() on Solaris (GH-108817) (GH-108824) (#108832)

[3.12] gh-63760: Don't declare gethostname() on Solaris (GH-108817) (GH-108824)

gh-63760: Don't declare gethostname() on Solaris (GH-108817)

Since 2005, Solaris defines gethostname(). socketmodule.c no longer
has to define gethostname() for Solaris.

Oracle Solaris and OpenSolaris have patches to remove the
gethostname() definition in Python:

* https://github.com/oracle/solaris-userland/blob/master/components/python/python37/patches/15-gethostname.patch
* https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/python37/patches/15-gethostname.patch
* https://github.com/omniosorg/omnios-build/blob/master/build/python27/patches/24-gethostname.patch

(cherry picked from commit 7269916cd7b89b5e6f20bfe83ebe1038bda56b4b)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
(cherry picked from commit 0e6d582b3b73a88e71cae04327b31a1ee203722c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years ago[3.11] gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421...
Serhiy Storchaka [Sun, 3 Sep 2023 06:34:30 +0000 (09:34 +0300)] 
[3.11] gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421) (GH-108799)

Only mark tests which spend significant system or user time,
by itself or in subprocesses.
(cherry picked from commit f3ba0a74cd50274acdcd592d4ce8395b92492b7c)

2 years ago[3.11] gh-101100: Fix sphinx warnings in `unittest.mock-examples.rst` (GH-108810...
Nikita Sobolev [Sat, 2 Sep 2023 13:38:59 +0000 (16:38 +0300)] 
[3.11] gh-101100: Fix sphinx warnings in `unittest.mock-examples.rst` (GH-108810) (#108812)

(cherry picked from commit 5141b1ebe07ad54279e0770b4704eaf76f24951d)

2 years ago[3.11] gh-101100: Fix sphinx warnings in `uuid.rst` (GH-108805) (#108808)
Miss Islington (bot) [Sat, 2 Sep 2023 13:05:07 +0000 (06:05 -0700)] 
[3.11] gh-101100: Fix sphinx warnings in `uuid.rst` (GH-108805) (#108808)

(cherry picked from commit 21da4980f5916e8fd648f04367a9e60d141af366)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years ago[3.11] gh-103186: assert in tests that UnsafeMailcapInput warnings are provided ...
Miss Islington (bot) [Sat, 2 Sep 2023 05:53:48 +0000 (22:53 -0700)] 
[3.11] gh-103186: assert in tests that UnsafeMailcapInput warnings are provided (GH-103217) (GH-108800)

(cherry picked from commit 1724553e6e8baae655901488968a40df981f32da)

Co-authored-by: Ijtaba Hussain <ijtabahussain@live.com>
2 years ago[3.11] Improve some C API documentation (GH-108768) (GH-108786)
Serhiy Storchaka [Sat, 2 Sep 2023 04:30:32 +0000 (07:30 +0300)] 
[3.11] Improve some C API documentation (GH-108768) (GH-108786)

* Express functions which take argument as a C string in terms of
  functions which take Python object.
* Use "note" directive for PyMapping_HasKey() and
  PyMapping_HasKeyString() notes.

(cherry picked from commit 6f97eeec222f81bd7ae836c149872a40b079e2a6)

2 years ago[3.11] gh-105563: reference DateType in datetime's documentation (GH-105946) (#108790)
Miss Islington (bot) [Fri, 1 Sep 2023 20:46:21 +0000 (13:46 -0700)] 
[3.11] gh-105563: reference DateType in datetime's documentation (GH-105946) (#108790)

gh-105563: reference DateType in datetime's documentation (GH-105946)
(cherry picked from commit 8f9ea43ee805f98391f857397daac9df7ffa71cd)

Co-authored-by: TATHAGATA ROY <royzen9495@gmail.com>
2 years ago[3.11] gh-101100: Fix sphinx warnings in `tutorial/appendix.rst` (GH-108750) (#108757)
Miss Islington (bot) [Fri, 1 Sep 2023 12:09:43 +0000 (05:09 -0700)] 
[3.11] gh-101100: Fix sphinx warnings in `tutorial/appendix.rst` (GH-108750) (#108757)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] gh-101100: Fix sphinx warnings in `tutorial/classes.rst` (GH-108746) (#108755)
Miss Islington (bot) [Fri, 1 Sep 2023 10:57:30 +0000 (03:57 -0700)] 
[3.11] gh-101100: Fix sphinx warnings in `tutorial/classes.rst` (GH-108746) (#108755)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years ago[3.11] gh-104372: Drop the GIL around the vfork() call. (#104782) (#104958)
Gregory P. Smith [Fri, 1 Sep 2023 08:53:06 +0000 (01:53 -0700)] 
[3.11] gh-104372: Drop the GIL around the vfork() call. (#104782) (#104958)

gh-104372: Drop the GIL around the vfork() call. (#104782)

On Linux where the `subprocess` module can use the `vfork` syscall for
faster spawning, prevent the parent process from blocking other threads
by dropping the GIL while it waits for the vfork'ed child process `exec`
outcome.  This prevents spawning a binary from a slow filesystem from
blocking the rest of the application.

Fixes #104372.

(cherry picked from commit d08679212d9af52dd074cd4a6abb440edb944c9c)

2 years ago[3.11] `ast` docs: Fix incorrect link on `keyword` (GH-108728) (#108738)
Miss Islington (bot) [Thu, 31 Aug 2023 22:27:27 +0000 (15:27 -0700)] 
[3.11] `ast` docs: Fix incorrect link on `keyword` (GH-108728) (#108738)

`ast` docs: Fix incorrect link on `keyword` (GH-108728)

In two places, Sphinx was erroneously adding links to the `keyword` module instead of the `ast.keyword` class
(cherry picked from commit c1e2f3b2f70b8a72ea7e1bf792addf62a94ae65d)

Co-authored-by: Alex Povel <git@alexpovel.de>
2 years ago[3.11] gh-101100: Fix sphinx warnings in `threading.rst` (GH-108684) (#108708)
Miss Islington (bot) [Thu, 31 Aug 2023 08:28:47 +0000 (01:28 -0700)] 
[3.11] gh-101100: Fix sphinx warnings in `threading.rst` (GH-108684) (#108708)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] gh-108520: Fix bad fork detection in nested multiprocessing use case (GH-10856...
Miss Islington (bot) [Wed, 30 Aug 2023 20:36:26 +0000 (13:36 -0700)] 
[3.11] gh-108520: Fix bad fork detection in nested multiprocessing use case (GH-108568) (#108692)

gh-107275 introduced a regression where a SemLock would fail being passed along nested child processes, as the `is_fork_ctx` attribute would be left missing after the first deserialization.

---------

(cherry picked from commit add8d45cbe46581b9748909fbbf60fdc8ee8f71e)

Co-authored-by: albanD <desmaison.alban@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
2 years ago[3.11] gh-108590: Revert gh-108657 (commit 400a1cebc) (#108686) (#108694)
Erlend E. Aasland [Wed, 30 Aug 2023 20:12:10 +0000 (22:12 +0200)] 
[3.11] gh-108590: Revert gh-108657 (commit 400a1cebc) (#108686) (#108694)

(cherry picked from commit 2a3926fa51b7264787d5988abf083d8c4328f4ad)

Reverted per Serhiy's request.

2 years ago[3.11] gh-101100: Fix Sphinx warnings in the Logging Cookbook (GH-108678) (#108681)
Miss Islington (bot) [Wed, 30 Aug 2023 12:19:44 +0000 (05:19 -0700)] 
[3.11] gh-101100: Fix Sphinx warnings in the Logging Cookbook (GH-108678) (#108681)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years ago[3.11] Fix typo in multiprocessing docs (GH-108666) (#108676)
Miss Islington (bot) [Wed, 30 Aug 2023 11:17:23 +0000 (04:17 -0700)] 
[3.11] Fix typo in multiprocessing docs (GH-108666) (#108676)

Fix typo in multiprocessing docs (GH-108666)
(cherry picked from commit 38ab0dba801884b0963ef0daa95e94e120a2b524)

Co-authored-by: kato8966 <66937409+kato8966@users.noreply.github.com>
2 years ago[3.11] gh-108590: Fix sqlite3.iterdump for invalid Unicode in TEXT columns (GH-108657...
Corvin [Wed, 30 Aug 2023 10:29:33 +0000 (06:29 -0400)] 
[3.11] gh-108590: Fix sqlite3.iterdump for invalid Unicode in TEXT columns (GH-108657) (#108674)

(cherry picked from commit 400a1cebc743515e40157ed7af86e48d654290ce)

2 years ago[3.11] Mention Ellipsis pickling in the docs (GH-103660) (#108662)
Miss Islington (bot) [Wed, 30 Aug 2023 06:04:42 +0000 (23:04 -0700)] 
[3.11] Mention Ellipsis pickling in the docs (GH-103660) (#108662)

Mention Ellipsis pickling in the docs (GH-103660)
(cherry picked from commit 14ec0bb7c363def917f768b76f334146a3cddd84)

Co-authored-by: sterliakov <50529348+sterliakov@users.noreply.github.com>
2 years ago[3.11] Revert "[3.11] Use non alternate name for Kyiv (GH-108533) (GH-108641)" (GH...
Serhiy Storchaka [Tue, 29 Aug 2023 20:09:20 +0000 (23:09 +0300)] 
[3.11] Revert "[3.11] Use non alternate name for Kyiv (GH-108533) (GH-108641)" (GH-108650)

This reverts commit 34f84f2b9f60d35a142fcdf2d2b855914b69de6d.

It broke tests on the Debian and macOS buildbots.

2 years ago[3.11] gh-107801: Improve the accuracy of io.IOBase.seek docs (#108268) (#108656)
Erlend E. Aasland [Tue, 29 Aug 2023 19:57:49 +0000 (21:57 +0200)] 
[3.11] gh-107801: Improve the accuracy of io.IOBase.seek docs (#108268) (#108656)

(cherry picked from commit 8178a88bd81edae87d6974483e4de9b32e808797)

- Add param docstrings
- Link to os.SEEK_* constants
- Mention the return value in the initial paragraph

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years ago[3.11] Use non alternate name for Kyiv (GH-108533) (GH-108641)
Miss Islington (bot) [Tue, 29 Aug 2023 15:47:54 +0000 (08:47 -0700)] 
[3.11] Use non alternate name for Kyiv (GH-108533) (GH-108641)

tzdata provides Kiev as an alternative to Kyiv:

https://sources.debian.org/src/tzdata/2023c-10/backward/?hl=314GH-L314

But Debian moved it to the tzdata-legacy package breaking the test:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050530

This patch switches to the name provided by tzdata.
(cherry picked from commit 7659128b9d7a30ddbcb063bc12e2ddb0f1f119e0)

Co-authored-by: Jochen Sprickerhof <github@jochen.sprickerhof.de>
2 years ago[3.11] gh-108558: Improve sqlite3 row factory tests (GH-108578) (#108616)
Miss Islington (bot) [Tue, 29 Aug 2023 09:47:27 +0000 (02:47 -0700)] 
[3.11] gh-108558: Improve sqlite3 row factory tests (GH-108578) (#108616)

Add test_sqlite_row_keys() to explicitly test sqlite3.Row.keys().

Cleanups:
- Reduce test noise by converting docstrings to regular comments
- Reduce boilerplate code by adding a setUp() method to RowFactoryTests

(cherry picked from commit 6eaddc10e972273c1aed8b88c538e65e4773496e)

Co-authored-by: Edward Schauman-Haigh <142528725+EddInSverige@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>