]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
17 months agogh-119258: Eliminate Type Guards in Tier 2 Optimizer with Watcher (GH-119365)
Saul Shanabrook [Sat, 8 Jun 2024 09:41:45 +0000 (05:41 -0400)] 
gh-119258: Eliminate Type Guards in Tier 2 Optimizer with Watcher (GH-119365)

Co-authored-by: parmeggiani <parmeggiani@spaziodati.eu>
Co-authored-by: dpdani <git@danieleparmeggiani.me>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
Co-authored-by: Ken Jin <kenjin@python.org>
17 months agobpo-37755: Use configured output in pydoc instead of pager (GH-15105)
Enrico Tröger [Sat, 8 Jun 2024 09:19:13 +0000 (11:19 +0200)] 
bpo-37755: Use configured output in pydoc instead of pager (GH-15105)

If the Helper() class was initialized with an output, the topics, keywords
and symbols help still use the pager instead of the output.
Change the behavior so  the output is used if available while keeping the
previous behavior if no output was configured.

17 months agogh-120242: Fix handling of `[setUp,tearDown]Class` in `test_datetime` (#120243)
Nikita Sobolev [Sat, 8 Jun 2024 07:51:09 +0000 (10:51 +0300)] 
gh-120242: Fix handling of `[setUp,tearDown]Class` in `test_datetime` (#120243)

17 months agogh-120225: fix crash in compiler on empty block at end of exception handler (#120235)
Irit Katriel [Fri, 7 Jun 2024 21:37:35 +0000 (22:37 +0100)] 
gh-120225: fix crash in compiler on empty block at end of exception handler (#120235)

17 months agogh-119659: Get the datetime CAPI Tests Running Again (gh-120180)
Eric Snow [Fri, 7 Jun 2024 17:44:56 +0000 (13:44 -0400)] 
gh-119659: Get the datetime CAPI Tests Running Again (gh-120180)

The tests were accidentally disabled by 2da0dc0, which didn't handle classes correctly.

I considered updating no_rerun() to support classes, but the way test_datetime.py works would have made things fairly messy.  Plus, it looks like the refleaks we had encountered before have been resolved.

17 months agoGH-116380: Move pathlib-specific code from `glob` to `pathlib._abc`. (#120011)
Barney Gale [Fri, 7 Jun 2024 16:59:34 +0000 (17:59 +0100)] 
GH-116380: Move pathlib-specific code from `glob` to `pathlib._abc`. (#120011)

In `glob._Globber`, move pathlib-specific methods to `pathlib._abc.PathGlobber` and replace them with abstract methods. Rename `glob._Globber` to `glob._GlobberBase`. As a result, the `glob` module is no longer befouled by code that can only ever apply to pathlib.

No change of behaviour.

17 months agogh-120155: Fix copy/paste error in HAVE_SUBOFFSETS_IN_LAST_DIM() (#120228)
Victor Stinner [Fri, 7 Jun 2024 15:58:21 +0000 (17:58 +0200)] 
gh-120155: Fix copy/paste error in HAVE_SUBOFFSETS_IN_LAST_DIM() (#120228)

Don't hardcode 'dest' in HAVE_SUBOFFSETS_IN_LAST_DIM() macro of
memoryobject.c, but use its 'view' parameter instead.

Fix the Coverity issue:

Error: COPY_PASTE_ERROR (CWE-398):
Python-3.12.2/Objects/memoryobject.c:273:14: original: ""dest->suboffsets + (dest->ndim - 1)"" looks like the original copy.
Python-3.12.2/Objects/memoryobject.c:274:14: copy_paste_error: ""dest"" in ""src->suboffsets + (dest->ndim - 1)"" looks like a copy-paste error.
Python-3.12.2/Objects/memoryobject.c:274:14: remediation: Should it say ""src"" instead?
#  272|       assert(dest->ndim > 0 && src->ndim > 0);
#  273|       return (!HAVE_SUBOFFSETS_IN_LAST_DIM(dest) &&
#  274|->             !HAVE_SUBOFFSETS_IN_LAST_DIM(src) &&
#  275|               dest->strides[dest->ndim-1] == dest->itemsize &&
#  276|               src->strides[src->ndim-1] == src->itemsize);

17 months agogh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux >= 6...
Xi Ruoyao [Fri, 7 Jun 2024 15:51:32 +0000 (23:51 +0800)] 
gh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux >= 6.10 (#120227)

The worst case is that the kernel buffers 17 pages with a page size of 64k.

17 months agogh-120200: Fix `inspect.iscoroutinefunction(inspect) is True` corner case (#120214)
Nikita Sobolev [Fri, 7 Jun 2024 15:48:31 +0000 (18:48 +0300)] 
gh-120200: Fix `inspect.iscoroutinefunction(inspect) is True` corner case (#120214)

17 months agogh-114264: Optimize performance of copy.deepcopy by adding a fast path for atomic...
Pieter Eendebak [Fri, 7 Jun 2024 15:42:01 +0000 (17:42 +0200)] 
gh-114264: Optimize performance of copy.deepcopy by adding a fast path for atomic types (GH-114266)

17 months agogh-110383: Improve 'old string formatting' text in tutorial (#120219)
Erlend E. Aasland [Fri, 7 Jun 2024 13:37:18 +0000 (15:37 +0200)] 
gh-110383: Improve 'old string formatting' text in tutorial (#120219)

17 months agogh-93691: fix too broad source locations of with-statement instructions (#120125)
Irit Katriel [Fri, 7 Jun 2024 13:06:24 +0000 (14:06 +0100)] 
gh-93691: fix too broad source locations of with-statement instructions (#120125)

17 months agogh-120211: Fix tkinter.ttk with Tcl/Tk 9.0 (GH-120213)
Serhiy Storchaka [Fri, 7 Jun 2024 10:49:07 +0000 (13:49 +0300)] 
gh-120211: Fix tkinter.ttk with Tcl/Tk 9.0 (GH-120213)

* Use new methods for tracing Tcl variable.
* Fix Combobox.current() for empty combobox.

17 months agogh-110383: Clarify "non-integral" wording in pow() docs (#119688)
Aditya Borikar [Fri, 7 Jun 2024 09:44:42 +0000 (03:44 -0600)] 
gh-110383: Clarify "non-integral" wording in pow() docs (#119688)

17 months agogh-120164: Fix test_os.test_win32_mkdir_700() (#120177)
Kirill Podoprigora [Fri, 7 Jun 2024 09:14:13 +0000 (12:14 +0300)] 
gh-120164: Fix test_os.test_win32_mkdir_700() (#120177)

Don't compare the path to avoid encoding issues.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
17 months agogh-120154: Fix Emscripten/WASI pattern in case statement for LDSHARED (#120173)
Michael Allwright [Fri, 7 Jun 2024 08:38:15 +0000 (10:38 +0200)] 
gh-120154: Fix Emscripten/WASI pattern in case statement for LDSHARED (#120173)

Fix Emscripten/WASI pattern in case statement for LDSHARED

17 months agoFix typos in comments (#120188)
Xie Yanbo [Fri, 7 Jun 2024 08:19:41 +0000 (16:19 +0800)] 
Fix typos in comments (#120188)

17 months agogh-120080: Accept ``None`` as a valid argument for direct call of the ``int.__round__...
Kirill Podoprigora [Fri, 7 Jun 2024 08:03:28 +0000 (11:03 +0300)] 
gh-120080: Accept ``None`` as a valid argument for direct call of the ``int.__round__`` (#120088)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
17 months agogh-120157: Remove unused code in concurrent.future (gh-120187)
Clinton [Fri, 7 Jun 2024 07:39:19 +0000 (03:39 -0400)] 
gh-120157: Remove unused code in concurrent.future (gh-120187)

17 months agoAdd Plausible for docs metrics (#119977)
Hugo van Kemenade [Fri, 7 Jun 2024 06:38:31 +0000 (00:38 -0600)] 
Add Plausible for docs metrics (#119977)

Co-authored-by: Julien Palard <julien@palard.fr>
17 months agogh-119577: Adjust DeprecationWarning when testing element truth values in ElementTree...
Jacob Walls [Fri, 7 Jun 2024 03:18:30 +0000 (23:18 -0400)] 
gh-119577: Adjust DeprecationWarning when testing element truth values in ElementTree (GH-119762)

Adjust DeprecationWarning when testing element truth values in ElementTree, we're planning to go with the more natural True return rather than a disruptive harder to code around exception raise, and are deferring the behavior change for a few more releases.

17 months agoGH-119054: Add "Reading directories" section to pathlib docs (#119956)
Barney Gale [Thu, 6 Jun 2024 23:27:39 +0000 (00:27 +0100)] 
GH-119054: Add "Reading directories" section to pathlib docs (#119956)

Add a dedicated subsection for `Path.iterdir()`-related methods,
specifically `iterdir()`, `glob()`, `rglob()` and `walk()`.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
17 months agogh-120178: Documentation typo corrections (#120179)
David Lowry-Duda [Thu, 6 Jun 2024 21:35:24 +0000 (17:35 -0400)] 
gh-120178: Documentation typo corrections (#120179)

17 months agogh-117657: Fix TSAN race involving import lock (#118523)
Sam Gross [Thu, 6 Jun 2024 17:40:58 +0000 (13:40 -0400)] 
gh-117657: Fix TSAN race involving import lock (#118523)

This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that
for the import lock. This fixes some data races in the free-threaded
build and generally simplifies the import lock code.

17 months agoAdd Tian Gao to CODEOWNERS and ACKS (GH-120166)
Tian Gao [Thu, 6 Jun 2024 17:20:37 +0000 (10:20 -0700)] 
Add Tian Gao to CODEOWNERS and ACKS (GH-120166)

17 months agoRestore decimal context after decimal doctests (GH-120149)
Serhiy Storchaka [Thu, 6 Jun 2024 17:12:32 +0000 (20:12 +0300)] 
Restore decimal context after decimal doctests (GH-120149)

The modified context caused tests failures in several other tests.

17 months agoCODEOWNERS: Add myself to symtable and AST (#120139)
Jelle Zijlstra [Thu, 6 Jun 2024 16:25:05 +0000 (09:25 -0700)] 
CODEOWNERS: Add myself to symtable and AST (#120139)

Co-authored-by: Carl Meyer <carl@oddbird.net>
17 months agogh-120155: Initialize variables in _tkinter.c (#120156)
Victor Stinner [Thu, 6 Jun 2024 15:31:33 +0000 (17:31 +0200)] 
gh-120155: Initialize variables in _tkinter.c (#120156)

Initialize variables in _tkinter.c to make static analyzers happy.

17 months agogh-119679: Fix layout of PYD and DLL files on Windows when using PC/layout script...
Steve Dower [Thu, 6 Jun 2024 15:11:42 +0000 (16:11 +0100)] 
gh-119679: Fix layout of PYD and DLL files on Windows when using PC/layout script (GH-120133)

17 months agogh-120111: Don't use cirrus M1 macOS runners on fork (#120116)
Nice Zombies [Thu, 6 Jun 2024 11:40:37 +0000 (13:40 +0200)] 
gh-120111: Don't use cirrus M1 macOS runners on fork (#120116)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
17 months agogh-119786: move adaptive interpreter doc from Python to InternalsDoc (#120137)
Irit Katriel [Thu, 6 Jun 2024 10:56:58 +0000 (11:56 +0100)] 
gh-119786: move adaptive interpreter doc from Python to InternalsDoc (#120137)

17 months agogh-120128: fix description of argument to ipaddress.collapse_addresses() (#120131)
Jan Kaliszewski [Wed, 5 Jun 2024 21:52:40 +0000 (23:52 +0200)] 
gh-120128: fix description of argument to ipaddress.collapse_addresses() (#120131)

The argument to collapse_addresses() is now described as an *iterable*
(rather than *iterator*).

17 months agopathlib ABCs: remove duplicate `realpath()` implementation. (#119178)
Barney Gale [Wed, 5 Jun 2024 17:54:50 +0000 (18:54 +0100)] 
pathlib ABCs: remove duplicate `realpath()` implementation. (#119178)

Add private `posixpath._realpath()` function, which is a generic version of `realpath()` that can be parameterised with string tokens (`sep`, `curdir`, `pardir`) and query functions (`getcwd`, `lstat`, `readlink`). Also add support for limiting the number of symlink traversals.

In the private `pathlib._abc.PathBase` class, call `posixpath._realpath()` and remove our re-implementation of the same algorithm.

No change to any public APIs, either in `posixpath` or `pathlib`.

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
17 months agogh-115225: Raise error on unsupported ISO 8601 time strings (#119339)
benchatt [Wed, 5 Jun 2024 17:35:40 +0000 (10:35 -0700)] 
gh-115225: Raise error on unsupported ISO 8601 time strings (#119339)

Some time strings that contain fractional hours or minutes are permitted
by ISO 8601, but such strings are very unlikely to be intentional. The
current parser does not parse such strings correctly or raise an error.
This change raises a ValueError when hours or minutes contain a decimal mark.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
17 months agogh-119786: add links to code in exception handling doc (#120077)
Irit Katriel [Wed, 5 Jun 2024 15:28:47 +0000 (16:28 +0100)] 
gh-119786: add links to code in exception handling doc (#120077)

17 months agogh-120065: Increase `collect_in_thread` period to 5 ms. (#120068)
Sam Gross [Wed, 5 Jun 2024 13:23:29 +0000 (09:23 -0400)] 
gh-120065: Increase `collect_in_thread` period to 5 ms. (#120068)

This matches the default GIL switch interval. It greatly speeds up the
free-threaded build: previously, it spent nearly all its time in
`gc.collect()`.

17 months agogh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib...
Irit Katriel [Wed, 5 Jun 2024 11:56:01 +0000 (12:56 +0100)] 
gh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib.suppress (#119657)

17 months agogh-119819: Update logging configuration to support joinable multiproc… (GH-120090)
Vinay Sajip [Wed, 5 Jun 2024 06:25:47 +0000 (07:25 +0100)] 
gh-119819: Update logging configuration to support joinable multiproc… (GH-120090)

gh-119819: Update logging configuration to support joinable multiprocessing manager queues.

17 months agogh-120078: Fix struct_time attr typo tm_day -> tm_mday in Doc/library/time.rst (GH...
shurj0 [Wed, 5 Jun 2024 00:23:12 +0000 (06:23 +0600)] 
gh-120078: Fix struct_time attr typo tm_day -> tm_mday in Doc/library/time.rst (GH-120081)

17 months agogh-114616: Improve docs regarding changes to caches representation in dis (#120033)
Irit Katriel [Tue, 4 Jun 2024 23:00:02 +0000 (00:00 +0100)] 
gh-114616: Improve docs regarding changes to caches representation in dis (#120033)

17 months agogh-119553: Fix console when pressing Ctrl-C within a multiline block (#120075)
Lysandros Nikolaou [Tue, 4 Jun 2024 21:22:28 +0000 (23:22 +0200)] 
gh-119553: Fix console when pressing Ctrl-C within a multiline block (#120075)

17 months agogh-119999: Fix potential race condition in `_Py_ExplicitMergeRefcount` (#120000)
Sam Gross [Tue, 4 Jun 2024 19:26:26 +0000 (15:26 -0400)] 
gh-119999: Fix potential race condition in `_Py_ExplicitMergeRefcount` (#120000)

We need to write to `ob_ref_local` and `ob_tid` before `ob_ref_shared`.
Once we mark `ob_ref_shared` as merged, some other thread may free the
object because the caller also passes in `-1` as `extra` to give up its
only reference.

17 months agogh-119819: Update test to skip if _multiprocessing is unavailable. (GH-120067)
Vinay Sajip [Tue, 4 Jun 2024 19:16:43 +0000 (20:16 +0100)] 
gh-119819: Update test to skip if _multiprocessing is unavailable. (GH-120067)

17 months agogh-120048: Make `test_imaplib` faster (#120050)
Sam Gross [Tue, 4 Jun 2024 18:59:23 +0000 (14:59 -0400)] 
gh-120048: Make `test_imaplib` faster (#120050)

The `test_imaplib` was taking 40+ minutes in the refleak build bots because
the tests waiting on a client `self._setup()` was creating a client that
prevented progress until its connection timed out, which scaled with the
global timeout.

We should set `connect=False` for the tests that don't want `_setup()` to
create a client.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
17 months agogh-119842: Honor PyOS_InputHook in the new REPL (GH-119843)
Pablo Galindo Salgado [Tue, 4 Jun 2024 18:32:43 +0000 (19:32 +0100)] 
gh-119842: Honor PyOS_InputHook in the new REPL (GH-119843)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
17 months agodoc: Mention the missing reflected special methods for all binary operations (GH...
Paulo Freitas [Tue, 4 Jun 2024 17:55:11 +0000 (14:55 -0300)] 
doc: Mention the missing reflected special methods for all binary operations (GH-119931)

17 months agogh-119553: Clear reader on Ctrl-C command (GH-119801)
Lysandros Nikolaou [Tue, 4 Jun 2024 17:46:33 +0000 (19:46 +0200)] 
gh-119553: Clear reader on Ctrl-C command (GH-119801)

17 months agogh-120039: Reduce expected timeout in test_siginterrupt_off (#120047)
Sam Gross [Tue, 4 Jun 2024 17:38:29 +0000 (13:38 -0400)] 
gh-120039: Reduce expected timeout in test_siginterrupt_off (#120047)

The process is expected to time out. In the refleak builds,
`support.SHORT_TIMEOUT` is often five minutes and we run the tests six
times, so test_signal was taking >30 minutes.

17 months agogh-120041: Refactor check for visible completion menu in completing_reader (#120055)
Lysandros Nikolaou [Tue, 4 Jun 2024 17:26:44 +0000 (19:26 +0200)] 
gh-120041: Refactor check for visible completion menu in completing_reader (#120055)

17 months agogh-112672: Fix builtin Tkinter with Tcl 9.0 (GH-112681)
Christopher Chavez [Tue, 4 Jun 2024 16:47:15 +0000 (11:47 -0500)] 
gh-112672: Fix builtin Tkinter with Tcl 9.0 (GH-112681)

* Add declaration of Tcl_AppInit(), missing in Tcl 9.0.
* Use Tcl_Size instead of int where needed.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
17 months agogh-89928: Fix integer conversion of device numbers (GH-31794)
Serhiy Storchaka [Tue, 4 Jun 2024 16:36:37 +0000 (19:36 +0300)] 
gh-89928: Fix integer conversion of device numbers (GH-31794)

Fix os.major(), os.minor() and os.makedev().
Support device numbers larger than 2**63-1.
Support non-existent device number (NODEV).

17 months agoFix incorrect pull GitHub link in What's New (#120045)
Trey Hunner [Tue, 4 Jun 2024 16:28:08 +0000 (09:28 -0700)] 
Fix incorrect pull GitHub link in What's New (#120045)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
17 months agogh-120041: Do not use append_to_screen when completions are visible (GH-120042)
Lysandros Nikolaou [Tue, 4 Jun 2024 16:09:31 +0000 (18:09 +0200)] 
gh-120041: Do not use append_to_screen when completions are visible (GH-120042)

17 months agogh-119588: Update docs to reflect decision to include the change with Python 3.13...
Jason R. Coombs [Tue, 4 Jun 2024 15:20:01 +0000 (11:20 -0400)] 
gh-119588: Update docs to reflect decision to include the change with Python 3.13 and not 3.12. (#120043)

17 months agogh-120029: export `DEF_TYPE_PARAM` compiler flag (#120028)
Bénédikt Tran [Tue, 4 Jun 2024 14:24:22 +0000 (16:24 +0200)] 
gh-120029: export `DEF_TYPE_PARAM` compiler flag (#120028)

17 months agogh-117657: Fix race involving GC and heap initialization (#119923)
Sam Gross [Tue, 4 Jun 2024 13:42:13 +0000 (09:42 -0400)] 
gh-117657: Fix race involving GC and heap initialization (#119923)

The `_PyThreadState_Bind()` function is called before the first
`PyEval_AcquireThread()` so it's not synchronized with the stop the
world GC. We had a race where `gc_visit_heaps()` might visit a thread's
heap while it's being initialized.

Use a simple atomic int to avoid visiting heaps for threads that are not
yet fully initialized (i.e., before `tstate_mimalloc_bind()` is called).

The race was reproducible by running:
`python Lib/test/test_importlib/partial/pool_in_threads.py`.

17 months agogh-94808: Reorganize _make_posargs and mark unused code (GH-119227)
Mark Jason Dominus (陶敏修) [Tue, 4 Jun 2024 12:59:56 +0000 (08:59 -0400)] 
gh-94808: Reorganize _make_posargs and mark unused code (GH-119227)

* Reorganize four-way if-elsif-elsif-elsif as nested if-elses
* Mark unused branch in _make_posargs

`names_with_default` is never `NULL`, even if there are no names with
defaults.  In that case it points to a structure with `size` zero.

Rather than eliminating the branch, we leave it behind with an `assert(0)`
in case a future change to the grammar exercises the branch.

17 months agogh-119819: Fix regression to allow logging configuration with multipr… (GH-120030)
Vinay Sajip [Tue, 4 Jun 2024 12:20:50 +0000 (13:20 +0100)] 
gh-119819: Fix regression to allow logging configuration with multipr… (GH-120030)

17 months agogh-118868: logging QueueHandler fix passing of kwargs (GH-118869)
Kaundur [Tue, 4 Jun 2024 11:48:05 +0000 (12:48 +0100)] 
gh-118868: logging QueueHandler fix passing of kwargs (GH-118869)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
17 months agoFix typos in documentation and comments (#119763)
Xie Yanbo [Tue, 4 Jun 2024 10:22:22 +0000 (18:22 +0800)] 
Fix typos in documentation and comments (#119763)

17 months agogh-111499: Fix PYTHONMALLOCSTATS at Python exit (#120021)
Victor Stinner [Tue, 4 Jun 2024 09:39:07 +0000 (11:39 +0200)] 
gh-111499: Fix PYTHONMALLOCSTATS at Python exit (#120021)

Call _PyObject_DebugMallocStats() earlier in Py_FinalizeEx(), before
the interpreter is deleted.

17 months agogh-119613: Soft deprecate the Py_MEMCPY() macro (#120020)
Victor Stinner [Tue, 4 Jun 2024 09:23:55 +0000 (11:23 +0200)] 
gh-119613: Soft deprecate the Py_MEMCPY() macro (#120020)

Use directly memcpy() instead.

17 months agogh-119070: Update test_shebang_executable_extension to always use non-installed versi...
Steve Dower [Tue, 4 Jun 2024 08:17:45 +0000 (09:17 +0100)] 
gh-119070: Update test_shebang_executable_extension to always use non-installed version (GH-119846)

17 months agogh-119879: str.find(): Utilize last character gap for two-way periodic needles (...
d.grigonis [Tue, 4 Jun 2024 07:44:49 +0000 (10:44 +0300)] 
gh-119879: str.find(): Utilize last character gap for two-way periodic needles (#119880)

17 months agogh-106531: Apply changes from importlib_resources 6.3.2 (#117054)
Jason R. Coombs [Tue, 4 Jun 2024 06:36:28 +0000 (02:36 -0400)] 
gh-106531: Apply changes from importlib_resources 6.3.2 (#117054)

Apply changes from importlib_resources 6.3.2.

17 months agogh-119724: Revert "bpo-45759: Better error messages for non-matching 'elif'/'else...
Petr Viktorin [Tue, 4 Jun 2024 01:10:15 +0000 (03:10 +0200)] 
gh-119724: Revert "bpo-45759: Better error messages for non-matching 'elif'/'else' statements (#29513)" (#119974)

This reverts commit 1c8f912ebdfdb146cd7dd2d7a3a67d2c5045ddb0.

17 months agogh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-119929)
Eric Snow [Mon, 3 Jun 2024 23:09:18 +0000 (19:09 -0400)] 
gh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-119929)

We make use of the same mechanism that we use for the static builtin types.  This required a few tweaks.

The relevant code could use some cleanup but I opted to avoid the significant churn in this change.  I'll tackle that separately.

This change is the final piece needed to make _datetime support multiple interpreters.  I've updated the module slot accordingly.

17 months agogh-117142: Support Importing ctypes in Isolated Interpreters (gh-119991)
Eric Snow [Mon, 3 Jun 2024 22:42:48 +0000 (18:42 -0400)] 
gh-117142: Support Importing ctypes in Isolated Interpreters (gh-119991)

This makes the support official.

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
17 months agogh-117398: Add datetime Module State (gh-119810)
Eric Snow [Mon, 3 Jun 2024 21:56:00 +0000 (17:56 -0400)] 
gh-117398: Add datetime Module State (gh-119810)

I was able to make use of the existing datetime_state struct, but there was one tricky thing I had to sort out.  We mostly aren't converting to heap types, so we can't use things like PyType_GetModuleByDef() to look up the module state.  The solution I came up with is somewhat novel, but I consider it straightforward.  Also, it shouldn't have much impact on performance.

In summary, this main changes here are:

* I've added some macros to help hide how various objects relate to module state
* as a solution to the module state lookup problem, I've stored the last loaded module on the current interpreter's internal dict (actually a weakref)
* if the static type method is used after the module has been deleted, it is reloaded
* to avoid extra work when loading the module, we directly copy the objects (new refs only) from the old module state into the new state if the old module hasn't been deleted yet
* during module init we set various objects on the static types' __dict__s; to simplify things, we only do that the first time; once those static types have a separate __dict__ per interpreter, we'll do it every time
* we now clear the module state when the module is destroyed (before, we were leaking everything in _datetime_global_state)

17 months agogh-117657: Fix race involving immortalizing objects (#119927)
Sam Gross [Mon, 3 Jun 2024 20:58:41 +0000 (16:58 -0400)] 
gh-117657: Fix race involving immortalizing objects (#119927)

The free-threaded build currently immortalizes objects that use deferred
reference counting (see gh-117783). This typically happens once the
first non-main thread is created, but the behavior can be suppressed for
tests, in subinterpreters, or during a compile() call.

This fixes a race condition involving the tracking of whether the
behavior is suppressed.

17 months agoupdate CODEOWNERS (#120003)
Irit Katriel [Mon, 3 Jun 2024 20:44:36 +0000 (21:44 +0100)] 
update CODEOWNERS (#120003)

17 months agogh-117657: Avoid `sem_clockwait` in TSAN (#119915)
Sam Gross [Mon, 3 Jun 2024 17:42:27 +0000 (13:42 -0400)] 
gh-117657: Avoid `sem_clockwait` in TSAN (#119915)

The `sem_clockwait` function is not currently instrumented, which leads
to false positives.

17 months agogh-118835: pyrepl: Fix prompt length computation for custom prompts containing ANSI...
Daniel Hollas [Mon, 3 Jun 2024 17:07:06 +0000 (18:07 +0100)] 
gh-118835: pyrepl: Fix prompt length computation for custom prompts containing ANSI escape codes (#119942)

17 months agogh-119727: Add --single-process option to regrtest (#119728)
Victor Stinner [Mon, 3 Jun 2024 16:34:36 +0000 (18:34 +0200)] 
gh-119727: Add --single-process option to regrtest (#119728)

17 months agogh-119057: Use better error messages for zero division (#119066)
Nikita Sobolev [Mon, 3 Jun 2024 16:03:56 +0000 (19:03 +0300)] 
gh-119057: Use better error messages for zero division (#119066)

17 months agogh-119981: Use do while(0) in some symtable.c multi-line macros (#119982)
Bénédikt Tran [Mon, 3 Jun 2024 15:48:02 +0000 (17:48 +0200)] 
gh-119981: Use do while(0) in some symtable.c multi-line macros (#119982)

17 months agoUse Cirrus M1 macOS runners for CI (GH-119979)
Łukasz Langa [Mon, 3 Jun 2024 15:32:40 +0000 (11:32 -0400)] 
Use Cirrus M1 macOS runners for CI (GH-119979)

Co-authored-by: Ee Durbin <ee@python.org>
17 months agogh-119588: Implement zipfile.Path.is_symlink (zipp 3.19.0). (#119591)
Jason R. Coombs [Mon, 3 Jun 2024 15:13:07 +0000 (11:13 -0400)] 
gh-119588: Implement zipfile.Path.is_symlink (zipp 3.19.0). (#119591)

17 months agogh-119679: Ensures correct import libraries are included in Windows install packages...
Steve Dower [Mon, 3 Jun 2024 14:42:45 +0000 (15:42 +0100)] 
gh-119679: Ensures correct import libraries are included in Windows install packages (GH-119790)

17 months agogh-102511: Amend 3.13.0b1.rst (GH-119895)
Nice Zombies [Mon, 3 Jun 2024 13:27:44 +0000 (15:27 +0200)] 
gh-102511: Amend 3.13.0b1.rst (GH-119895)

17 months agogh-116560: Add PyLong_GetSign() public function (#116561)
Sergey B Kirpichev [Mon, 3 Jun 2024 12:06:31 +0000 (15:06 +0300)] 
gh-116560: Add PyLong_GetSign() public function (#116561)

Co-authored-by: Victor Stinner <vstinner@python.org>
17 months agogh-119786: move exception handling doc to InternalDocs (#119815)
Irit Katriel [Mon, 3 Jun 2024 09:36:20 +0000 (10:36 +0100)] 
gh-119786: move exception handling doc to InternalDocs (#119815)

17 months agogh-119968: Improved monitoring c-api docs (#119969)
Awbert [Mon, 3 Jun 2024 09:31:02 +0000 (12:31 +0300)] 
gh-119968: Improved monitoring c-api docs (#119969)

17 months agogh-119838: Treat Fraction as a real value in mixed arithmetic operations with complex...
Serhiy Storchaka [Mon, 3 Jun 2024 09:29:01 +0000 (12:29 +0300)] 
gh-119838: Treat Fraction as a real value in mixed arithmetic operations with complex (GH-119839)

17 months agogh-112026: Deprecate _PyDict_GetItemStringWithError() function (#119855)
Victor Stinner [Mon, 3 Jun 2024 08:26:13 +0000 (10:26 +0200)] 
gh-112026: Deprecate _PyDict_GetItemStringWithError() function (#119855)

17 months agogh-119856: Support exiting help() with just "exit" (#119858)
Victor Stinner [Mon, 3 Jun 2024 08:15:04 +0000 (10:15 +0200)] 
gh-119856: Support exiting help() with just "exit" (#119858)

17 months agogh-116991: Improve `pygen --help` for `python` subparser (#116992)
Nikita Sobolev [Mon, 3 Jun 2024 07:52:35 +0000 (10:52 +0300)] 
gh-116991: Improve `pygen --help` for `python` subparser (#116992)

17 months agogh-118827: Remove `Quoter` from `urllib.parse` (#118828)
Nikita Sobolev [Mon, 3 Jun 2024 07:50:29 +0000 (10:50 +0300)] 
gh-118827: Remove `Quoter` from `urllib.parse` (#118828)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
17 months agogh-119506: fix `_io.TextIOWrapper.write()` write during flush (#119507)
Radislav Chugunov [Mon, 3 Jun 2024 07:47:36 +0000 (10:47 +0300)] 
gh-119506: fix `_io.TextIOWrapper.write()` write during flush (#119507)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
17 months agogh-119396: Optimize unicode_decode_utf8_writer() (#119957)
Victor Stinner [Mon, 3 Jun 2024 06:45:20 +0000 (08:45 +0200)] 
gh-119396: Optimize unicode_decode_utf8_writer() (#119957)

Optimize unicode_decode_utf8_writer()

Take the ascii_decode() fast-path even if dest is not aligned on
size_t bytes.

17 months agogh-119961: Fix test workflow status badge in README (#119962)
wookie184 [Mon, 3 Jun 2024 06:05:57 +0000 (07:05 +0100)] 
gh-119961: Fix test workflow status badge in README (#119962)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
17 months agogh-117657: Fix data races report by TSAN unicode-hash (gh-119907)
Donghee Na [Mon, 3 Jun 2024 03:22:41 +0000 (12:22 +0900)] 
gh-117657: Fix data races report by TSAN unicode-hash (gh-119907)

17 months agogh-109975: What's New in Python 3.13: fix broken link for `telnetlib` alternative...
Solomon Himelbloom [Mon, 3 Jun 2024 00:43:03 +0000 (16:43 -0800)] 
gh-109975: What's New in Python 3.13: fix broken link for `telnetlib` alternative (#119958)

17 months agoGH-119054: Add "Reading and writing files" section to pathlib docs (#119524)
Barney Gale [Sun, 2 Jun 2024 19:39:19 +0000 (20:39 +0100)] 
GH-119054: Add "Reading and writing files" section to pathlib docs (#119524)

Add a dedicated subsection for `open()`, `read_text()`, `read_bytes()`,
`write_text()` and `write_bytes()`.

17 months agoImprove documentation for typing.get_type_hints (#119928)
Jelle Zijlstra [Sun, 2 Jun 2024 15:13:24 +0000 (08:13 -0700)] 
Improve documentation for typing.get_type_hints (#119928)

- Explicit list of what it does that is different from
  "just return __annotations__"
- Remove reference to PEP 563; adding the future import doesn't
  do anything to type aliases, and in general it will never make
  get_type_hints() less likely to fail.
- Remove example, as the Annotated docs already have a similar
  example, and it's unbalanced to have one example about this
  one edge case but not about other behaviors of the function.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
17 months agogh-117657: Fix TSAN reported race in `_PyEval_IsGILEnabled`. (#119921)
Sam Gross [Sun, 2 Jun 2024 14:19:02 +0000 (10:19 -0400)] 
gh-117657: Fix TSAN reported race in `_PyEval_IsGILEnabled`. (#119921)

The GIL may be disabled concurrently with this call so we need to use a
relaxed atomic load.

17 months agogh-119740: Remove deprecated trunc delegation (#119743)
Mark Dickinson [Sun, 2 Jun 2024 09:16:49 +0000 (10:16 +0100)] 
gh-119740: Remove deprecated trunc delegation (#119743)

Remove the delegation of `int` to the `__trunc__` special method: `int` will now only delegate to `__int__` and `__index__` (in that order). `__trunc__` continues to exist, but its sole purpose is to support `math.trunc`.

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
17 months agogh-119775: Remove ability to create immutable types with mutable bases (#119776)
Nikita Sobolev [Sun, 2 Jun 2024 07:27:20 +0000 (10:27 +0300)] 
gh-119775: Remove ability to create immutable types with mutable bases (#119776)

17 months agogh-118934: Fix PyEval_GetLocals docs (PEP 667) (#119932)
Alyssa Coghlan [Sun, 2 Jun 2024 04:44:29 +0000 (14:44 +1000)] 
gh-118934: Fix PyEval_GetLocals docs (PEP 667) (#119932)

PEP 667's description of the planned changes to PyEval_GetLocals
was internally inconsistent when accepted, so the docs added for
gh-74929 didn't match either the current behaviour or the intended
behaviour once gh-118934 is fixed.

This PR updates the documentation and 3.13 What's New to match the
intended behaviour (once gh-118934 is fixed).

It also tidies up lingering references to `f_locals` always being a
dictionary (this hasn't been true since at least when custom
namespace support for class statement execution was added)

17 months agoRefactor (mostly rearrange) the statistics module (gh-119930)
Raymond Hettinger [Sun, 2 Jun 2024 03:07:46 +0000 (22:07 -0500)] 
Refactor (mostly rearrange) the statistics module (gh-119930)