Commit graph

32145 commits

Author SHA1 Message Date
Pieter Eendebak
009c8c052f
gh-123471: Make concurrent iteration over itertools.permutations and itertools.combinations_with_replacement thread-safe (gh-144402) 2026-02-04 13:38:45 -05:00
Serhiy Storchaka
dd0fde58cc
gh-143962: Improve name suggestions for not normalized names (GH-144154)
Suggest the normalized name or the closest name to the normalized name.
If the suggested name is not ASCII, include also its ASCII representation.
2026-02-04 17:23:09 +00:00
Victor Stinner
2aea861fe0
gh-140824: Fix _Py_DumpExtensionModules() to ignore sub-modules (#144339)
Ignore "math.integer" extension if "math" is in
sys.stdlib_module_names.
2026-02-04 16:06:35 +01:00
Serhiy Storchaka
f73d2e7003
gh-144386: Add support for descriptors in ExitStack and AsyncExitStack (#144420)
__enter__(), __exit__(), __aenter__(), and __aexit__() can now be
arbitrary descriptors, not only normal methods, for consistency with the
"with" and "async with" statements.
2026-02-04 13:20:18 +02:00
Sam Gross
7e2c9bdc98
gh-120321: Add gi_state, cr_state, and ag_state attributes (gh-144409)
Add `gi_state`, `cr_state`, and `ag_state` attributes to generators,
coroutines, and async generators respectively. These attributes return the
current state as a string (e.g., `GEN_RUNNING`, `CORO_SUSPENDED`).

The `inspect.getgeneratorstate()`, `inspect.getcoroutinestate()`, and
`inspect.getasyncgenstate()` functions now return these attributes directly.

This is in preparation for making `gi_frame` thread-safe, which may involve
stop-the-world synchronization. The new state attributes avoid potential
performance cliffs in `inspect.getgeneratorstate()` and similar functions by
not requiring frame access.

Also removes unused `FRAME_COMPLETED` state and renumbers the frame state enum
to start at 0 instead of -1.
2026-02-03 13:06:32 -05:00
Taneli Hukkinen
bb917d83b1
gh-142956: Update tomllib to parse TOML 1.1.0 (#144243)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-03 13:41:57 +01:00
AN Long
3abc03c808
gh-132888: Fix Windows API error checking in pyrepl.windows_console (#144248) 2026-02-03 13:25:29 +01:00
Malcolm Smith
cb1dc91dcb
gh-144415: Android testbed fixes (#142912)
Modifies handling of `.gz` files in Android app payloads, and ensures that
when the Android testbed streams logs, stream flushes aren't treated as
newlines. This improves the output of test suites that use "one dot per test"
progress indicators.
2026-02-03 16:37:34 +08:00
AN Long
39f16a93ef
gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713) 2026-02-02 15:44:08 +01:00
Hai Zhu
ebbb2ca81f
gh-144145: Revert PR#144122 for performance and potential bugs. (GH-144391)
Revert "gh-144145: Track nullness of properties in the Tier 2 JIT optimizer (GH-144122)"

This reverts commit 1dc12b2883.
2026-02-02 14:09:54 +00:00
Sergey B Kirpichev
15c9f2491d
gh-115231: Fill __module__ for built-in staticmethods (#115232)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-02-02 12:34:02 +01:00
Ruiyang Ke
40d07cad38
gh-144380: Fix incorrect type check in buffered_iternext() (#144381) 2026-02-02 15:34:18 +05:30
Serhiy Storchaka
18347417b0
gh-143904: Raise OverflowError instead of IndexError for too large offset in struct.pack_into() (GH-143905) 2026-02-01 15:25:59 +02:00
adam j hartz
ccbe41e27c
gh-143055: Implementation of PEP 798 (#143056)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-01-30 20:37:52 -08:00
Sam Gross
a01694dacd
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.
2026-01-30 12:20:27 -05:00
reiden
a7048327ed
gh-144280: Add missing predicate symbol to case-switch (GH-144298) 2026-01-30 16:43:27 +00:00
Hai Zhu
1dc12b2883
gh-144145: Track nullness of properties in the Tier 2 JIT optimizer (GH-144122) 2026-01-30 15:25:19 +00:00
Divyanshu Choudhury
5f57f6970b
gh-143423: Fix free-threaded build detection in sampling profiler (#143426) 2026-01-30 00:35:30 +00:00
Pieter Eendebak
1b08143466
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.
2026-01-29 16:32:09 -05:00
Yongtao Huang
219b7ac9d5
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>
2026-01-29 13:50:54 -05:00
Serhiy Storchaka
92c0ec2b00
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.
2026-01-29 17:33:10 +02:00
Serhiy Storchaka
a7cec565c1
gh-144206: Improve error messages for buffer overflow in fcntl.fcntl() and fcntl.ioctl() (GH-144273) 2026-01-29 15:04:37 +02:00
Victor Stinner
927eb448aa
gh-144309: Build Python with POSIX 2024 (#144310)
On FreeBSD, the ppoll() function is only visible if the POSIX version
is 2024 or newer.
2026-01-29 13:50:07 +01:00
Pablo Galindo Salgado
b1bc868fba
gh-144319: Add huge pages support for pymalloc (#144320) 2026-01-29 12:26:11 +00:00
Giampaolo Rodola
9b154aba7d
gh-83069: Use efficient event-driven subprocess.Popen.wait() on Linux / macOS / BSD (#144047) 2026-01-28 15:04:40 +01:00
stratakis
8fe8a94a7c
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.
2026-01-28 13:30:17 +00:00
Pieter Eendebak
08d7bd28fe
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>
2026-01-28 11:27:37 +01:00
Romuald Brunet
1a637b29aa
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>
2026-01-28 11:20:51 +01:00
Serhiy Storchaka
7febbe6b60
gh-144001: Support ignorechars in binascii.a2b_base64() and base64.b64decode() (GH-144024) 2026-01-26 20:11:40 +02:00
Jeong, YunWon
9181d776da
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>
2026-01-26 17:40:56 +01:00
Jake Lishman
19de10d3d8
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.
2026-01-26 16:45:17 +01:00
FooIbar
1f55caf97e
gh-144212: Add image/jxl to mimetypes (GH-144213) 2026-01-26 15:26:55 +01:00
VanshAgarwal24036
8f459255eb
gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (#144108)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-26 13:27:42 +01:00
Priyanshu Singh
decb25e8f0
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>
2026-01-26 13:13:49 +01:00
Jelle Zijlstra
639c1ad4f1
gh-144169: Fix three crashes in AST objects with non-str kwargs (#144178)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-25 17:28:58 -08:00
benediktjohannes
76d3ae71ba
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>
2026-01-25 22:22:43 +00:00
Yashraj
a51bf70f95
gh-143504: Expose CELL status of a symbol in symtable (#143549) 2026-01-25 15:21:27 +00:00
Serhiy Storchaka
012c498035
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.
2026-01-24 11:13:50 +00:00
Hai Zhu
29840247ff
gh-144068: fix JIT tracer memory leak when daemon thread exits (GH-144077) 2026-01-24 09:43:01 +00:00
AN Long
4e10fa993a
gh-144007: Eliminate redundant refcounting in the JIT for BINARY_OP (GH-144011) 2026-01-24 09:35:32 +00:00
AN Long
2f42f83344
gh-144005: Eliminate redundant refcounting in the JIT for BINARY_OP_EXTEND (#144006) 2026-01-23 17:19:01 +00:00
Seth Michael Larson
052e55e7d4
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>
2026-01-23 14:59:35 +00:00
Alex Willmer
f8262b84f5
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 e712a5b277).

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

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

Co-authored-by: Brett Cannon <brett@python.org>
2026-01-22 14:00:37 -08:00
Sam Gross
bcf9cb0217
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.
2026-01-22 14:02:30 -05:00
Gregory P. Smith
a966d94e76
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.
2026-01-22 09:21:07 -08:00
Serhiy Storchaka
c5cfcdf16a
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.
2026-01-22 14:29:13 +02:00
Brett Cannon
6181b69970
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>
2026-01-21 14:31:58 -08:00
CF Bolz-Tereick
5db331a561
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>
2026-01-21 15:19:19 +01:00
Sergey B Kirpichev
4c7ec78092
gh-143869: Add PEP 757 functions to the limited API (#143906)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-01-21 14:47:14 +01:00
Serhiy Storchaka
9060b4abbe
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).
2026-01-21 09:41:58 +02:00