]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 months agogh-144319: Fix huge page safety in pymalloc arenas (#144331) 128880/head
Pablo Galindo Salgado [Fri, 30 Jan 2026 18:18:56 +0000 (18:18 +0000)] 
gh-144319: Fix huge page safety in pymalloc arenas (#144331)

The pymalloc huge page support had two problems. First, on
architectures where the default huge page size exceeds the arena
size (e.g. 32 MiB on PPC, 512 MiB on ARM64 with 64 KB base
pages), mmap with MAP_HUGETLB silently allocates a full huge page
even when the requested size is smaller. The subsequent munmap
with the original arena size then fails with EINVAL, permanently
leaking the entire huge page. Second, huge pages were always
attempted when compiled in, with no way to disable them at
runtime. On Linux, if the huge page pool is exhausted, page
faults including copy-on-write faults after fork deliver SIGBUS
and kill the process.

The arena allocator now queries the system huge page size from
/proc/meminfo and skips MAP_HUGETLB when the arena size is not a
multiple of it. Huge pages also now require explicit opt-in at
runtime via the PYTHON_PYMALLOC_HUGEPAGES environment variable,
which is read through PyConfig and respects -E and -I flags.
The config field pymalloc_hugepages is propagated to the runtime
allocators struct so the low-level arena allocator can check it
without calling getenv directly.

2 months agogh-120321: Make gi_yieldfrom thread-safe in free-threading build (#144292)
Sam Gross [Fri, 30 Jan 2026 17:20:27 +0000 (12:20 -0500)] 
gh-120321: Make gi_yieldfrom thread-safe in free-threading build (#144292)

Add a FRAME_SUSPENDED_YIELD_FROM_LOCKED state that acts as a brief
lock, preventing other threads from transitioning the frame state
while gen_getyieldfrom reads the yield-from object off the stack.

2 months agogh-144280: Add missing predicate symbol to case-switch (GH-144298)
reiden [Fri, 30 Jan 2026 16:43:27 +0000 (00:43 +0800)] 
gh-144280: Add missing predicate symbol to case-switch (GH-144298)

2 months agogh-144295: Fix data race in dict method lookup and global load (gh-144312)
Sam Gross [Fri, 30 Jan 2026 16:14:10 +0000 (11:14 -0500)] 
gh-144295: Fix data race in dict method lookup and global load (gh-144312)

In `_PyDict_GetMethodStackRef`, only use the fast-path unicode lookup
when the dict is owned by the current thread or already marked as shared.
This prevents a race between the lookup and concurrent dict resizes,
which may free the PyDictKeysObject (i.e., it ensures that the resize
uses QSBR).

Address a similar issue in `_Py_dict_lookup_threadsafe_stackref` by
calling `ensure_shared_on_read()`.

2 months agogh-144145: Track nullness of properties in the Tier 2 JIT optimizer (GH-144122)
Hai Zhu [Fri, 30 Jan 2026 15:25:19 +0000 (23:25 +0800)] 
gh-144145: Track nullness of properties in the Tier 2 JIT optimizer (GH-144122)

2 months agogh-144342: Use `time.sleep` in `profiling.sampling` (#144343)
Maurycy Pawłowski-Wieroński [Fri, 30 Jan 2026 15:13:21 +0000 (16:13 +0100)] 
gh-144342: Use `time.sleep` in `profiling.sampling` (#144343)

2 months agogh-143423: Fix free-threaded build detection in sampling profiler (#143426)
Divyanshu Choudhury [Fri, 30 Jan 2026 00:35:30 +0000 (06:05 +0530)] 
gh-143423: Fix free-threaded build detection in sampling profiler (#143426)

2 months agogh-143192 Avoid incref/decref pair in long_bitwise (gh-143194)
Pieter Eendebak [Thu, 29 Jan 2026 21:32:09 +0000 (22:32 +0100)] 
gh-143192 Avoid incref/decref pair in long_bitwise (gh-143194)

Remove unnecessary reference count operations in long_bitwise in order to
avoid reference count contention in the free-threading build.

2 months agogh-144307: Fix a reference leak during module teardown (GH-144308)
Yongtao Huang [Thu, 29 Jan 2026 18:50:54 +0000 (02:50 +0800)] 
gh-144307: Fix a reference leak during module teardown (GH-144308)

Signed-off-by: Yongtao Huang <yongtaoh2022@gamil.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 months agoTest: fix stale uops usage in `test_capi/test_opt.py` (GH-144239)
Yongtao Huang [Thu, 29 Jan 2026 17:08:14 +0000 (01:08 +0800)] 
Test: fix stale uops usage in `test_capi/test_opt.py` (GH-144239)

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
2 months agogh-143946: Add more debug info in `optimize_uops` (GH-144262)
Hai Zhu [Thu, 29 Jan 2026 16:58:01 +0000 (00:58 +0800)] 
gh-143946: Add more debug info in `optimize_uops` (GH-144262)

2 months agogh-144264: Speed up Base64 decoding of data containing ignored characters (GH-144265)
Serhiy Storchaka [Thu, 29 Jan 2026 15:33:10 +0000 (17:33 +0200)] 
gh-144264: Speed up Base64 decoding of data containing ignored characters (GH-144265)

Try the fast path again after decoding a quad the slow path.
Use a bitmap cache for the ignorechars argument.

2 months agogh-144322: typo This errors to These errors (#144323)
cui [Thu, 29 Jan 2026 13:26:38 +0000 (21:26 +0800)] 
gh-144322: typo This errors to These errors (#144323)

2 months agogh-144206: Improve error messages for buffer overflow in fcntl.fcntl() and fcntl...
Serhiy Storchaka [Thu, 29 Jan 2026 13:04:37 +0000 (15:04 +0200)] 
gh-144206: Improve error messages for buffer overflow in fcntl.fcntl() and fcntl.ioctl() (GH-144273)

2 months agogh-144309: Build Python with POSIX 2024 (#144310)
Victor Stinner [Thu, 29 Jan 2026 12:50:07 +0000 (13:50 +0100)] 
gh-144309: Build Python with POSIX 2024 (#144310)

On FreeBSD, the ppoll() function is only visible if the POSIX version
is 2024 or newer.

2 months agogh-144319: Add huge pages support for pymalloc (#144320)
Pablo Galindo Salgado [Thu, 29 Jan 2026 12:26:11 +0000 (12:26 +0000)] 
gh-144319: Add huge pages support for pymalloc (#144320)

2 months agogh-142387: Reduce Android testbed API level to 33 (#144315)
Malcolm Smith [Wed, 28 Jan 2026 23:48:26 +0000 (23:48 +0000)] 
gh-142387: Reduce Android testbed API level to 33 (#144315)

The emulator images for API level 34 and 35 have significant issues with image size and
internet connectivity. Reverts the default API level used for testbed testing to 33.

2 months agogh-83069: Use efficient event-driven `subprocess.Popen.wait()` on Linux / macOS ...
Giampaolo Rodola [Wed, 28 Jan 2026 14:04:40 +0000 (15:04 +0100)] 
gh-83069: Use efficient event-driven `subprocess.Popen.wait()` on Linux / macOS / BSD (#144047)

2 months agogh-144194: Fix mmap failure check in perf_jit_trampoline.c (#143713)
stratakis [Wed, 28 Jan 2026 13:30:17 +0000 (14:30 +0100)] 
gh-144194: Fix mmap failure check in perf_jit_trampoline.c (#143713)

mmap() returns MAP_FAILED ((void*)-1) on error, not NULL. The current
check never detects mmap failures, so jitdump initialization proceeds
even when the memory mapping fails.

2 months agogh-140232: Do not track frozenset objects with immutables (#140234)
Pieter Eendebak [Wed, 28 Jan 2026 10:27:37 +0000 (11:27 +0100)] 
gh-140232: Do not track frozenset objects with immutables (#140234)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2 months agogh-144249: Report filename in SSLContext.load_cert_chain errors (#144250)
Romuald Brunet [Wed, 28 Jan 2026 10:20:51 +0000 (11:20 +0100)] 
gh-144249: Report filename in SSLContext.load_cert_chain errors (#144250)

When user tries to load a certificate chain, attach the related
filename to the exception being raised. Improving user experience.

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2 months agogh-144289: Remove ENABLE_SPECIALIZATION_FT (gh-144290)
Sam Gross [Tue, 27 Jan 2026 22:52:50 +0000 (17:52 -0500)] 
gh-144289: Remove ENABLE_SPECIALIZATION_FT (gh-144290)

Now that the specializing interpreter works with free threading,
replace ENABLE_SPECIALIZATION_FT with ENABLE_SPECIALIZATION and
replace requires_specialization_ft with requires_specialization.

Also limit the uniquely referenced check to FOR_ITER_RANGE. It's not
necessary for FOR_ITER_GEN and would cause test_for_iter_gen to fail.

2 months agogh-120321: Add missing "return false" in gen_try_set_executing (gh-144291)
Sam Gross [Tue, 27 Jan 2026 21:38:50 +0000 (16:38 -0500)] 
gh-120321: Add missing "return false" in gen_try_set_executing (gh-144291)

We didn't catch this because of a combination of:

1) falling through to the if-statement below works
2) we only specialized FOR_ITER_GEN for uniquely referenced generators,
   so we didn't trigger the non-thread-safe behavior.

2 months agoGH-126910: add test for manual frame unwinding (#144137)
Diego Russo [Tue, 27 Jan 2026 13:17:40 +0000 (13:17 +0000)] 
GH-126910: add test for manual frame unwinding (#144137)

2 months agoAvoid TestNullDlsym hanging on HP-PA (#141011)
Stefano Rivera [Tue, 27 Jan 2026 11:39:03 +0000 (03:39 -0800)] 
Avoid TestNullDlsym hanging on HP-PA (#141011)

glibc has no support for IFUNC on HP PA RISC yet. Rather than waiting
for an "OK" that we'll never get, skip the test.

See: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/hppa/dl-irel.h;h=770dcb3ea3a6ce232bb11bf59315cfec4c543f93;hb=HEAD

2 months agogh-143883: Use named parameters in PyModExport-related declarations & docs (GH-143884)
Nathan Goldbaum [Tue, 27 Jan 2026 10:28:28 +0000 (03:28 -0700)] 
gh-143883: Use named parameters in PyModExport-related declarations & docs (GH-143884)

2 months agogh-126014: test_makefile_test_folders: Ignore basically-empty directories (#140466)
Stefano Rivera [Tue, 27 Jan 2026 10:05:09 +0000 (02:05 -0800)] 
gh-126014: test_makefile_test_folders: Ignore basically-empty directories (#140466)

The code in test_makefile was attempting to ignore any
non-interesting files, but missed some corners:

1. There is never a *file* called `__pycache__`.
2. A directory containing only a `__pycache__` subdirectory should be
   ignored.
3. A directory containing only hidden files should be ignored.

Simplify this all into a couple of filters that let us check for empty
lists.

2 months agogh-142119: Clarify that one `contextvars.Token` can only reset once in a lifetime...
Bartosz Sławecki [Tue, 27 Jan 2026 09:49:05 +0000 (10:49 +0100)] 
gh-142119: Clarify that one `contextvars.Token` can only reset once in a lifetime (GH-143693)

2 months agogh-144257: document return values of PyModule_SetDocString (GH-144258)
Nathan Goldbaum [Tue, 27 Jan 2026 07:15:16 +0000 (00:15 -0700)] 
gh-144257: document return values of PyModule_SetDocString (GH-144258)

Co-authored-by: sobolevn <mail@sobolevn.me>
2 months agogh-142037: Fix a refleak introduced in GH-142081 (GH-144256)
Serhiy Storchaka [Mon, 26 Jan 2026 21:15:21 +0000 (23:15 +0200)] 
gh-142037: Fix a refleak introduced in GH-142081 (GH-144256)

2 months agogh-144001: Support ignorechars in binascii.a2b_base64() and base64.b64decode() (GH...
Serhiy Storchaka [Mon, 26 Jan 2026 18:11:40 +0000 (20:11 +0200)] 
gh-144001: Support ignorechars in binascii.a2b_base64() and base64.b64decode() (GH-144024)

2 months agogh-142966: Make ctypes.POINTER.set_type also reset format (GH-142967)
Jeong, YunWon [Mon, 26 Jan 2026 16:40:56 +0000 (01:40 +0900)] 
gh-142966: Make ctypes.POINTER.set_type also reset format (GH-142967)

Make the deprecated set_type method resets the format, using the
same code as in type initialization.

Implementation note: this was done in PyCPointerType_init
after calling PyCPointerType_SetProto, but was forgotten
after in PyCPointerType_set_type_impl's call to
PyCPointerType_SetProto.
With this change, setting the format is conceptually part of
setting proto (i.e. the pointed-to type).

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2 months agogh-101888: Add function.__builtins__ to ref documentation (#144174)
Victor Stinner [Mon, 26 Jan 2026 16:15:47 +0000 (17:15 +0100)] 
gh-101888: Add function.__builtins__ to ref documentation (#144174)

2 months agogh-142119: Clarify context manager protocol documentation on `ContextVar.set` and...
Bartosz Sławecki [Mon, 26 Jan 2026 15:50:27 +0000 (16:50 +0100)] 
gh-142119: Clarify context manager protocol documentation on `ContextVar.set` and `Token` (GH-143694)

2 months agogh-140557: Force alignment of empty `bytearray` and `array.array` buffers (GH-140559)
Jake Lishman [Mon, 26 Jan 2026 15:45:17 +0000 (15:45 +0000)] 
gh-140557: Force alignment of empty `bytearray` and `array.array` buffers (GH-140559)

This ensures the buffers used by the empty `bytearray` and `array.array`
are aligned the same as a pointer returned by the allocator.  This is a
more convenient default for interop with other languages that have
stricter requirements of type-safe buffers (e.g. Rust's `&[T]` type)
even when empty.

2 months agogh-144212: Add `image/jxl` to `mimetypes` (GH-144213)
FooIbar [Mon, 26 Jan 2026 14:26:55 +0000 (22:26 +0800)] 
gh-144212: Add `image/jxl` to `mimetypes` (GH-144213)

2 months agogh-143928: Remove outdated comparison between pickle and marshal regarding recursion...
Yashraj [Mon, 26 Jan 2026 13:38:23 +0000 (19:08 +0530)] 
gh-143928: Remove outdated comparison between pickle and marshal regarding recursion (#144025)

2 months agogh-144100: Fix crash for POINTER(str) used in ctypes argtypes (#144108)
VanshAgarwal24036 [Mon, 26 Jan 2026 12:27:42 +0000 (17:57 +0530)] 
gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (#144108)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 months agogh-144128: Fix crash in array.fromlist with reentrant __index__ (#144138)
Priyanshu Singh [Mon, 26 Jan 2026 12:13:49 +0000 (17:43 +0530)] 
gh-144128: Fix crash in array.fromlist with reentrant __index__ (#144138)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2 months agogh-144233: Fix typo in os.eventfd documentation (#144234)
Solomon Ritzow [Mon, 26 Jan 2026 08:07:56 +0000 (00:07 -0800)] 
gh-144233: Fix typo in os.eventfd documentation (#144234)

2 months agogh-144169: Fix three crashes in AST objects with non-str kwargs (#144178)
Jelle Zijlstra [Mon, 26 Jan 2026 01:28:58 +0000 (17:28 -0800)] 
gh-144169: Fix three crashes in AST objects with non-str kwargs (#144178)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 months agogh-144217: Add dicom support (medical imaging) to mimetypes (GH-144218)
benediktjohannes [Sun, 25 Jan 2026 22:22:43 +0000 (23:22 +0100)] 
gh-144217: Add dicom support (medical imaging) to mimetypes (GH-144218)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2 months agogh-143995: Eliminate redundant refcounting in the JIT from LOAD_ATTR_MODULE (GH-143996)
AN Long [Sun, 25 Jan 2026 18:24:44 +0000 (03:24 +0900)] 
gh-143995: Eliminate redundant refcounting in the JIT from LOAD_ATTR_MODULE (GH-143996)

2 months agogh-143504: Expose CELL status of a symbol in symtable (#143549)
Yashraj [Sun, 25 Jan 2026 15:21:27 +0000 (20:51 +0530)] 
gh-143504: Expose CELL status of a symbol in symtable (#143549)

2 months agogh-144140: Optimize len for string constants in optimizer (GH-144142)
Yi Yang [Sat, 24 Jan 2026 16:09:29 +0000 (00:09 +0800)] 
gh-144140: Optimize len for string constants in optimizer (GH-144142)

2 months agoRemove stray typedef in _tkinter.c (GH-142924)
mdehoon [Sat, 24 Jan 2026 15:20:14 +0000 (00:20 +0900)] 
Remove stray typedef in _tkinter.c (GH-142924)

Co-authored-by: Michiel de Hoon <mdehoon@tkx288.genome.gsc.riken.jp>
2 months agogh-142037: Improve error messages for printf-style formatting (GH-142081)
Serhiy Storchaka [Sat, 24 Jan 2026 11:13:50 +0000 (13:13 +0200)] 
gh-142037: Improve error messages for printf-style formatting (GH-142081)

This affects string formatting as well as bytes and bytearray formatting.

* For errors in the format string, always include the position of the
  start of the format unit.
* For errors related to the formatted arguments, always include the number
  or the name of the formatted argument.
* Suggest more probable causes of errors in the format string (stray %,
  unsupported format, unexpected character).
* Provide more information when the number of arguments does not match
  the number of format units.
* Raise more specific errors when access of arguments by name is mixed with
  sequential access and when * is used with a mapping.
* Add tests for some uncovered cases.

2 months agogh-142913: Add generated test files to gitattributes (GH-144209)
Marc Mueller [Sat, 24 Jan 2026 10:19:21 +0000 (11:19 +0100)] 
gh-142913: Add generated test files to gitattributes (GH-144209)

2 months agogh-130415: Narrow types to constants in branches involving specialized comparisons...
reiden [Sat, 24 Jan 2026 10:02:08 +0000 (18:02 +0800)] 
gh-130415: Narrow types to constants in branches involving specialized comparisons with a constant (GH-144150)

2 months agogh-144068: fix JIT tracer memory leak when daemon thread exits (GH-144077)
Hai Zhu [Sat, 24 Jan 2026 09:43:01 +0000 (17:43 +0800)] 
gh-144068: fix JIT tracer memory leak when daemon thread exits (GH-144077)

2 months agoMisc: remove duplicate `instr_frame` assignment in `_PyJit_TryInitializeTracing`...
Yongtao Huang [Sat, 24 Jan 2026 09:37:45 +0000 (17:37 +0800)] 
Misc: remove duplicate `instr_frame` assignment in `_PyJit_TryInitializeTracing` (GH-144155)

Remove duplicate instr_frame assignment in optimizer

2 months agogh-144016: Fix bad stack assert in the JIT optimizer (GH-144019)
Ken Jin [Sat, 24 Jan 2026 09:36:40 +0000 (17:36 +0800)] 
gh-144016: Fix bad stack assert in the JIT optimizer (GH-144019)

2 months agogh-144007: Eliminate redundant refcounting in the JIT for BINARY_OP (GH-144011)
AN Long [Sat, 24 Jan 2026 09:35:32 +0000 (18:35 +0900)] 
gh-144007: Eliminate redundant refcounting in the JIT for BINARY_OP (GH-144011)

2 months agogh-135142: Initial 3.15 IDLE News3.txt entries (#144200)
Terry Jan Reedy [Sat, 24 Jan 2026 02:34:41 +0000 (21:34 -0500)] 
gh-135142: Initial 3.15 IDLE News3.txt entries (#144200)

2 months agogh-74902: Avoid hitting unicode.org for test data (GH-144195)
Zachary Ware [Fri, 23 Jan 2026 21:07:27 +0000 (15:07 -0600)] 
gh-74902: Avoid hitting unicode.org for test data (GH-144195)

Use our own pythontest.net instead.

2 months agogh-144027: Fix documentation for ignorechars in base64.a85decode() (GH-144028)
Serhiy Storchaka [Fri, 23 Jan 2026 18:55:48 +0000 (20:55 +0200)] 
gh-144027: Fix documentation for ignorechars in base64.a85decode() (GH-144028)

It does not support an ASCII string.

Also add more tests.

2 months agogh-144005: Eliminate redundant refcounting in the JIT for BINARY_OP_EXTEND (#144006)
AN Long [Fri, 23 Jan 2026 17:19:01 +0000 (02:19 +0900)] 
gh-144005: Eliminate redundant refcounting in the JIT for BINARY_OP_EXTEND (#144006)

2 months agogh-141376: smelly.py: Print only smelly symbols, or all of them with --verbose (GH...
Petr Viktorin [Fri, 23 Jan 2026 16:51:29 +0000 (17:51 +0100)] 
gh-141376: smelly.py: Print only smelly symbols, or all of them with --verbose (GH-141394)

Instead of long and uninteresting output for all checked libraries, only print found issues by default.

Add a new -v/--verbose option to list all symbols (useful for checking that the script finds the symbols).

2 months agoProgramming FAQ: fix some punctuaction typos (GH-144058)
Bartosz Sławecki [Fri, 23 Jan 2026 16:34:21 +0000 (17:34 +0100)] 
Programming FAQ: fix some punctuaction typos (GH-144058)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2 months agogh-144125: email: verify headers are sound in BytesGenerator
Seth Michael Larson [Fri, 23 Jan 2026 14:59:35 +0000 (08:59 -0600)] 
gh-144125: email: verify headers are sound in BytesGenerator

Co-authored-by: Denis Ledoux <dle@odoo.com>
Co-authored-by: Denis Ledoux <5822488+beledouxdenis@users.noreply.github.com>
Co-authored-by: Petr Viktorin <302922+encukou@users.noreply.github.com>
Co-authored-by: Bas Bloemsaat <1586868+basbloemsaat@users.noreply.github.com>
2 months agoDoc: fix incorrect reference in `isasyncgenfunction` docs (GH-144099)
Yongtao Huang [Fri, 23 Jan 2026 08:06:47 +0000 (16:06 +0800)] 
Doc: fix incorrect reference in `isasyncgenfunction` docs (GH-144099)

Fix incorrect reference in isasyncgenfunction docs

2 months agogh-143513: Remove importlib.abc documentation for removed ABCs (#143605)
Alex Willmer [Thu, 22 Jan 2026 22:00:37 +0000 (22:00 +0000)] 
gh-143513: Remove importlib.abc documentation for removed ABCs (#143605)

In 3.11 ResourceReader, Traversable, & TraversableResources moved from importlib.abc to importlib.resources.abc (commit e712a5b277866a71c195f38c1b5d87d9126dba3e).

In 3.12 old import locations were deprecated (commit 71848c960927af801656026203371c41ad139b5a).

In 3.14 backwards-compat support was removed (commit 0751511d24295c39fdf2f5b2255e3fa3d796ce4d).

Co-authored-by: Brett Cannon <brett@python.org>
2 months agoAdd source links to documentation for Windows-specific modules (GH-130244)
Dimma Don't [Thu, 22 Jan 2026 21:30:13 +0000 (16:30 -0500)] 
Add source links to documentation for Windows-specific modules (GH-130244)

2 months agogh-143756: Avoid borrowed reference in SSL code (gh-143816)
Sam Gross [Thu, 22 Jan 2026 19:02:48 +0000 (14:02 -0500)] 
gh-143756: Avoid borrowed reference in SSL code (gh-143816)

GET_SOCKET() returned a borrowed reference, which was potentially
unsafe. Also, refactor out some common code.

2 months agogh-143756: Fix potential data race in SSLContext.load_cert_chain (gh-143818)
Sam Gross [Thu, 22 Jan 2026 19:02:30 +0000 (14:02 -0500)] 
gh-143756: Fix potential data race in SSLContext.load_cert_chain (gh-143818)

Concurrent calls to `load_cert_chain` caused data races in OpenSSL code.

2 months agogh-144157: Optimize bytes.translate() by deferring change detection (GH-144158)
Gregory P. Smith [Thu, 22 Jan 2026 17:21:07 +0000 (09:21 -0800)] 
gh-144157: Optimize bytes.translate() by deferring change detection (GH-144158)

Optimize bytes.translate() by deferring change detection

Move the equality check out of the hot loop to allow better compiler
optimization. Instead of checking each byte during translation, perform
a single memcmp at the end to determine if the input can be returned
unchanged.

This allows compilers to unroll and pipeline the loops, resulting in ~2x
throughput improvement for medium-to-large inputs (tested on an AMD zen2).
No change observed on small inputs.

It will also be faster for bytes subclasses as those do not need change
detection.

2 months agogh-142779: Initialize reserved field for proper padding (#142780)
stratakis [Thu, 22 Jan 2026 17:06:36 +0000 (18:06 +0100)] 
gh-142779: Initialize reserved field for proper padding (#142780)

The jitdump specification specifies a reserved field for padding.

Initialize it so no garbage data is embedded in the jitdump files.

2 months agogh-67041: Allow to distinguish between empty and not defined URI components (GH-123305)
Serhiy Storchaka [Thu, 22 Jan 2026 12:29:13 +0000 (14:29 +0200)] 
gh-67041: Allow to distinguish between empty and not defined URI components (GH-123305)

Changes in the urllib.parse module:

* Add option missing_as_none in urlparse(), urlsplit() and urldefrag(). If
  it is true, represent not defined components as None instead of an
  empty string.
* Add option keep_empty in urlunparse() and urlunsplit(). If it is
  true, keep empty non-None components in the resulting string.

2 months agogh-143001: Add @cpython_only to test_sys.test_current_frames() (#144004)
Jeong, YunWon [Thu, 22 Jan 2026 11:08:08 +0000 (20:08 +0900)] 
gh-143001: Add @cpython_only to test_sys.test_current_frames() (#144004)

2 months agoGH-139109: Partial reworking of JIT data structures (GH-144105)
Mark Shannon [Thu, 22 Jan 2026 10:55:49 +0000 (10:55 +0000)] 
GH-139109: Partial reworking of JIT data structures (GH-144105)

* Halve size of buffers by reusing combined trace + optimizer buffers for TOS caching
* Add simple buffer struct for more maintainable handling of buffers
* Decouple JIT structs from thread state struct
* Ensure terminator is added to trace, when optimizer gives up

2 months agogh-141004: Mark up constants for `PyOS_double_to_string` (GH-143867)
Petr Viktorin [Thu, 22 Jan 2026 10:53:17 +0000 (11:53 +0100)] 
gh-141004: Mark up constants for `PyOS_double_to_string` (GH-143867)

This ensures they show up as C macros in search and the Sphinx inventory.

2 months agogh-143959: Make _datetime optional for test_sys (GH-144003)
Jeong, YunWon [Thu, 22 Jan 2026 10:52:16 +0000 (19:52 +0900)] 
gh-143959: Make _datetime optional for test_sys (GH-144003)

2 months agogh-143993: Document ways to disable remote debugging support (#143994)
Rafael Weingartner-Ortner [Thu, 22 Jan 2026 10:41:20 +0000 (11:41 +0100)] 
gh-143993: Document ways to disable remote debugging support (#143994)

Although PEP 768 mentions how to disable the mechanism of
remote debugging, it is not documented in the Python docs.

This change adds a note on how to disable remote debugging support
in a Python interpreter to the remote debugging how-to.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 months agogh-142913: Revert adding test_replaced_interpreter (GH-144110)
Petr Viktorin [Thu, 22 Jan 2026 09:40:34 +0000 (10:40 +0100)] 
gh-142913: Revert adding test_replaced_interpreter (GH-144110)

This partially reverts commit 4d5a676aa0811563ea78ae58ef89cdc0295bf7ed
(GH-142911)

The removed test fails when re-run in --huntrleaks mode.

2 months agogh-130415: Narrowing to constants in branches involving `is` comparisons with a const...
reiden [Thu, 22 Jan 2026 09:37:45 +0000 (17:37 +0800)] 
gh-130415: Narrowing to constants in branches involving `is` comparisons with a constant (GH-143895)

2 months agoGH-143941: Move WASI-related files to Platforms/WASI (GH-143942)
Brett Cannon [Wed, 21 Jan 2026 22:31:58 +0000 (14:31 -0800)] 
GH-143941: Move WASI-related files to Platforms/WASI (GH-143942)

Along the way, leave a deprecated Tools/wasm/wasi/__main__.py behind for backwards-compatibility.

Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2 months agogh-77188: Add pickle tests for objects with slots (GH-144116)
Serhiy Storchaka [Wed, 21 Jan 2026 17:21:02 +0000 (19:21 +0200)] 
gh-77188: Add pickle tests for objects with slots (GH-144116)

2 months agoGH-138245: Perform boolean guards by testing a single bit, rather than a full pointer...
Mark Shannon [Wed, 21 Jan 2026 15:58:27 +0000 (15:58 +0000)] 
GH-138245: Perform boolean guards by testing a single bit, rather than a full pointer comparison. (GH-143810)

2 months agoUpdate install manager docs (python/pymanager#227) (GH-144079)
Steve Dower [Wed, 21 Jan 2026 15:33:05 +0000 (15:33 +0000)] 
Update install manager docs (python/pymanager#227) (GH-144079)

2 months agogh-144030: Add check that argument is callable to Python version of functools.lru_cac...
CF Bolz-Tereick [Wed, 21 Jan 2026 14:19:19 +0000 (15:19 +0100)] 
gh-144030: Add check that argument is callable to Python version of functools.lru_cache (#144031)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: AN Long <aisk@users.noreply.github.com>
2 months agogh-143869: Add PEP 757 functions to the limited API (#143906)
Sergey B Kirpichev [Wed, 21 Jan 2026 13:47:14 +0000 (16:47 +0300)] 
gh-143869: Add PEP 757 functions to the limited API (#143906)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 months agogh-144085: Add `{gi,cr}_suspended` to `inspect` comments and `generator/coroutine...
Yongtao Huang [Wed, 21 Jan 2026 10:33:56 +0000 (18:33 +0800)] 
gh-144085: Add `{gi,cr}_suspended` to `inspect` comments and `generator/coroutine` tests (#144086)

2 months agogh-125346: Deprecate accepting standard Base64 alphabet when alternative alphabet...
Serhiy Storchaka [Wed, 21 Jan 2026 07:41:58 +0000 (09:41 +0200)] 
gh-125346: Deprecate accepting standard Base64 alphabet when alternative alphabet is used (GH-141128)

Emit a warning in base64.urlsafe_b64decode() and base64.b64decode() when
the "+" or "/" characters occur in the Base64 data with alternative
alphabet if they are not the part of the alternative alphabet.

It is a DeprecationWarning in the strict mode (will be error) and
a FutureWarning in non-strict mode (will be ignored).

2 months agoGH-143948: Explain graphlib's cycle-finding code (#143950)
Tim Peters [Wed, 21 Jan 2026 01:28:48 +0000 (19:28 -0600)] 
GH-143948: Explain graphlib's cycle-finding code (#143950)

Explain topsort's cycle-finding algorithm, and why it's written that way.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2 months agogh-143919: Reject control characters in http cookies
Seth Michael Larson [Tue, 20 Jan 2026 21:23:42 +0000 (15:23 -0600)] 
gh-143919: Reject control characters in http cookies

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2 months agogh-143923: Reject control characters in POP3 commands
Seth Michael Larson [Tue, 20 Jan 2026 20:46:32 +0000 (14:46 -0600)] 
gh-143923: Reject control characters in POP3 commands

2 months agogh-143925: Reject control characters in data: URL mediatypes
Seth Michael Larson [Tue, 20 Jan 2026 20:45:58 +0000 (14:45 -0600)] 
gh-143925: Reject control characters in data: URL mediatypes

2 months agogh-143921: Reject control characters in IMAP commands
Seth Michael Larson [Tue, 20 Jan 2026 20:45:42 +0000 (14:45 -0600)] 
gh-143921: Reject control characters in IMAP commands

2 months agogh-141504: Move PYTHON_UOPS_OPTIMIZE to policy object (GH-144082)
Donghee Na [Tue, 20 Jan 2026 18:47:38 +0000 (03:47 +0900)] 
gh-141504: Move PYTHON_UOPS_OPTIMIZE to policy object (GH-144082)

2 months agogh-144054: no deferred refcount for untracked (gh-144081)
Neil Schemenauer [Tue, 20 Jan 2026 18:01:09 +0000 (10:01 -0800)] 
gh-144054: no deferred refcount for untracked (gh-144081)

This reverts gh-144055 and fixes the bug in a different way.  Deferred
reference counting relies on the object being tracked by the GC,
otherwise the object will live until interpreter shutdown.  So, take
care that we do not enable deferred reference counting for objects that
are untracked.  Also, if a tuple has deferred reference counting
enabled, don't untrack it.

2 months agogh-143939: Fix assignment to `_PyThreadStateImpl.generator_return_kind` (gh-143951)
Sam Gross [Tue, 20 Jan 2026 17:51:55 +0000 (12:51 -0500)] 
gh-143939: Fix assignment to `_PyThreadStateImpl.generator_return_kind` (gh-143951)

The assignment to generator_return_kind has to be after any potentially
escaping calls to ensure that it's not overwritten.

2 months agogh-143960: Add support for OpenSSL 3.6, drop EOL 3.2 (#143961)
Hugo van Kemenade [Tue, 20 Jan 2026 15:25:31 +0000 (17:25 +0200)] 
gh-143960: Add support for OpenSSL 3.6, drop EOL 3.2 (#143961)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2 months agogh-144054: shutdown fix for deferred ref counting (GH-144055)
Neil Schemenauer [Tue, 20 Jan 2026 13:45:12 +0000 (05:45 -0800)] 
gh-144054: shutdown fix for deferred ref counting (GH-144055)

When shutting down, disable deferred refcounting for all GC objects. It
is important to do this also for untracked objects, which before this
change were getting missed.

Small code cleanup:
We can remove the shutdown case disable_deferred_refcounting() call
inside scan_heap_visitor() if we are careful about it.  The key is
that frame_disable_deferred_refcounting() might fail if the object
is untracked.

2 months agoUpdate struct.__doc__: _Bool available unconditionally (#143716)
Sergey B Kirpichev [Tue, 20 Jan 2026 12:09:20 +0000 (15:09 +0300)] 
Update struct.__doc__: _Bool available unconditionally (#143716)

This amends commit a9296e7f3be4d6c22271b25c86467ff867c63bbb.

2 months agogh-144050: Fix stat.filemode pure Python file type detection (GH-144059)
VanshAgarwal24036 [Tue, 20 Jan 2026 12:05:42 +0000 (17:35 +0530)] 
gh-144050: Fix stat.filemode pure Python file type detection (GH-144059)

2 months agogh-143999: Fix: handle suspended state on types.coroutine wrappers (GH-144000)
Yongtao Huang [Tue, 20 Jan 2026 10:20:06 +0000 (18:20 +0800)] 
gh-143999: Fix: handle suspended state on types.coroutine wrappers (GH-144000)

2 months agogh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022)
AZero13 [Tue, 20 Jan 2026 09:50:51 +0000 (04:50 -0500)] 
gh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022)

The check was (fd > 0), should be (fd >= 0).

2 months agogh-143774 - Improve IDLE Format Paragraph doc (#143775)
Terry Jan Reedy [Tue, 20 Jan 2026 09:07:29 +0000 (04:07 -0500)] 
gh-143774 - Improve IDLE Format Paragraph doc (#143775)

Add a reminder to not rewrap code line to the Menu => Format => Reformat Paragraph entry.
In Editing and Nagivagion, add a new 'Format block' subsection that defines 'paragraph'
to better match what is dependably handled as more or less expected.
In particular, specify equal indents and that the resulting indent equals original indent.
Also mention that selections are expanded to complete lines and how to modify max length.

(Also fix a couple case errors in cross references.)

2 months agogh-143754: Add Tkinter methods pack_content(), place_content() and grid_content(...
Serhiy Storchaka [Tue, 20 Jan 2026 07:16:36 +0000 (09:16 +0200)] 
gh-143754: Add Tkinter methods pack_content(), place_content() and grid_content() (GH-143845)

They use Tk commands with new name like "pack content instead of old
"pack slaves".

2 months agoFix typo: 'exept' -> 'except' in Lib/dbm/dumb.py (GH-144060)
Bodhi Silberling [Tue, 20 Jan 2026 06:50:34 +0000 (22:50 -0800)] 
Fix typo: 'exept' -> 'except' in Lib/dbm/dumb.py (GH-144060)