Commit graph

15608 commits

Author SHA1 Message Date
zhong
b611db491d
gh-142781: Fix type confusion in zoneinfo weak cache (GH-142925)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-02 13:30:38 +01:00
Petr Viktorin
3b276f3f59
gh-144748: Make PyErr_CheckSignals raise the exception scheduled by PyThreadState_SetAsyncExc (GH-145178)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-03-02 11:47:32 +01:00
Sam Gross
72eca2af59
gh-145230: Update lockbench (gh-145231)
Remove PyThread_type_lock (now uses PyMutex internally).

Add new benchmark options:
- work_inside/work_outside: control work inside and outside the critical section to vary contention levels
- num_locks: use multiple independent locks with threads assigned round-robin
- total_iters: fixed iteration count per thread instead of time-based, useful for measuring fairness
- num_acquisitions: lock acquisitions per loop iteration
- random_locks: acquire random lock each iteration

Also return elapsed time from benchmark_locks() and switch lockbench.py to use argparse.
2026-02-27 14:09:05 -05:00
莯凛
171e0facc4
gh-123853: Cleanup Windows 95 locale fallback support (#144738)
Closes #123853
2026-02-27 11:06:46 +01:00
Serhiy Storchaka
6ea84b2726
Fix unlikely potential reference leak in _locale._getdefaultlocale (GH-145250)
It occurs in a code which perhaps never executed.
2026-02-27 08:02:19 +00:00
A.Ibrahim
06b0920f12
gh-142787: Handle empty sqlite3 blob slices (#142824) 2026-02-26 23:40:25 +00:00
Sergey B Kirpichev
f3a381e54f
gh-141510: support frozendict's in the C decimal module (gh-145165) 2026-02-27 07:02:39 +09:00
Taegyun Kim
c2d3d6b0dd
gh-144316: Fix missing exception in _remote_debugging with debug=False (#144442) 2026-02-26 21:14:34 +00:00
Serhiy Storchaka
812ef66759
gh-145202: Fix crash in unicodedata's GraphemeBreakIterator and Segment (GH-145216)
Remove the tp_clear slots and make Segment members read-only.

Also add tests for reference loops involving GraphemeBreakIterator
and Segment.
2026-02-26 11:30:08 +02:00
Stan Ulbrych
56c4f10d6e
gh-88091: Fix unicodedata.decomposition() for Hangul Syllables (GH-144993) 2026-02-24 19:42:33 +02:00
Donghee Na
0f759f1171
gh-145122: Add _GUARD_NOS_ANY_DICT to prevent STORE_SUBSCR_DICT on frozendict (gh-145039) 2026-02-25 00:48:45 +09:00
Serhiy Storchaka
b32c830d44
gh-101178: Fix possible integer overflow in Ascii85 encoder with wrapcol=1 (GH-144778)
It could happen if the size of the input is more than 4/5 of sys.maxsize
(only feasible on 32-bit platforms).

Also simplify the integer overflow checks in the Base64 encoder, and
harmonize them with the code for Ascii85 and Base85.
2026-02-24 11:40:24 +02:00
Stan Ulbrych
fd0400585e
_struct.c: Fix UB from integer overflow in prepare_s (GH-145158)
Avoid possible undefined behaviour from signed overflow in `struct` module

As discovered via oss-fuzz.
2026-02-23 16:53:17 -08:00
Sam Gross
8db8fc9b51
gh-144777: Fix data races in IncrementalNewlineDecoder (gh-144971) 2026-02-23 09:32:16 -05:00
Chris Eibl
5944a539b9
Fix warnings on main (GH-145104) 2026-02-22 19:02:15 +08:00
Victor Stinner
25fc04d041
gh-141510: Test frozendict in test_capi.test_dict (#145084)
Complete PyDict_Clear() documentation.
2026-02-21 20:07:30 +01:00
Stan Ulbrych
f1f61bf872
gh-66802: Add unicodedata.block() function (#145042)
Closes #66802
2026-02-21 18:27:55 +01:00
Victor Stinner
9e083b57ee
gh-141510: Test frozendict C API (#145081)
Add tests on functions:

* PyAnyDict_Check()
* PyAnyDict_CheckExact()
* PyFrozenDict_Check()
* PyFrozenDict_CheckExact()
* PyFrozenDict_New()
2026-02-21 17:00:23 +01:00
Bénédikt Tran
3a2a686cc4
gh-142516: fix reference leaks in ssl.SSLContext objects (#143685) 2026-02-21 12:31:16 +01:00
Victor Stinner
7b0bd9eb91
gh-141510, PEP 814: Add frozendict support to json (#144903) 2026-02-21 12:22:47 +01:00
Bénédikt Tran
347fc438cf
gh-143698: correctly check scheduler and setpgroup values for os.posix_spawn[p] (#143699)
Fix an issue where passing invalid arguments to `os.posix_spawn[p]` functions
raised a SystemError instead of a TypeError, and allow to explicitly use `None`
for `scheduler` and `setpgroup` as specified in the docs.
2026-02-21 11:20:42 +00:00
Sam Gross
70da972f97
gh-144809: Make deque copy atomic in free-threaded build (gh-144966) 2026-02-20 14:31:58 -05:00
Shamil
50c14719fb
gh-144986: Fix memory leak in atexit.register() (#144987) 2026-02-19 20:42:55 +00:00
Petr Viktorin
f1cf762ee7
gh-84393: Remove AIX workaround: re-enable posix_fadvise and f_allocate (GH-144784)
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2026-02-19 15:11:21 +01:00
Mark Shannon
3f37b94c73
GH-144651: Optimize the new uops added when recording values during tracing. (GH-144948)
* Handle dependencies in the optimizer, not the tracer
* Strengthen some checks to avoid relying on optimizer for correctness
2026-02-19 11:52:57 +00:00
Donghee Na
3e2f5c133f
gh-141510: Update specializer to support frozendict (gh-144949) 2026-02-19 01:10:53 +09:00
Serhiy Storchaka
a18e0fa4c0
gh-135573: Add tests for pickle opcodes with wrong types (GH-144950)
Ensure that APPENDS and ADDITEMS raise error for wrong collection even
with empty items.
2026-02-18 18:02:12 +02:00
Serhiy Storchaka
3f50432e31
gh-140652: Fix a crash in _interpchannels.list_all() after closing a channel (ПР-143743) 2026-02-18 14:54:48 +02:00
Serhiy Storchaka
7ac0868708
gh-135573: Make pickled lists, sets and dicts a tiny bit smaller (GH-144162)
Ensure that APPENDS and SETITEMS are never used for a batch of size 1.
Ensure that ADDITEMS and SETITEMS are never used for a batch of size 0.

This harmonizes the C implementation with the Python implementation
which already guarantees this and makes a pickle a tiny bit smaller
with a tiny chance (about 0.1%).

Saves 1 byte for list and dict with size 1001, 2001, ...
Saves 2 bytes for set and dict with size 1000, 2000, ...
2026-02-18 13:20:31 +02:00
Serhiy Storchaka
767b4d02e2
gh-144882: Optimize name tables in unicodedata by excluding names derived by rule NR2 (GH-144883)
Since the code for rule NR2 is already here, to support CJK unified
ideographs and Tangut ideographs, it can also be used for other names
derived by rule NR2.
2026-02-18 12:58:21 +02:00
Stan Ulbrych
e49bfca87c
gh-142224: unicodedata: support bidi classes for unassigned code points (GH-144815) 2026-02-18 12:54:07 +02:00
Serhiy Storchaka
8b7b5a9946
gh-80667: Fix Tangut ideographs names in unicodedata (GH-144789)
Co-authored-by: Pierre Le Marre <dev@wismill.eu>
2026-02-16 13:31:18 +02:00
Ramin Farajpour Cami
c91638ca06
gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843)
In newPySSLSocket(), when SSL_new() returns NULL, Py_DECREF(self)
was called before _setSSLError(get_state_ctx(self), ...), causing
a use-after-free. Additionally, get_state_ctx() was called with
self (PySSLSocket*) instead of sslctx (PySSLContext*), which is
a type confusion bug.

Fix by calling _setSSLError() before Py_DECREF() and using
sslctx instead of self for get_state_ctx().
2026-02-15 18:43:07 -08:00
Gregory P. Smith
300de1e98a
gh-86519: Add prefixmatch APIs to the re module (GH-31137)
Adds `prefixmatch` APIs to the re module as an alternate name for our long existing `match` APIs to help alleviate a common Python confusion for those coming from other languages regular expression libraries.

These alleviate common confusion around what "match" means as Python is different than other popular languages regex libraries in our use of the term as an API name.  The original `match` names are **NOT being deprecated**.  Source tooling like linters, IDEs, and LLMs could suggest using `prefixmatch` instead of match to improve code health and reduce cognitive burden of understanding the intent of code when configured for a modern minimum Python version.

See the documentation changes for a better description.

Discussions took place in the PR, in the issue, and finally at https://discuss.python.org/t/add-re-prefixmatch-deprecate-re-match/105927

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 17:43:39 -08:00
Zachary Ware
b933ef9261
gh-144551: Update CI to use latest OpenSSL versions (GH-144794)
Also update _ssl_data_36.h to include an added symbol from 3.6.1.
2026-02-13 13:06:07 -06:00
Priyanshu Singh
82b92e3cd1
gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (#143892)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-02-13 16:35:08 +01:00
James
e66f4a5a9c
gh-80667: Fix case-sensitivity of some Unicode literal escapes (GH-107281)
Lookup for CJK ideograms and Hangul syllables is now case-insensitive,
as is the case for other character names.
2026-02-12 18:50:40 +02:00
Stan Ulbrych
51a408ed77
Add missing step to Modules/expat/refresh.sh instructions (GH-144719) 2026-02-12 09:55:26 +01:00
Pablo Galindo Salgado
46d5106cfa
gh-142349: Implement PEP 810 - Explicit lazy imports (#142351)
Co-authored-by: T. Wouters <twouters@meta.com >
Co-authored-by: Brittany Reynoso <breynoso@meta.com>
Co-authored-by: Dino Viehland <dinoviehland@meta.com>
2026-02-12 00:15:33 +00:00
William Meehan
3e0322ff16
gh-84424: Use numeric_changed for UCD.numeric (GH-19457)
This was causing ucd_3_2_0.numeric() to pick up only decimal
changes between Unicode 3.2.0 and the current version.
2026-02-11 20:58:24 +00:00
Kumar Aditya
347d3594d3
gh-143300: implement PyUnstable_SetImmortal for marking objects as immortal (#144543) 2026-02-11 20:59:31 +05:30
Nybblista
cc81707e40
gh-144629: Add test for the PyFunction_GetAnnotations() function (#144630) 2026-02-10 14:38:24 +00:00
Sacul
6c8ca1c378
gh-134584: Optimize _BINARY_OP_SUBSCR_LIST_SLICE (GH-144659) 2026-02-10 22:33:32 +08:00
Pablo Galindo Salgado
2c1ca6bb5b
gh-144563: Fix remote debugging with duplicate libpython mappings from ctypes (#144595)
When _ctypes is imported, it may call dlopen on the libpython shared
library, causing the dynamic linker to load a second mapping of the
library into the process address space. The remote debugging code
iterates memory regions from low addresses upward and returns the first
mapping whose filename matches libpython. After _ctypes is imported, it
finds the dlopen'd copy first, but that copy's PyRuntime section was
never initialized, so reading debug offsets from it fails.

Fix this by validating each candidate PyRuntime address before accepting
it. The validation reads the first 8 bytes and checks for the "xdebugpy"
cookie that is only present in an initialized PyRuntime. Uninitialized
duplicate mappings will fail this check and be skipped, allowing the
search to continue to the real, initialized PyRuntime.
2026-02-10 10:04:50 +00:00
Joshua Root
d2d245942e
gh-144648: Improve libproc usage in _remote_debugging (#144649) 2026-02-10 08:29:55 +00:00
Steve Dower
a9b6788ae6
gh-144278: Enable overriding sys.implementation's name and cache_tag when building sysmodule.c (GH-144293)
Changing the values requires forking and patching, which is intentional. Simply rebuilding from source does not change the implementation enough to justify changing these values - they would still be `cpython` and compatible with existing `.pyc` files. But people who maintain forks are better served by being able to easily override these values in a place that can be forward-ported reliably.
2026-02-10 00:01:17 +00:00
Peter Bierma
fd6b639a49
gh-144601: Avoid sharing exception objects raised in a PyInit function across multiple interpreters (GH-144602) 2026-02-09 16:57:03 +01:00
VanshAgarwal24036
a91b5c3fb5
gh-143543: Fix re-entrant use-after-free in itertools.groupby (GH-143738)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-09 15:12:25 +01:00
Petr Viktorin
b22ff1e543
gh-140550: allow slots that repeat information from PyModuleDef (GH-144340)
When integrating slots-based module creation is with the inittab,
which currently requires PyModuleDef, it would be convenient to
reuse the the same slots array for the MethodDef.

Allow slots that match what's already present in the PyModuleDef.
2026-02-09 11:35:43 +01:00
Ken Jin
895e83727d
gh-144549: Fix tail calling interpreter on Windows for FT (GH-144550) 2026-02-06 19:20:28 +00:00