Commit graph

32729 commits

Author SHA1 Message Date
Dan Shernicoff
398d7e1d13
gh-79413: Add qualname parameter to dataclass.make_dataclass. (GH-150026)
Added `qualname` parameter to `dataclasses.make_dataclass` in order to allow user to set `__qualname__` for the generated class.
2026-05-18 19:55:47 -04:00
Saul Cooperman
57a0e570d3
gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (#150025)
Remove assertion that could fail in rare race condition.

Replace the coarse critical section wrapping the entire function with
fine-grained sections covering only PyDict_Next + Py_INCREF.
Also handle PyDict_Next returning 0 in the single-item fast path.
2026-05-18 16:26:08 -07:00
Armaan Vakharia
56737483c2
gh-149590: Remove faulthandler_traverse (#150023)
`faulthandler_traverse` visits Python objects owned by `_PyRuntime`, not
by the module instance. With multi-phase init allowing multiple module
instances, each instance's GC traversal decrements `gc_refs` on the same
runtime-owned objects, driving it negative when two instances are
collected simultaneously.
2026-05-18 16:00:59 -07:00
nessita
9770e32ce0
gh-86533: Restore os.makedirs() ability to apply *mode* recursively (GH-150011)
bpo-42367: Restore os.makedirs() and pathlib.mkdir() ability to apply *mode* recursively via a new parent_mode= keyword argument.

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-18 23:00:27 +00:00
ankhikarmakar
5775aa8e29
gh-149980: Strip all trailing slashes from GNU long directory names in tarfile (GH-150019) 2026-05-18 19:31:15 +00:00
Jeff Epler
806c997f55
gh-140344: ast: Add deprecation warnings (#140345)
These were all deprecated in 3.9 (bace59d8b8) but without
a runtime deprecation warning. Add it now, so that these
items can be removed in 3.21 per PEP 387.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-18 11:20:49 -07:00
sobolevn
14af19e6c0
gh-149816: Fix a RC in _random.Random.__init__ method (#149824) 2026-05-18 18:39:54 +03:00
Maurycy Pawłowski-Wieroński
a2932e9c95
gh-149464: Add os.pidfd_getfd(pidfd, targetfd, flags=0) function (#149465)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-05-18 16:29:58 +02:00
Pieter Eendebak
6ee879ffa1
gh-138325: steal list items in INTRINSIC_LIST_TO_TUPLE opcode (#149960) 2026-05-18 12:07:12 +05:30
AN Long
acefff95ea
gh-149921: Fix reference leaks in _interpchannels and _interpqueues modules (#149922) 2026-05-17 13:09:19 +03:00
Farhan Saif
e62a61177f
gh-146452: Fix pickle segfault on concurrent mutation of dict in pickle (#146470)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-17 14:35:27 +05:30
sobolevn
46afba7b93
gh-149816: Fix a race condition in _PyBytes_FromList with free-threading (#149909) 2026-05-16 08:37:34 +00:00
Stan Ulbrych
9ee9f58747
gh-149567: Remove deprecated shutil.ExecError (#149568) 2026-05-15 18:54:05 +01:00
sobolevn
8be3fb1b50
gh-142349: Add help("lazy") support (#149886) 2026-05-15 16:30:40 +00:00
Hugo van Kemenade
a318a9d8d7
CI: Move Homebrew dependencies into Brewfile (#148335)
Co-authored-by: Brett Cannon <brett@python.org>
2026-05-15 17:03:46 +03:00
Steve Dower
1c5fe21eb2
gh-149786: Fixes venvlauncher builds on Windows free-threaded (GH-149847) 2026-05-15 14:43:41 +01:00
Steve Dower
4aa296f9c4
gh-138489: Add build-details.json generation to PC/layout (GH-149153) 2026-05-15 13:51:27 +01:00
Victor Stinner
a0551b1a12
gh-148200: Update Modules/_hacl/ for Cygwin (#149802)
This pulls an updated version of HACL* that fixes Lib_Memzero0.c on
Cygwin, via an upstream fix.
2026-05-15 14:42:30 +02:00
sobolevn
1fdf033774
gh-149816: Fix race condition in memoryview with free-threading (#149858) 2026-05-15 15:38:51 +03:00
Serhiy Storchaka
20438866ae
gh-149801: Add IANA registered names and aliases with leading zeros (GH-149804)
Like IBM00858, CP00858, IBM01140, CP01140.
2026-05-15 14:34:48 +03:00
Zachary Ware
c62c3710dc
gh-124111: Update Windows build to use Tcl/Tk 9.0.3 (GH-149477) 2026-05-14 12:47:28 -05:00
Stan Ulbrych
f1a47e79fb
gh-149698: Update bundled expat to 2.8.1 (GH-149699) 2026-05-14 01:21:03 +02:00
Gregory P. Smith
eac4fe3b2c
gh-87451: Apply CVE-2021-4189 PASV fix to ftplib.ftpcp() (GH-149648)
ftpcp() called parse227() directly and passed the source server's
self-reported PASV IPv4 address to the target server's PORT command,
bypassing the CVE-2021-4189 fix that was applied only to FTP.makepasv().
A malicious source FTP server could use this to redirect the target
server's data connection to an arbitrary host:port (SSRF).

ftpcp() now uses the source server's actual peer address, honoring the
existing trust_server_pasv_ipv4_address opt-out, the same as makepasv().

Thanks to Qi Ding at Aurascape AI for the report. (GHSA-w8c5-q2xf-gf7c)
2026-05-13 17:33:43 +00:00
Barry Warsaw
b162307d7f
gh-149504: Fix re-entrancy bug when .pth/.start file invokes site.addsitedir() (#149659)
* Add re-entrant tests for gh-149504
* Add end-to-end integration test coverage

This ensures that future whitebox internal test changes do not regress the
public surface semantics.

* Implement a state class to process .pth and .start files

By using this state class and managing implicit and explicit batching, we make it structurally
impossible to get bitten by re-entrant site startup processing.

Fixes #149504
2026-05-13 16:45:25 +00:00
Victor Stinner
3cfc249e11
gh-149776: Skip UDP Lite tests if it's not supported (#149777)
Fix test_socket on Linux kernel 7.1 and newer: skip UDP Lite tests if
it's not supported.
2026-05-13 16:55:45 +02:00
Ruben Vorderman
dd94457893
bpo-45509: Check gzip headers for corrupted fields (GH-29028)
Check the header checksum it the HCRC field is present.
2026-05-13 10:20:33 +00:00
scoder
94df62542c
gh-148829: Add PySentinel_CheckExact() (#149725) 2026-05-13 10:10:37 +00:00
John Merkel
cd6096887e
gh-149701: Fully silence potential hash -r error (GH-149702) 2026-05-13 08:59:57 +01:00
Jelle Zijlstra
4087ff8599
gh-149642: Fix interaction between exec and lazy_imports=all (#149643) 2026-05-12 19:59:09 -07:00
Maurycy Pawłowski-Wieroński
76f2285341
gh-149718: Aggregate same stack frames in Tachyon in some collectors (#149719) 2026-05-12 23:46:21 +00:00
Sergey B Kirpichev
9eb3b14668
gh-115119: Removed bundled copy of the libmpdec (GH-133964)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Zachary Ware <zach@python.org>
2026-05-12 21:34:37 +00:00
sobolevn
e472f6d318
gh-149600: Remove deprecated asyncio.iscoroutinefunction function (#149601) 2026-05-12 22:59:46 +05:30
Stan Ulbrych
6a0be131c3
gh-149595: Remove the sys._enablelegacywindowsfsencoding() function (#149596)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-05-12 17:11:34 +01:00
stratakis
da8477b25c
gh-139808: Add branch protections for aarch64 in asm_trampoline.S (#130864)
Apply protection against ROP/JOP attacks for aarch64 on asm_trampoline.S.

The BTI flag must be applied in assembler sources for this class
of attacks to be mitigated on newer aarch64 processors.

See also:
https://sourceware.org/annobin/annobin.html/Test-branch-protection.html
and
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/enabling-pac-and-bti-on-aarch64

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-12 15:42:44 +00:00
sobolevn
0534774a47
gh-149720: Remove support for undotted ext in mimetypes.MimeType.add_type (#149721) 2026-05-12 13:40:21 +00:00
Thomas Kowalski
f5fb491341
gh-149676: Fix hash(frozendict | frozendict) (#149675)
Fix new_dict_impl() to properly initialize ma_hash on frozendict.

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-12 10:47:39 +00:00
Mike Edmunds
7a4c6dfb88
gh-128110: Fix rfc2047 whitespace handling in email parser address headers (#130749)
RFC 2047 Section 6.2 requires that "any 'linear-white-space' that
separates a pair of adjacent 'encoded-word's is ignored." The modern
header value parser correctly implements that for unstructured headers,
but had missed a case in structured headers. This could cause a parsed
address header to include extraneous spaces in a display-name.

Switch to @bitdancer's fix from review feedback. Recharacterize space
between ews as fws after parsing in get_phrase.

RDM: This fix is dependent on the fact that "subsequent" atoms will never have
leading whitespace because that's been consumed already. I don't think
it's worth adding extra code for the possibility of leading whitespace
because the parser won't produce it. It's a bit of parser fragility in the
face of code changes, but I think that's a minor concern given the 
parser design (which is that it consumes whitespace greedily)

Co-authored-by: R David Murray <rdmurray@bitdance.com>
2026-05-11 18:20:09 -04:00
Alper
8a4895985f
gh-145235: Make dict watcher API thread-safe for free-threaded builds (gh-145233)
In free-threaded builds, concurrent calls to PyDict_AddWatcher, PyDict_ClearWatcher, PyDict_Watch, and PyDict_Unwatch can race on the shared callback array and the per-dict watcher tags. This change adds a mutex to serialize watcher registration and removal, atomic operations for tag updates, and atomic acquire/release synchronization for callback dispatch in _PyDict_SendEvent.
2026-05-11 11:39:55 -04:00
David Ellis
fadd9bc14e
gh-149614 - Restore deepcopiability of argparse.ArgumentParser instances (#149617)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-05-11 15:28:23 +00:00
sobolevn
6a26b78c47
gh-149634: Fix removed docs from TarFile.tarfile to TarInfo.tarfile (#149680) 2026-05-11 18:03:57 +03:00
Guo Ci
2d3dec0fbd
gh-140924: In locale module, add missing names to __all__ (GH-140925) 2026-05-11 17:21:03 +03:00
Jelle Zijlstra
56171da341
gh-144957: Fix lazy imports + module __getattr__ (GH-149624) 2026-05-11 15:08:12 +02:00
sobolevn
0108843451
gh-149634: Remove deprecated and unused tarfile.Tarfile.tarfile attr (GH-149635) 2026-05-11 12:54:49 +02:00
Michael Droettboom
f23a1837d7
gh-112821: Fix rlcompleter failures on objects with descriptors (#149577)
* gh-112821: Fix rlcompleter failures on objects with descriptors

* Confirm no accesses
2026-05-10 21:44:59 -04:00
Barry Warsaw
197878529f
gh-75723: Fix double evaluation of .pth and .site files in venvs (#149583)
* Idempotent `.pth` execution in `site.addsitedir`
* potentially fix monkeypatch leak?

* fix blind copy paste of recommendation

* Update 2026-03-31-16-15-15.gh-issue-75723.BZ4Rsn.rst

* fix implicit merge conflict with 24c4aecc16

* Add failing tests for gh-75723

Based on @asottle branch !asottle-gh-75723 but refactored for `main`.
This will need a different backport.

* Repair gh-75723

The original fix is here: https://github.com/python/cpython/pull/147951
but I'm refactoring a bit for `main`.

* Refactor _make_mod() so we can use it to create package modules too

* Add myself to CODEOWNERS for the site module

---------

Co-authored-by: anthony sottile <asottile@umich.edu>
Co-authored-by: Filipe Laíns <lains@riseup.net>
2026-05-10 17:25:39 -07:00
sobolevn
c1dbd51fac
gh-149598: Remove strm argument support from logging handlers (#149599)
gh-149598: Remove *strm* argument support from `logging` handlers
2026-05-11 03:05:56 +03:00
Jelle Zijlstra
b45319e132
gh-139489: Add is_valid_text to xml.__all__ (#149641) 2026-05-10 13:43:57 -07:00
Stan Ulbrych
24b8f12544
gh-149018: Use XML_SetHashSalt16Bytes in pyexpat/_elementtree when possible (#149023) 2026-05-10 18:36:26 +01:00
ByteFlow
bc1be4f617
gh-148441: Avoid integer overflow in Expat's CharacterDataHandler (#148904)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-05-10 15:42:04 +02:00
Pieter Eendebak
a2c1657cab
gh-149436: Speed up inspect.getattr_static for the common-metaclass case (#149437)
Consecutive MRO entries usually share their metaclass, so call
_shadowed_dict at most once per distinct metaclass.
2026-05-09 19:52:52 -07:00