]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
8 days agoGH-139862: Fix direct instantiation of `HelpFormatter` (#142384)
Savannah Ostrowski [Sun, 7 Dec 2025 21:02:12 +0000 (13:02 -0800)] 
GH-139862: Fix direct instantiation of `HelpFormatter` (#142384)

8 days agogh-141794: Reduce size of compiler stress tests to fix Android warnings (#142263)
Malcolm Smith [Sun, 7 Dec 2025 20:01:01 +0000 (20:01 +0000)] 
gh-141794: Reduce size of compiler stress tests to fix Android warnings (#142263)

8 days agogh-142346: Fix usage formatting for mutually exclusive groups in argparse (GH-142381)
Serhiy Storchaka [Sun, 7 Dec 2025 19:36:01 +0000 (21:36 +0200)] 
gh-142346: Fix usage formatting for mutually exclusive groups in argparse (GH-142381)

Support groups preceded by positional arguments or followed or intermixed
with other optional arguments. Support empty groups.

8 days agogh-138122: Don't sample partial frame chains (#141912)
Pablo Galindo Salgado [Sun, 7 Dec 2025 15:53:48 +0000 (15:53 +0000)] 
gh-138122: Don't sample partial frame chains (#141912)

9 days agogh-138122: Improve the profiling section in the 3.15 what's new document (#140156)
Pablo Galindo Salgado [Sun, 7 Dec 2025 02:46:33 +0000 (02:46 +0000)] 
gh-138122: Improve the profiling section in the 3.15 what's new document (#140156)

9 days agogh-142368: Refactor test_external_inspection to reduce flakiness in parallel executio...
Pablo Galindo Salgado [Sun, 7 Dec 2025 02:32:20 +0000 (02:32 +0000)] 
gh-142368: Refactor test_external_inspection to reduce flakiness in parallel execution (#142369)

9 days agogh-138122: Implement frame caching in RemoteUnwinder to reduce memory reads (#142137)
Pablo Galindo Salgado [Sat, 6 Dec 2025 22:37:34 +0000 (22:37 +0000)] 
gh-138122: Implement frame caching in RemoteUnwinder to reduce memory reads (#142137)

This PR implements frame caching in the RemoteUnwinder class to significantly reduce memory reads when profiling remote processes with deep call stacks.

When cache_frames=True, the unwinder stores the frame chain from each sample and reuses unchanged portions in subsequent samples. Since most profiling samples capture similar call stacks (especially the parent frames), this optimization avoids repeatedly reading the same frame data from the target process.

The implementation adds a last_profiled_frame field to the thread state that tracks where the previous sample stopped. On the next sample, if the current frame chain reaches this marker, the cached frames from that point onward are reused instead of being re-read from remote memory.

The sampling profiler now enables frame caching by default.

9 days agoGH-142363: Contrast and gradient CSS fixes for Tachyon flamegraph (#142364)
Savannah Ostrowski [Sat, 6 Dec 2025 22:09:10 +0000 (14:09 -0800)] 
GH-142363: Contrast and gradient CSS fixes for Tachyon flamegraph (#142364)

9 days agogh-68552: fix defects policy (#138579)
Ivo Bellin Salarin [Sat, 6 Dec 2025 21:54:29 +0000 (22:54 +0100)] 
gh-68552: fix defects policy  (#138579)

Extend defect handling via policy to a couple of missed defects.

---------

Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
Co-authored-by: Ivo Bellin Salarin <ivo@nilleb.com>
9 days agogh-142236: Fix incorrect keyword suggestions for syntax errors (#142328)
Pablo Galindo Salgado [Sat, 6 Dec 2025 21:09:35 +0000 (21:09 +0000)] 
gh-142236: Fix incorrect keyword suggestions for syntax errors (#142328)

The keyword typo suggestion mechanism in traceback would incorrectly
suggest replacements when the extracted source code was merely incomplete
rather than containing an actual typo. For example, when a missing comma
caused a syntax error, the system would suggest replacing 'print' with
'not' because the incomplete code snippet happened to pass validation.

The fix adds a validation step that first checks whether the original
extracted code raises a SyntaxError. If the code compiles successfully
or is simply incomplete (compile_command returns None), the function
returns early since there is no way to verify that a keyword replacement
would actually fix the problem.

9 days agogh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline ...
Paresh Joshi [Sat, 6 Dec 2025 20:59:35 +0000 (02:29 +0530)] 
gh-142006: Fix HeaderWriteError in email.policy.default caused by extra newline (#142008)

RDM: This fixes a subtle folding error that showed up when a token exactly filled a line and was followed by whitespace and a token with no folding whitespace that was longer than a line.  In this particular circumstance the whitespace after the first token got pushed on to the next line, and then stolen to go in front of the next unfoldable token...leaving a completely empty line in the line buffer.  That line got turned in to a newline, which is RFC illegal, and the newish security check caught it.  The fix is to just delete that empty line from the buffer.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
9 days agogh-69113: Fix doctest to report line numbers for __test__ strings (#141624)
Sanyam Khurana [Sat, 6 Dec 2025 20:47:08 +0000 (15:47 -0500)] 
gh-69113: Fix doctest to report line numbers for __test__ strings (#141624)

Enhanced the _find_lineno method in doctest to correctly identify and
report line numbers for doctests defined in __test__ dictionaries when
formatted as triple-quoted strings.

Finds a non-blank line in the test string and matches it in the source
file, verifying subsequent lines also match to handle duplicate lines.

Previously, doctest would report "line None" for __test__ dictionary
strings, making it difficult to debug failing tests.

Co-authored-by: Jurjen N.E. Bos <jneb@users.sourceforge.net>
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
9 days agogh-140677 Improve heatmap colors (#142241)
ivonastojanovic [Sat, 6 Dec 2025 20:27:16 +0000 (20:27 +0000)] 
gh-140677 Improve heatmap colors (#142241)

Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
9 days agogh-105836: Fix `asyncio.run_coroutine_threadsafe` leaving underlying cancelled asynci...
Kaisheng Xu [Sat, 6 Dec 2025 19:33:25 +0000 (03:33 +0800)] 
gh-105836: Fix `asyncio.run_coroutine_threadsafe` leaving underlying cancelled asyncio task running (#141696)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
9 days agoGH-141565: Add async code awareness to Tachyon (#141533)
Savannah Ostrowski [Sat, 6 Dec 2025 19:31:40 +0000 (11:31 -0800)] 
GH-141565: Add async code awareness to Tachyon (#141533)

Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
9 days agogh-142168: explicitly initialize `stack_array` in `_PyEval_Vector` and `_PyEvalFrameP...
Kir Chou [Sat, 6 Dec 2025 18:59:52 +0000 (03:59 +0900)] 
gh-142168: explicitly initialize `stack_array` in `_PyEval_Vector` and `_PyEvalFramePushAndInit_Ex` (#142192)

Co-authored-by: Kir Chou <note351@hotmail.com>
9 days agoGH-64532: Include parent's required optional arguments in subparser usage (#142355)
Savannah Ostrowski [Sat, 6 Dec 2025 18:30:50 +0000 (10:30 -0800)] 
GH-64532: Include parent's required optional arguments in subparser usage (#142355)

9 days agogh-142332: Fix usage formatting for positional arguments in mutually exclusive groups...
Serhiy Storchaka [Sat, 6 Dec 2025 18:03:45 +0000 (20:03 +0200)] 
gh-142332: Fix usage formatting for positional arguments in mutually exclusive groups in argparse (GH-142333)

9 days agoGH-75949: Fix argparse dropping '|' in mutually exclusive groups on line wrap (#142312)
Savannah Ostrowski [Sat, 6 Dec 2025 15:12:21 +0000 (07:12 -0800)] 
GH-75949: Fix argparse dropping '|' in mutually exclusive groups on line wrap (#142312)

9 days agoDocs: fix RFC index reference for TLS 1.3 (#142262)
Y. Z. Chen [Sat, 6 Dec 2025 13:05:20 +0000 (21:05 +0800)] 
Docs: fix RFC index reference for TLS 1.3 (#142262)

9 days agoRemove unused imports (#142320)
Victor Stinner [Sat, 6 Dec 2025 11:27:31 +0000 (12:27 +0100)] 
Remove unused imports (#142320)

10 days agoGH-142234: Allow `--enable-wasm-dynamic-linking` under WASI (GH-142235)
Brett Cannon [Fri, 5 Dec 2025 23:27:16 +0000 (15:27 -0800)] 
GH-142234: Allow `--enable-wasm-dynamic-linking` under WASI (GH-142235)

While CPython doesn't support `--enable-wasm-dynamic-linking`, external tools like componentize-py do and they have to patch around it. Since the flag is off by default, allowing the flag so external users can add/inject dynamic linking support seems acceptable.

10 days agoExtract data from `Tools/wasm/wasi` that varies between Python versions into a config...
Brett Cannon [Fri, 5 Dec 2025 22:31:30 +0000 (14:31 -0800)] 
Extract data from `Tools/wasm/wasi` that varies between Python versions into a config file (GH-142273)

This should allow for easier backporting of code.

10 days agoIntroduce `build-python` and `build-host` subcommands for `Tools/wasm/wasi` (GH-142266)
Brett Cannon [Fri, 5 Dec 2025 21:35:50 +0000 (13:35 -0800)] 
Introduce `build-python` and `build-host` subcommands for `Tools/wasm/wasi` (GH-142266)

It should make it easier when you need to rebuild just the e.g. host Python, but it requires ./configure to run.

Co-authored-by: Emma Smith <emma@emmatyping.dev>
10 days agogh-142318: Fix typing `'q'` at interactive help screen exiting Tachyon (#142319)
Stan Ulbrych [Fri, 5 Dec 2025 19:36:28 +0000 (19:36 +0000)] 
gh-142318: Fix typing `'q'` at interactive help screen exiting Tachyon (#142319)

10 days agogh-115952: Fix a potential virtual memory allocation denial of service in pickle...
Serhiy Storchaka [Fri, 5 Dec 2025 17:17:01 +0000 (19:17 +0200)] 
gh-115952: Fix a potential virtual memory allocation denial of service in pickle (GH-119204)

Loading a small data which does not even involve arbitrary code execution
could consume arbitrary large amount of memory. There were three issues:

* PUT and LONG_BINPUT with large argument (the C implementation only).
  Since the memo is implemented in C as a continuous dynamic array, a single
  opcode can cause its resizing to arbitrary size. Now the sparsity of
  memo indices is limited.
* BINBYTES, BINBYTES8 and BYTEARRAY8 with large argument.  They allocated
  the bytes or bytearray object of the specified size before reading into
  it.  Now they read very large data by chunks.
* BINSTRING, BINUNICODE, LONG4, BINUNICODE8 and FRAME with large
  argument.  They read the whole data by calling the read() method of
  the underlying file object, which usually allocates the bytes object of
  the specified size before reading into it.  Now they read very large data
  by chunks.

Also add comprehensive benchmark suite to measure performance and memory
impact of chunked reading optimization in PR #119204.

Features:
- Normal mode: benchmarks legitimate pickles (time/memory metrics)
- Antagonistic mode: tests malicious pickles (DoS protection)
- Baseline comparison: side-by-side comparison of two Python builds
- Support for truncated data and sparse memo attack vectors

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
10 days agoGH-142267: Cache formatter to avoid repeated `_set_color` calls (#142268)
Savannah Ostrowski [Fri, 5 Dec 2025 16:47:50 +0000 (08:47 -0800)] 
GH-142267: Cache formatter to avoid repeated `_set_color` calls (#142268)

10 days agoGH-139862: Remove `color` from HelpFormatter (#142274)
Savannah Ostrowski [Fri, 5 Dec 2025 16:21:31 +0000 (08:21 -0800)] 
GH-139862: Remove `color` from HelpFormatter (#142274)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
10 days agoAdd explanation comments for tests for overlapped ZIP entries (GH-137152)
Serhiy Storchaka [Fri, 5 Dec 2025 16:09:20 +0000 (18:09 +0200)] 
Add explanation comments for tests for overlapped ZIP entries (GH-137152)

10 days agogh-141370: Fix undefined behavior when using Py_ABS() (GH-141548)
Serhiy Storchaka [Fri, 5 Dec 2025 14:24:35 +0000 (16:24 +0200)] 
gh-141370: Fix undefined behavior when using Py_ABS() (GH-141548)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
10 days agogh-101100: Fix references to the set methods (GH-141857)
Serhiy Storchaka [Fri, 5 Dec 2025 14:22:38 +0000 (16:22 +0200)] 
gh-101100: Fix references to the set methods (GH-141857)

10 days agoFix disk space issues in Android CI (#142289)
Malcolm Smith [Fri, 5 Dec 2025 13:10:51 +0000 (13:10 +0000)] 
Fix disk space issues in Android CI (#142289)

10 days agogh-48752: Add readline.get_pre_input_hook() function (#141586)
Sanyam Khurana [Fri, 5 Dec 2025 12:18:54 +0000 (07:18 -0500)] 
gh-48752: Add readline.get_pre_input_hook() function (#141586)

Add readline.get_pre_input_hook() to retrieve the current pre-input
hook. This allows applications to save and restore the hook without
overwriting user settings.

11 days agogh-142214: Fix two regressions in dataclasses (#142223)
Jelle Zijlstra [Fri, 5 Dec 2025 04:04:42 +0000 (20:04 -0800)] 
gh-142214: Fix two regressions in dataclasses (#142223)

11 days agogh-141926: Do not unset `RUNSHARED` when cross-compiling (#141958)
Zanie Blue [Fri, 5 Dec 2025 02:15:04 +0000 (20:15 -0600)] 
gh-141926: Do not unset `RUNSHARED` when cross-compiling (#141958)

11 days agogh-141976: Check stack bounds in JIT optimizer (GH-142201)
Ken Jin [Thu, 4 Dec 2025 20:28:08 +0000 (04:28 +0800)] 
gh-141976: Check stack bounds in JIT optimizer (GH-142201)

11 days agogh-116738: Statically initialize special constants in cmath module (gh-142161)
Alper [Thu, 4 Dec 2025 14:21:51 +0000 (06:21 -0800)] 
gh-116738: Statically initialize special constants in cmath module (gh-142161)

The initialization during `mod_exec` wasn't thread-safe with multiple interpreters.

11 days agogh-129483: Make `TestLocalTimeDisambiguation`'s time format locale independent (...
Kir Chou [Thu, 4 Dec 2025 13:32:23 +0000 (22:32 +0900)] 
gh-129483: Make `TestLocalTimeDisambiguation`'s time format locale independent (#142193)

* Change to update %c to the exact time format.

---------

Co-authored-by: Kir Chou <note351@hotmail.com>
11 days ago GH-139757: Fix reference leaks introduced in GH-140800 (GH-142257)
Mark Shannon [Thu, 4 Dec 2025 12:27:15 +0000 (12:27 +0000)] 
 GH-139757: Fix reference leaks introduced in GH-140800 (GH-142257)

11 days agogh-142225: Fix `PyABIInfo_VAR` macro (GH-142230)
Stan Ulbrych [Thu, 4 Dec 2025 09:33:15 +0000 (09:33 +0000)] 
gh-142225: Fix `PyABIInfo_VAR` macro (GH-142230)

12 days agogh-141004: Add a CI job ensuring that new C APIs include documentation (GH-142102)
Peter Bierma [Thu, 4 Dec 2025 03:14:25 +0000 (22:14 -0500)] 
gh-141004: Add a CI job ensuring that new C APIs include documentation (GH-142102)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
12 days agoBeing more flexible in when not to explicitly set the sysroot when compiling for...
Brett Cannon [Wed, 3 Dec 2025 23:42:10 +0000 (15:42 -0800)] 
Being more flexible in when not to explicitly set the sysroot when compiling for WASI (GH-142242)

12 days agogh-142218: Fix split table dictionary crash (gh-142229)
Sam Gross [Wed, 3 Dec 2025 23:37:35 +0000 (18:37 -0500)] 
gh-142218: Fix split table dictionary crash (gh-142229)

This fixes a regression introduced in gh-140558. The interpreter would
crash if we inserted a non `str` key into a split table that matches an
existing key.

12 days agoGH-142050: Jit stencils on Windows contain debug data (#142052)
Chris Eibl [Wed, 3 Dec 2025 22:08:51 +0000 (23:08 +0100)] 
GH-142050: Jit stencils on Windows contain debug data (#142052)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
12 days agogh-140482: Avoid changing terminal settings in test_pty (gh-142202)
Sam Gross [Wed, 3 Dec 2025 20:48:44 +0000 (15:48 -0500)] 
gh-140482: Avoid changing terminal settings in test_pty (gh-142202)

The previous test_spawn_doesnt_hang test had a few problems:

* It would cause ENV CHANGED failures if other tests were running
  concurrently due to stty changes
* Typing while the test was running could cause it to fail

12 days agoGH-141794: Limit size of generated machine code. (GH-142228)
Mark Shannon [Wed, 3 Dec 2025 17:43:35 +0000 (17:43 +0000)] 
GH-141794: Limit size of generated machine code. (GH-142228)

* Factor out bodies of the largest uops, to reduce jit code size.
* Factor out common assert, also reducing jit code size.
* Limit size of jitted code for a single executor to 1MB.

12 days agogh-135676: Reword the f-string (and t-string) section (GH-137469)
Petr Viktorin [Wed, 3 Dec 2025 15:14:53 +0000 (16:14 +0100)] 
gh-135676: Reword the f-string (and t-string) section (GH-137469)

Much of the information was duplicated in stdtypes.rst; this PR keeps lexical/syntactical details in Lexical Analysis and the evaluation & runtime behaviour in Standard types, with cross-references between the two.
Since the t-string section only listed differences from f-strings, and the grammar for the two is equivalent, that section was moved to Standard types almost entirely.

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
12 days agogh-142038: Expand guard for types_world_is_stopped() to fix debug builds without...
Uwe L. Korn [Wed, 3 Dec 2025 14:24:17 +0000 (15:24 +0100)] 
gh-142038: Expand guard for types_world_is_stopped() to fix debug builds without assertions (#142039)

12 days agogh-142217: Remove internal _Py_Identifier functions (#142219)
Victor Stinner [Wed, 3 Dec 2025 13:33:32 +0000 (14:33 +0100)] 
gh-142217: Remove internal _Py_Identifier functions (#142219)

Remove internal functions:

* _PyDict_ContainsId()
* _PyDict_DelItemId()
* _PyDict_GetItemIdWithError()
* _PyDict_SetItemId()
* _PyEval_GetBuiltinId()
* _PyObject_CallMethodIdNoArgs()
* _PyObject_CallMethodIdObjArgs()
* _PyObject_CallMethodIdOneArg()
* _PyObject_VectorcallMethodId()
* _PyUnicode_EqualToASCIIId()

These functions were not exported and so no usable outside CPython.

12 days agogh-142206: multiprocessing.resource_tracker: Decode messages using older protocol...
Petr Viktorin [Wed, 3 Dec 2025 12:59:14 +0000 (13:59 +0100)] 
gh-142206: multiprocessing.resource_tracker: Decode messages using older protocol (GH-142215)

12 days agogh-142170: Add pymanager link to issue template menu (#142199)
Bartosz Sławecki [Wed, 3 Dec 2025 09:11:40 +0000 (10:11 +0100)] 
gh-142170: Add pymanager link to issue template menu (#142199)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
13 days agogh-142145: Remove quadratic behavior in node ID cache clearing (GH-142146)
Seth Michael Larson [Wed, 3 Dec 2025 07:16:37 +0000 (01:16 -0600)] 
gh-142145: Remove quadratic behavior in node ID cache clearing (GH-142146)

* Remove quadratic behavior in node ID cache clearing

Co-authored-by: Jacob Walls <38668450+jacobtylerwalls@users.noreply.github.com>
* Add news fragment

---------

Co-authored-by: Jacob Walls <38668450+jacobtylerwalls@users.noreply.github.com>
13 days agogh-140677 Add heatmap visualization to Tachyon sampling profiler (#140680)
Pablo Galindo Salgado [Tue, 2 Dec 2025 20:33:40 +0000 (20:33 +0000)] 
gh-140677 Add heatmap visualization to Tachyon sampling profiler (#140680)

Co-authored-by: Ivona Stojanovic <stojanovic.i@hotmail.com>
13 days agogh-139707: Fix example for configure option (GH-142153)
Stan Ulbrych [Tue, 2 Dec 2025 13:12:20 +0000 (13:12 +0000)] 
gh-139707: Fix example for configure option (GH-142153)

Fix example for nre configure option

13 days agoDocument None for timeout argument of select.select (#142177)
Petr Viktorin [Tue, 2 Dec 2025 08:57:09 +0000 (09:57 +0100)] 
Document None for timeout argument of select.select (#142177)

13 days agogh-141982: Fix pdb can't set breakpoints on async functions (#141983)
LloydZ [Tue, 2 Dec 2025 07:40:02 +0000 (15:40 +0800)] 
gh-141982: Fix pdb can't set breakpoints on async functions (#141983)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2 weeks agogh-140281: Update free threading Python HOWTO for 3.14 (gh-140566)
Krishna-web-hub [Tue, 2 Dec 2025 05:53:12 +0000 (11:23 +0530)] 
gh-140281: Update free threading Python HOWTO for 3.14 (gh-140566)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2 weeks agogh-59000: Fix pdb breakpoint resolution for class methods when module not imported...
LloydZ [Tue, 2 Dec 2025 04:41:54 +0000 (12:41 +0800)] 
gh-59000: Fix pdb breakpoint resolution for class methods when module not imported (#141949)

2 weeks agogh-142163: Only define `HAVE_THREAD_LOCAL` when `Py_BUILD_CORE` is set (#142164)
Peter Bierma [Tue, 2 Dec 2025 04:13:11 +0000 (23:13 -0500)] 
gh-142163: Only define `HAVE_THREAD_LOCAL` when `Py_BUILD_CORE` is set (#142164)

2 weeks agogh-142048: Fix quadratically increasing GC delays (gh-142051)
Kevin Wang [Tue, 2 Dec 2025 00:04:47 +0000 (19:04 -0500)] 
gh-142048: Fix quadratically increasing GC delays (gh-142051)

The GC for the free threaded build would get slower with each collection due
to effectively double counting objects freed by the GC.

2 weeks agogh-138122: Small fixes to the new tachyon UI (#142157)
Pablo Galindo Salgado [Mon, 1 Dec 2025 18:37:46 +0000 (18:37 +0000)] 
gh-138122: Small fixes to the new tachyon UI (#142157)

2 weeks agogh-138122: New Tachyon UI (#142116)
László Kiss Kollár [Mon, 1 Dec 2025 17:34:14 +0000 (17:34 +0000)] 
gh-138122: New Tachyon UI (#142116)

Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
2 weeks agogh-141004: Document descriptor and dict proxy type objects (GH-141803)
Yashraj [Mon, 1 Dec 2025 15:51:50 +0000 (21:21 +0530)] 
gh-141004: Document descriptor and dict proxy type objects (GH-141803)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2 weeks agogh-119342: Fix a potential denial of service in plistlib (GH-119343)
Serhiy Storchaka [Mon, 1 Dec 2025 15:28:15 +0000 (17:28 +0200)] 
gh-119342: Fix a potential denial of service in plistlib (GH-119343)

Reading a specially prepared small Plist file could cause OOM because file's
read(n) preallocates a bytes object for reading the specified amount of
data. Now plistlib reads large data by chunks, therefore the upper limit of
consumed memory is proportional to the size of the input file.

2 weeks agogh-119451: Fix a potential denial of service in http.client (GH-119454)
Serhiy Storchaka [Mon, 1 Dec 2025 15:26:07 +0000 (17:26 +0200)] 
gh-119451: Fix a potential denial of service in http.client (GH-119454)

Reading the whole body of the HTTP response could cause OOM if
the Content-Length value is too large even if the server does not send
a large amount of data. Now the HTTP client reads large data by chunks,
therefore the amount of consumed memory is proportional to the amount
of sent data.

2 weeks agogh-139707: Add mechanism for distributors to supply error messages for missing stdlib...
Stan Ulbrych [Mon, 1 Dec 2025 13:36:17 +0000 (13:36 +0000)] 
gh-139707: Add mechanism for distributors to supply error messages for missing stdlib modules (GH-140783)

2 weeks agoDocs: Upgrade Sphinx to 9.0 (#142114)
Adam Turner [Mon, 1 Dec 2025 11:16:37 +0000 (11:16 +0000)] 
Docs: Upgrade Sphinx to 9.0 (#142114)

2 weeks agogh-141473: Document not calling Popen.wait after Popen.communicate times out. (GH...
Gregory P. Smith [Mon, 1 Dec 2025 02:50:05 +0000 (18:50 -0800)] 
gh-141473: Document not calling Popen.wait after Popen.communicate times out. (GH-142101)

Document not calling Popen.wait after Popen.communicate times out.

Closes #141473

2 weeks agogh-142066: Fix grammar in multiprocessing Pipes and Queues (GH-142121)
Tadej Magajna [Mon, 1 Dec 2025 02:14:20 +0000 (03:14 +0100)] 
gh-142066: Fix grammar in multiprocessing Pipes and Queues (GH-142121)

docs: Fix grammar in multiprocessing Pipes and Queues (gh-142066)

2 weeks agogh-142067: Add missing default value for param in `multiprocessing.Pipe`'s doc (GH...
flovent [Sun, 30 Nov 2025 21:10:01 +0000 (05:10 +0800)] 
gh-142067: Add missing default value for param in `multiprocessing.Pipe`'s doc (GH-142109)

2 weeks agoImprove clarity in tutorial introduction (#140669)
Thierry Martos [Sun, 30 Nov 2025 12:47:31 +0000 (04:47 -0800)] 
Improve clarity in tutorial introduction (#140669)

2 weeks agogh-141999: Handle KeyboardInterrupt when sampling in the new tachyon profiler (#142000)
yihong [Sun, 30 Nov 2025 02:49:13 +0000 (10:49 +0800)] 
gh-141999: Handle KeyboardInterrupt when sampling in the new tachyon profiler (#142000)

2 weeks agogh-138122: Add thread status statistics to flamegraph profiler (#141900)
Pablo Galindo Salgado [Sun, 30 Nov 2025 01:42:39 +0000 (01:42 +0000)] 
gh-138122: Add thread status statistics to flamegraph profiler (#141900)

Co-authored-by: ivonastojanovic <80911834+ivonastojanovic@users.noreply.github.com>
2 weeks agogh-133146: Add the old public `get_value` method to documentation and refactor code...
Duprat [Sat, 29 Nov 2025 22:12:48 +0000 (23:12 +0100)] 
gh-133146: Add the old public `get_value` method to documentation and refactor code. (GH-133301)

also uses it within the internals in a few places.

2 weeks agoGH-141808: Do not generate the jit stencils twice in case of PGO builds on Windows...
Chris Eibl [Sat, 29 Nov 2025 20:43:06 +0000 (21:43 +0100)] 
GH-141808: Do not generate the jit stencils twice in case of PGO builds on Windows. (GH-142043)

* do not build the jit stencils twice in case of PGO builds on Windows

* blurb it

2 weeks agoDocs: Prepare for Sphinx 9 (#142057)
Adam Turner [Sat, 29 Nov 2025 14:49:37 +0000 (14:49 +0000)] 
Docs: Prepare for Sphinx 9 (#142057)

2 weeks agoGH-121970: Remove Docutils list monkeypatch (#142056)
Adam Turner [Sat, 29 Nov 2025 14:28:23 +0000 (14:28 +0000)] 
GH-121970: Remove Docutils list monkeypatch (#142056)

2 weeks agoGH-141963: Clarify argparse documentation (GH-141964)
Moshe Kaplan [Sat, 29 Nov 2025 07:23:34 +0000 (02:23 -0500)] 
GH-141963: Clarify argparse documentation (GH-141964)

Clarify argparse documentation

Tightens the phrasing for several argparse actions.

2 weeks agoDocs: multi-disk ZIP files -> multipart ZIP files (GH-141962)
Hugo van Kemenade [Sat, 29 Nov 2025 07:11:59 +0000 (09:11 +0200)] 
Docs: multi-disk ZIP files -> multipart ZIP files (GH-141962)

* Remove some old currentlies
* multi-disk -> multipart
* Sentence case headings

2 weeks agogh-141994: Warn of XXE vulnerability in documentation of SAX feature `xml.sax.handler...
Sebastian Pipping [Sat, 29 Nov 2025 07:08:17 +0000 (08:08 +0100)] 
gh-141994: Warn of XXE vulnerability in documentation of SAX feature `xml.sax.handler.feature_external_ges` (GH-141996)

Doc/library/xml.sax.handler.rst: Warn of XXE with feature_external_ges

Related to commit baa9f338971c6a13433a8232db77cd45e6b87b77

2 weeks agoFix multiprocessing queue test_get() (GH-142024)
Victor Stinner [Sat, 29 Nov 2025 07:00:14 +0000 (08:00 +0100)] 
Fix multiprocessing queue test_get() (GH-142024)

* Replace sleep() with support.sleeping_retry().
* Test get_nowait() first.
* Restore previously disabled test.

Fix the failure:

FAIL: test_get (test.test_multiprocessing_spawn.test_processes.WithProcessesTestQueue.test_get)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/_test_multiprocessing.py", line 1208, in test_get
    self.assertEqual(queue_empty(queue), False)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: True != False

2 weeks agogh-87512: Fix `subprocess` using `timeout=` on Windows blocking with a large `input...
Gregory P. Smith [Sat, 29 Nov 2025 06:07:03 +0000 (22:07 -0800)] 
gh-87512: Fix `subprocess` using `timeout=` on Windows blocking with a large `input=` (GH-142058)

On Windows, Popen._communicate() previously wrote to stdin synchronously, which could block indefinitely if the subprocess didn't consume input= quickly and the pipe buffer filled up. The timeout= parameter was only checked when joining the reader threads, not during the stdin write.

This change moves the Windows stdin writing to a background thread (similar to how stdout/stderr are read in threads), allowing the timeout to be properly enforced. If timeout expires, TimeoutExpired is raised promptly and the writer thread continues in the background. Subsequent calls to communicate() will join the existing writer thread.

Adds test_communicate_timeout_large_input to verify that TimeoutExpired is raised promptly when communicate() is called with large input and a timeout, even when the subprocess doesn't consume stdin quickly.

This test already passed on POSIX (where select() is used) but failed on Windows where the stdin write blocks without checking the timeout.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2 weeks agogh-74389: gh-70560: subprocess.Popen.communicate() now ignores stdin.flush error...
Gregory P. Smith [Sat, 29 Nov 2025 05:03:06 +0000 (21:03 -0800)] 
gh-74389: gh-70560: subprocess.Popen.communicate() now ignores stdin.flush error when closed (GH-142061)

gh-70560: gh-74389: subprocess.Popen.communicate() now ignores stdin.flush error when closed

with a unittest and news entry.

2 weeks agoGH-134453: Fix subprocess memoryview input handling on POSIX (GH-134949)
Gregory P. Smith [Sat, 29 Nov 2025 04:25:06 +0000 (20:25 -0800)] 
GH-134453: Fix subprocess memoryview input handling on POSIX (GH-134949)

Fix inconsistent subprocess.Popen.communicate() behavior between Windows
and POSIX when using memoryview objects with non-byte elements as input.

On POSIX systems, the code was incorrectly comparing bytes written against
element count instead of byte count, causing data truncation for large
inputs with non-byte element types.

Changes:
- Cast memoryview inputs to byte view when input is already a memoryview
- Fix progress tracking to use len(input_view) instead of len(self._input)
- Add comprehensive test coverage for memoryview inputs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
* old-man-yells-at-ReST
* Update 2025-05-30-18-37-44.gh-issue-134453.kxkA-o.rst
* assertIsNone review feedback
* fix memoryview_nonbytes test to fail without our fix on main, and have a nicer error.

Thanks to Peter Bierma @ZeroIntensity for the code review.

2 weeks agogh-141473: Fix subprocess.Popen.communicate to send input to stdin upon a subsequent...
Artur Jamro [Sat, 29 Nov 2025 02:04:52 +0000 (03:04 +0100)] 
gh-141473: Fix subprocess.Popen.communicate to send input to stdin upon a subsequent post-timeout call (GH-141477)

* gh-141473: Fix subprocess.Popen.communicate to send input to stdin
* Docs: Clarify that `input` is one time only on `communicate()`
* NEWS entry
* Add a regression test.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 weeks agoDocs: Move to method references for bytearray.take_bytes (#142053)
Cody Maloney [Fri, 28 Nov 2025 21:07:34 +0000 (13:07 -0800)] 
Docs: Move to method references for bytearray.take_bytes (#142053)

2 weeks agogh-142025: Add c-analyzer include for pyexpat.c (GH-142026)
dgpb [Fri, 28 Nov 2025 17:51:48 +0000 (19:51 +0200)] 
gh-142025: Add c-analyzer include for pyexpat.c (GH-142026)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2 weeks agogh-141968: Use take_bytes in encodings.punycode (#141974)
Cody Maloney [Fri, 28 Nov 2025 17:47:14 +0000 (09:47 -0800)] 
gh-141968: Use take_bytes in encodings.punycode (#141974)

Removes a copy going from bytearray to bytes.

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2 weeks agogh-141968: Use take_bytes in re._compiler (#141995)
Cody Maloney [Fri, 28 Nov 2025 17:46:10 +0000 (09:46 -0800)] 
gh-141968: Use take_bytes in re._compiler (#141995)

Removes a copy going from bytearray to bytes.

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2 weeks agogh-133228: c-analyzer clang preprocessor (GH-133229)
dgpb [Thu, 27 Nov 2025 22:22:21 +0000 (00:22 +0200)] 
gh-133228: c-analyzer clang preprocessor (GH-133229)

* impl
* included 2 failures to tsvs next to similar entries
* added fix/hack for curses.h fails
* fix leftover from debug

2 weeks agogh-141930: Use the regular IO stack to write .pyc files for a better error message...
Stefano Rivera [Thu, 27 Nov 2025 19:17:59 +0000 (11:17 -0800)] 
gh-141930: Use the regular IO stack to write .pyc files for a better error message on failure (GH-141931)

* Use open() to write the bytecode
* Convert to unittest style asserts
* Tweak news, thanks @vstinner
* Tidy
* reword NEWS, avoid word "retried"

2 weeks agogh-140210: Make test_sysconfig.test_parse_makefile_renamed_vars ignore environment...
Miro Hrončok [Thu, 27 Nov 2025 18:00:02 +0000 (19:00 +0100)] 
gh-140210: Make test_sysconfig.test_parse_makefile_renamed_vars ignore environment variables (#140213)

The test did not expect it could be run with e.g. CFLAGS set to a custom value.

2 weeks agogh-140505: Fix 'parameters' to 'arguments' in xmlrpc.client.MultiCall docs (GH-141942)
SIVALANAGASHANKARNIVAS [Thu, 27 Nov 2025 17:01:15 +0000 (22:31 +0530)] 
gh-140505: Fix 'parameters' to 'arguments' in xmlrpc.client.MultiCall docs (GH-141942)

Fix terminology: change 'parameters' to 'arguments' in MultiCall docs

Fixes #140505

2 weeks agogh-130396: Export _Py_ReachedRecursionLimitWithMargin() (#142012)
Victor Stinner [Thu, 27 Nov 2025 12:22:15 +0000 (13:22 +0100)] 
gh-130396: Export _Py_ReachedRecursionLimitWithMargin() (#142012)

test_peg_generator needs the function.

2 weeks agogh-116008: Detect freed thread state in faulthandler (#141988)
Victor Stinner [Thu, 27 Nov 2025 11:35:00 +0000 (12:35 +0100)] 
gh-116008: Detect freed thread state in faulthandler (#141988)

Add _PyMem_IsULongFreed() function.

2 weeks agogh-127635: Use flexible array in tracemalloc (#141991)
Victor Stinner [Thu, 27 Nov 2025 11:32:31 +0000 (12:32 +0100)] 
gh-127635: Use flexible array in tracemalloc (#141991)

Replace frames[1] with frames[] in tracemalloc_traceback structure.

2 weeks agogh-130396: Remove _Py_ReachedRecursionLimitWithMargin() function (#141951)
Victor Stinner [Thu, 27 Nov 2025 11:32:00 +0000 (12:32 +0100)] 
gh-130396: Remove _Py_ReachedRecursionLimitWithMargin() function (#141951)

Move the private function to the internal C API (pycore_ceval.h).

2 weeks agogh-116738: Fix thread-safety issue in re module for free threading (gh-141923)
Alper [Wed, 26 Nov 2025 20:40:45 +0000 (12:40 -0800)] 
gh-116738: Fix thread-safety issue in re module for free threading (gh-141923)

Added atomic operations to `scanner_begin()` and `scanner_end()` to prevent
race conditions on the `executing` flag in free-threaded builds. Also added
tests for concurrent usage of the `re` module.

Without the atomic operations, `test_scanner_concurrent_access()` triggers
`assert(self->executing)` failures, or a thread sanitizer run emits errors.

2 weeks agogh-141968: use `bytearray.take_bytes` in `encodings.idna` (#141975)
Cody Maloney [Wed, 26 Nov 2025 15:46:25 +0000 (07:46 -0800)] 
gh-141968: use `bytearray.take_bytes` in `encodings.idna` (#141975)

2 weeks agogh-141968: use `bytearray.take_bytes` in `wave._byteswap` (#141973)
Cody Maloney [Wed, 26 Nov 2025 15:45:12 +0000 (07:45 -0800)] 
gh-141968: use `bytearray.take_bytes` in `wave._byteswap` (#141973)