Commit graph

130270 commits

Author SHA1 Message Date
Filipe Laíns
157f271de3
gh-139899: Introduce MetaPathFinder.discover and PathEntryFinder.discover (#139900)
* gh-139899: Introduce MetaPathFinder.discover and PathEntryFinder.discover

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Fix doc reference

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Remove specific doc references

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Fix docstrings

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Revert "Remove specific doc references"

This reverts commit 31d1a8f551.

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Fix news references

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Add docs warning

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Raise ValueError on invalid parent

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Dedupe __path__ in PathFinder.discover

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Use context manager and add error handling to os.scandir

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Raise ValueError on invalid parent

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Dedupe when package exists with multiple suffixes

Signed-off-by: Filipe Laíns <lains@riseup.net>

* Apply suggestions from code review

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>

* Add tests

Signed-off-by: Filipe Laíns <lains@riseup.net>

---------

Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Brett Cannon <brett@python.org>
2026-02-19 15:25:50 +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
Donghee Na
28b3a8ac08
gh-141510: Update ftscalingbench to support frozendict (gh-144999) 2026-02-19 23:06:15 +09:00
David Peter
1d099164bc
gh-144702: Use standard terminology in class pattern error message (#144703) 2026-02-19 13:31:13 +00:00
Donghee Na
52794cba13
gh-141510: Update Whats News for frozendict (gh-144961) 2026-02-19 12:48:57 +00:00
Chris Eibl
c06f4f4301
GH-144679: When building with VS 2026 on Windows, use PlatformToolset v145 by default (GH-144680) 2026-02-19 12:38:46 +00: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
Stan Ulbrych
20caf1c084
Remove unused :platform: in module's docs (GH-144988)
It has not been outputted since Sphinx 1.1.
2026-02-19 13:45:30 +02:00
Ken Jin
e84a2cc83c
gh-144888: Don't invalidate executors during function deallocation (#144974) 2026-02-19 03:44:50 +00:00
Sam Gross
7ebe924395
gh-144969: Document that the free threading GC can change ob_tid (#144972) 2026-02-19 01:49:09 +01:00
Victor Stinner
0bbdb4e897
gh-141510: Replace MappingProxyType with frozendict (#144904) 2026-02-18 20:23:49 +00:00
Victor Stinner
16ccdbc50a
gh-141510: Fix frozendict.fromkeys() for dict subclasses (#144962)
Copy also the dictionary if a dict subclass returns a frozendict.
2026-02-18 18:03:04 +01: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
Victor Stinner
83f4fffe3d
gh-144763: Don't detach the GIL in tracemalloc (#144779)
tracemalloc no longer detaches the GIL to acquire its internal lock.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-02-18 15:57:48 +00:00
Victor Stinner
c582ff3c25
gh-141510: Fix frozendict.fromkeys() for subclasses (#144952)
Copy the frozendict if needed.
2026-02-18 15:56:09 +00:00
Victor Stinner
1ddb412689
gh-141510: Add can_modify_dict() in dictobject.c (#144955)
can_modify_dict() is stricter than ASSERT_DICT_LOCKED() for
frozendict. It uses PyUnstable_Object_IsUniquelyReferenced() which
matters for free-threaded builds.

Replace anydict_setitem_take2() with setitem_take2_lock_held(). It's
no longer useful to have two functions.
2026-02-18 15:47:49 +01:00
Victor Stinner
f705486745
gh-141510: Add frozendict fast-path to the set type (#144912) 2026-02-18 15:25:47 +01:00
Stan Ulbrych
c6a142f947
Datetime: Tidy up docs (GH-144720)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-02-18 14:22:34 +01:00
Ruslan Gilfanov
1636630390
gh-124748: Fix handling kwargs in WeakKeyDictionary.update() (#124783) 2026-02-18 13:17:08 +00:00
Petr Viktorin
112d8ac972
gh-141984: Reword and reorganize the first part of Atoms docs (GH-144117)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-18 14:13:21 +01: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
Pieter Eendebak
dd64e4260e
gh-141510: Implement copy and deepcopy for frozendict (#144905)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-02-18 12:30:26 +01: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
9e8fa2d4d1
gh-144386: Update equivalent code for "with", "async with" and "async for" (GH-144472)
They use special method lookup for special methods.
2026-02-18 13:13:32 +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
Ned Batchelder
7a7521bcfa
Docs: an "improve this page" feature (#144939)
* Docs: a start on an 'improve this page' feature

* pr feedback: simplify the link, and don't scare people with the cla

* pr feedback answered

- use the actual page URL
- tighten the wording

* fix the improve link on the improve page

* news item

* Update Doc/improve-page.rst

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>

* fix whitespace

* A nojs version of the page

* comments to help people keep the two pages in sync

* protect against XSS

* use template for issues from the nojs page

* use the template from the JS page as well

* give the docs issue template a fillable description field

* ugh, getting sloppy

* remove more sloppiness

---------

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-18 04:58:30 -05:00
Stan Ulbrych
6f7e3d4408
Docs: Remove unnecessary entry from nitpick_ignore (GH-144933) 2026-02-18 08:52:04 +01:00
Stan Ulbrych
783e3fd436
Move CODEOWNERS rule from devguide (GH-144924) 2026-02-18 08:51:45 +01:00
Kumar Aditya
836f2c97f9
gh-144914: use mimalloc for raw allocations on free-threading (#144916) 2026-02-18 04:16:27 +00:00
Victor Stinner
e779777c66
gh-141510: Mention frozendict in dict documentation (#144934)
test_genericalias now tests also frozendict.
2026-02-17 23:03:22 +01:00
Donghee Na
d1b541b047
gh-141510: Optimize {frozen}dict.fromkeys for frozendict (gh-144915) 2026-02-17 21:46:20 +00:00
Stan Ulbrych
fa73fd473f
gh-141510: Update test_xpickle for frozendict (#144927) 2026-02-17 21:26:29 +01:00
Victor Stinner
d1505b543a
gh-141510: Change repr(frozendict) for empty dict (#144921)
repr(frozendict()) returns "frozendict()" instead of
"frozendict({})".
2026-02-17 18:04:17 +00:00
Victor Stinner
8e211b1ca9
gh-141510: Optimize hash(frozendict) (#144919)
hash(frozendict) no longer creates a temporary items view and a
temporary frozenset object.

Copy frozenset_hash() code to frozendict_hash().
2026-02-17 18:39:33 +01:00
Sam Gross
6577d870b0
gh-144438: Fix false sharing between QSBR and tlbc_index (gh-144554)
Align the QSBR thread state array to a 64-byte cache line boundary
and add padding at the end of _PyThreadStateImpl. Depending on heap
layout, the QSBR array could end up sharing a cache line with a
thread's tlbc_index, causing QSBR quiescent state updates to contend
with reads of tlbc_index in RESUME_CHECK. This is sensitive to
earlier allocations during interpreter init and can appear or
disappear with seemingly unrelated changes.

Either change alone is sufficient to fix the specific issue, but both
are worthwhile to avoid similar problems in the future.
2026-02-17 11:12:25 -05:00
Donghee Na
1bd8cf9ed2
gh-141510: Remove unncessary lock holding for frozendict repr (gh-144920) 2026-02-17 14:52:50 +00:00
Donghee Na
fc05e5e3d7
gh-141510: Update mp_length of frozendict to use non atomic operation (gh-144913) 2026-02-17 13:39:56 +00:00
Hugo van Kemenade
6ef2578f20
Enable CPU tests on default ARM build (#144743) 2026-02-17 12:49:31 +02:00
Victor Stinner
696cdfc0a2
gh-141510, PEP 814: Add built-in frozendict type (#144757)
Add TYPE_FROZENDICT to the marshal module.

Add C API functions:

* PyAnyDict_Check()
* PyAnyDict_CheckExact()
* PyFrozenDict_Check()
* PyFrozenDict_CheckExact()
* PyFrozenDict_New()

Add PyFrozenDict_Type C type.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Adam Johnson <me@adamj.eu>
Co-authored-by: Benedikt Johannes <benedikt.johannes.hofer@gmail.com>
2026-02-17 10:54:41 +01:00
Victor Stinner
63531a3867
gh-143637: Fix test_socket.test_sendmsg_reentrant_ancillary_mutation() on Solaris (#144890)
Use socket.SCM_RIGHTS operation.
2026-02-17 10:49:30 +01:00
Mauricio Villegas
2f7634c029
gh-144782: Make sure that ArgumentParser instances are pickleable (#144783)
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-02-16 18:28:21 -08:00
Pablo Galindo Salgado
18c04f2e2a
gh-142349: Fix ast.unparse for lazy import statements (#144893)
The unparser was not handling the `is_lazy` attribute on Import and
ImportFrom AST nodes, causing lazy imports to be unparsed as regular
imports. This broke the round-trip (parse → unparse → reparse) for
any file containing `lazy import` statements.
2026-02-16 22:57:49 +00:00
Jason Yalim, PhD
185a6e942a
gh-140715: Add %D format code support to strptime() (GH-144819)
* %D support for strptime, including test and Doc update
* additional %D test
* change documentation example date for %D so it is more legible to non-US readers
* change testing date for %D so it is more legible to non-US readers
* mv News blurb to Library, consistent with previous %F change
* change invalid format code from %D to C-standard unused %!
* Fix erroneous and misleading example Doc to %y from %Y, use correct C99+ definition for C99 %D; update additional tests

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-02-16 14:20:37 -08:00
Pablo Galindo Salgado
1797508ead
gh-144878: Gate PEP 810 builtins in xpickle compat tests (#144889) 2026-02-16 21:48:08 +00:00
sblondon
837166f099
bpo-32234: Allow mailbox instances as context managers (GH-4770)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: R. David Murray <rdmurray@bitdance.com>
2026-02-16 14:14:26 +01: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
Zachary Ware
ebe02e4f39
gh-144551: Update iOS builds to use OpenSSL 3.0.19 (GH-144865) 2026-02-15 23:02:23 -06:00
Zachary Ware
87c7f193b8
gh-144551: Update Android builds to use OpenSSL 3.0.19 (GH-144864) 2026-02-15 23:02:07 -06:00