Commit graph

129165 commits

Author SHA1 Message Date
Stan Ulbrych
c181c5fa16
[3.14] gh-149017: Upgrade bundled Expat to 2.8.0 (GH-149020) (#149073)
(cherry picked from commit 005555a3f0)
2026-04-28 16:30:12 +03:00
Miss Islington (bot)
41f475c996
[3.14] gh-149035: Modernize legacy Python patterns in Doc/tutorial/stdlib2.rst (GH-149036) (#149089)
Co-authored-by: ByteFlow <fakeshadow1337@gmail.com>
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 05:17:18 +00:00
Miss Islington (bot)
22d53a9141
[3.14] gh-148529: Minor improvements of the struct module documentation (GH-148565) (GH-149063)
* Document that 's' and 'p' accept bytes and bytearray.
* Fix some footnotes.
* Clarify that "string" is a byte string.
* Fix the module docstring.
(cherry picked from commit 3e5a3cb2bd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-04-27 23:07:00 +03:00
Miss Islington (bot)
2459faaaa9
[3.14] gh-148663: Document that calendar.IllegalMonthError inherits from both ValueError and IndexError (GH-148664) (#148917)
(cherry picked from commit 435be06dd2)

Co-authored-by: Eoin Shaughnessy <45000144+EoinTrial@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-27 21:00:46 +01:00
Miss Islington (bot)
b01e594fbe
[3.14] gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows (GH-146591) (GH-149064)
Use ZipFile.extractall() to sanitize file names and extract files.

Files with invalid names (e.g. absolute paths) are now skipped.

Files containing ".." in the name are no longer skipped.
(cherry picked from commit fc829e8875)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-04-27 22:55:02 +03:00
Thomas Kowalski
0cd8123535
[3.14] Un-skip previously-broken test_get_type_hints_modules_forward_ref (#149053) 2026-04-27 09:54:56 -07:00
Gregory P. Smith
bb8d6a0863
[3.14] Improve hash() builtin docstring with caveats. (GH-125229) (#149054)
Improve  `hash()` builtin docstring with caveats.

Mention its return type and that the value can be expected to change between
processes (hash randomization).

Why? The `hash` builtin gets reached for and used by a lot of people whether it
is the right tool or not. IDEs surface docstrings and people use pydoc and
`help(hash)`.
(cherry picked from commit 665b7dfcfa)
2026-04-27 16:17:30 +00:00
Miss Islington (bot)
f9140e201c
[3.14] gh-82665 Mention that HTMLParser.handle_starttag value can be None (GH-134312) (#149037)
gh-82665 Mention that HTMLParser.handle_starttag value can be None (GH-134312)

* Specify boolean attribute behavior in parser

* Tweak wording and example




* Fix backticks

---------
(cherry picked from commit 804c213c89)

Co-authored-by: Micah Najacht <micah.najacht@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-04-27 22:30:00 +08:00
Miss Islington (bot)
86ce2e05dc
[3.14] Document that multiprocessing treats local same-user processes as trusted (GH-149001) (#149033)
Document that multiprocessing treats local same-user processes as trusted (GH-149001)

Clarify in the Authentication keys section that the authkey handshake
covers Listener/Client (addressable endpoints) only, not the anonymous
pipes behind Pipe() and Queue, and that isolation between same-user
processes must be arranged at the OS level.
(cherry picked from commit f27e91e372)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-04-27 01:49:27 +00:00
Sergey Miryanov
9a7e205e46
[3.14] GH-148726: Forward-port generational GC (#148720)
Co-authored-by: Neil Schemenauer <nas@arctrix.com>
Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2026-04-26 21:12:52 +03:00
Miss Islington (bot)
78c5e54b4f
[3.14] gh-146455: Fix O(N²) in add_const() after constant folding moved to CFG (GH-146456) (#149011)
gh-146455: Fix O(N²) in add_const() after constant folding moved to CFG (GH-146456)

The add_const() function in flowgraph.c uses a linear search over the
consts list to find the index of a constant. After gh-126835 moved
constant folding from the AST optimizer to the CFG optimizer, this
function is now called N times for N inner tuple elements during
fold_tuple_of_constants(), resulting in O(N²) total time.

Fix by maintaining an auxiliary _Py_hashtable_t that maps object
pointers to their indices in the consts list, providing O(1) lookup.

For a file with 100,000 constant 2-tuples:
- Before: 10.38s (add_const occupies 83.76% of CPU time)
- After:  1.48s
(cherry picked from commit 5d416324c5)

Co-authored-by: zSirius <107359899+zSirius@users.noreply.github.com>
2026-04-26 18:45:38 +03:00
Miss Islington (bot)
5770df43dc
[3.14] gh-141473: Speed up subprocess test_communicate_timeout_large_input long tail (GH-149003) (#149004)
gh-141473: Speed up subprocess test_communicate_timeout_large_input long tail (GH-149003)

gh-141473: Speed up test_communicate_timeout_large_input

Replace the slow reader's 30s sleep with a parent-driven wake over a
loopback socket so post-timeout communicate() doesn't block waiting
for the child to wake on its own. Worst-case runtime: ~30s -> <1s.
(cherry picked from commit e1384cfd25)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-04-26 04:29:47 +00:00
Miss Islington (bot)
15e2b64cd8
[3.14] gh-148947: dataclasses: fix error on empty __class__ cell (GH-148948) (#148995)
gh-148947: dataclasses: fix error on empty __class__ cell  (GH-148948)

Also add a test demonstrating the need for the existing "is oldcls" check.
(cherry picked from commit 6d7bbee1d5)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2026-04-25 15:57:33 +00:00
Miss Islington (bot)
8acb98a1c2
[3.14] gh-148973: fix segfault on mismatch between consts size and oparg in compiler (GH-148974) (#148980)
gh-148973: fix segfault on mismatch between consts size and oparg in compiler (GH-148974)
(cherry picked from commit c650b51c32)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2026-04-25 13:53:42 +01:00
Miss Islington (bot)
89f44ac422
[3.14] gh-148735: Fix a UAF in Element.findtext() (GH-148738) (#148916)
(cherry picked from commit 0469e6d38d)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-24 21:38:15 +01:00
Miss Islington (bot)
3034c8fa60
[3.14] Additional itertool recipes for running statistics (gh-148879) (gh-148949) 2026-04-24 05:52:35 +00:00
Sam Gross
26c6e3d7e3
[3.14] gh-113956: Make intern_common thread-safe in free-threaded build (gh-148886) (#148927)
Avoid racing with the owning thread's refcount operations when
immortalizing an interned string: if we don't own it and its refcount
isn't merged, intern a copy we own instead. Use atomic stores in
_Py_SetImmortalUntracked so concurrent atomic reads are race-free.

(cherry picked from commit 4629c2215a)
2026-04-23 19:12:19 +00:00
Miss Islington (bot)
31ba91a35e
[3.14] gh-132631: Fix "I/O operation on closed file" when parsing JSON Lines file (GH-132632) (#148921)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2026-04-23 19:32:29 +03:00
Miss Islington (bot)
0f656e2641
[3.14] gh-148484: Fix memory leak of iterator in array.array constructor (GH-148523) (GH-148678)
(cherry picked from commit afde75664e)

Co-authored-by: Gleb Popov <gvpopov.dev@gmail.com>
2026-04-23 16:00:37 +02:00
Miss Islington (bot)
5e758ff525
[3.14] gh-148464: Add missing `__ctype_le/be__` attributes for complex types in the ctype module (GH-148485) (GH-148677)
(cherry picked from commit 769cc8338f)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2026-04-23 15:57:55 +02:00
Miss Islington (bot)
b6a7212edb
[3.14] gh-148680: Replace internal names with type_reprs of objects in string representations of ForwardRef (GH-148682) (#148913)
(cherry picked from commit 158dbbb97f)

Co-authored-by: David Ellis <ducksual@gmail.com>
Co-authored-by: Shamil <ashm.tech@proton.me>
2026-04-23 13:47:52 +00:00
Miss Islington (bot)
f795e04204
[3.14] gh-90309: Base64-encode cookie values embedded in JS (GH-148889)
(cherry picked from commit 76b3923d68)

Co-authored-by: Seth Larson <seth@python.org>
2026-04-23 15:05:09 +02:00
Miss Islington (bot)
dd9a77ff2e
[3.14] gh-148892: Drop mention of deprecated cibuildwheel option (GH-148893) (#148903)
gh-148892: Drop mention of deprecated cibuildwheel option (GH-148893)
(cherry picked from commit 3b9397988d)

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
2026-04-23 04:06:39 +00:00
Miss Islington (bot)
032b1be5bb
[3.14] gh-119180: Document the format parameter in typing.get_type_hints() (GH-143758) (#148901)
Do not mention `__annotations__` dictionaries, as this is slightly
outdated since 3.14.

Rewrite the note about possible exceptions for clarity. Also do not
mention imported type aliases, as since 3.12 aliases with the `type`
statement do not suffer from this limitation anymore.
(cherry picked from commit 8bf99ae3a9)

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2026-04-22 19:59:18 -07:00
Miss Islington (bot)
0a63bb8971
[3.14] gh-142965: Fix Concatenate documentation to reflect valid use cases (GH-143316) (#148899)
The documentation previously stated that Concatenate is only valid
when used as the first argument to Callable, but according to PEP 612,
it can also be used when instantiating user-defined generic classes
with ParamSpec parameters.
(cherry picked from commit 75ff1afcb6)

Co-authored-by: John Seong <39040639+sandole@users.noreply.github.com>
2026-04-22 19:57:54 -07:00
Miss Islington (bot)
27cd23470a
[3.14] gh-146553: Fix infinite loop in typing.get_type_hints() on circular __wrapped__ (GH-148595) (#148895)
(cherry picked from commit be833e658a)

Co-authored-by: Shamil <ashm.tech@proton.me>
2026-04-23 02:57:38 +00:00
Miss Islington (bot)
3c71d3654e
[3.14] gh-145194: Fix typing in re tokenizer example (GH-145198) (#148897)
(cherry picked from commit bd7352d807)

Co-authored-by: Vikash Kumar <163628932+Vikash-Kumar-23@users.noreply.github.com>
2026-04-23 02:45:46 +00:00
Hugo van Kemenade
5b33424120
[3.14] Add a new Sphinx soft-deprecated directive (GH-148630) (#148714)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-23 00:41:40 +03:00
Stan Ulbrych
5f1b710a28
[3.14] gh-148801: Fix unbound C recursion in Element.__deepcopy__() (GH-148802) (#148842)
(cherry picked from commit 33e82be174)
2026-04-22 22:19:25 +01:00
Sam Gross
e5d5541683
[3.14] gh-148820: Fix _PyRawMutex use-after-free on spurious semaphore wakeup (gh-148852) (#148884)
_PyRawMutex_UnlockSlow CAS-removes the waiter from the list and then
calls _PySemaphore_Wakeup, with no handshake. If _PySemaphore_Wait
returns Py_PARK_INTR, the waiter can destroy its stack-allocated
semaphore before the unlocker's Wakeup runs, causing a fatal error from
ReleaseSemaphore / sem_post.

Loop in _PyRawMutex_LockSlow until _PySemaphore_Wait returns Py_PARK_OK,
which is only signalled when a matching Wakeup has been observed.

Also include GetLastError() and the handle in the Windows fatal messages
in _PySemaphore_Init, _PySemaphore_Wait, and _PySemaphore_Wakeup to make
similar races easier to diagnose in the future.

(cherry picked from commit ad3c5b7958)
2026-04-22 18:59:58 +00:00
Miss Islington (bot)
5aa8234cce
[3.14] gh-146578: _zstd: Fix printf format for pledged size errors (GH-146576) (#148855)
gh-146578: _zstd: Fix printf format for pledged size errors (GH-146576)

Use %llu instead of %ull for unsigned long long in zstd_contentsize_converter ValueError messages.
(cherry picked from commit 09233bd198)

Co-authored-by: cui <cuiweixie@gmail.com>
2026-04-21 13:31:46 -07:00
Miss Islington (bot)
27522b7d6e
[3.14] gh-148808: Add boundary check to asyncio.AbstractEventLoop.sock_recvf… (GH-148809) (#148837)
gh-148808: Add boundary check to asyncio.AbstractEventLoop.sock_recvf… (GH-148809)
(cherry picked from commit 1274766d3c)

Co-authored-by: Seth Larson <seth@python.org>
2026-04-21 21:56:19 +05:30
Miss Islington (bot)
b1cf901633
[3.14] gh-146211: Reject CR/LF in HTTP tunnel request headers (GH-146212) (#148342)
gh-146211: Reject CR/LF in HTTP tunnel request headers (GH-146212)
(cherry picked from commit 05ed7ce7ae)

Co-authored-by: Seth Larson <seth@python.org>
Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2026-04-21 10:49:37 +03:00
Miss Islington (bot)
c235654cba
[3.14] gh-148814: Fix an issue in Emscripten README (GH-148752) (#148815)
Correct the description of the default state of test module compilation.
(cherry picked from commit d206d42834)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-20 23:10:52 +00:00
Miss Islington (bot)
c171c52c3c
[3.14] Docs: Fix some typos in calendar.rst (GH-148756) (GH-148795)
Docs: Fix some typos in `calendar.rst` (GH-148756)
(cherry picked from commit 983c7462d6)

Co-authored-by: Manoj K M <manojkmdev24@gmail.com>
2026-04-20 14:43:12 +00:00
Miss Islington (bot)
7b233c144f
[3.14] gh-148788: Update Emscripten example post move to Platforms dir (GH-148761) (#148789)
Update Emscripten example post move to Platforms dir.
(cherry picked from commit a00b24ec68)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-20 02:36:44 +00:00
Miss Islington (bot)
f283ac45e6
[3.14] gh-148763: Fix paramter name in multiprocessing.connection.send_bytes/recv_bytes_into docs (GH-126603) (#148786)
gh-148763: Fix paramter name in `multiprocessing.connection.send_bytes/recv_bytes_into` docs (GH-126603)
(cherry picked from commit e50acef0b2)


Doc: Fix buf argument name in multiprocessing connection send_bytes

Co-authored-by: Matthew Davis <7035647+mdavis-xyz@users.noreply.github.com>
2026-04-20 00:11:52 +00:00
Miss Islington (bot)
ec1d8631b3
[3.14] gh-148779: Update Briefcase link in android.rst documentation (GH-148777) (#148780)
Use canonical beeware.org URL for link to Briefcase.
(cherry picked from commit 82767780f8)

Co-authored-by: partev <petrosyan@gmail.com>
2026-04-19 21:50:07 +00:00
Miss Islington (bot)
e9aacf90ec
[3.14] gh-121946: Use clang-20 for TSan build (GH-148570) (#148755)
Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-04-19 18:38:57 +03:00
Miss Islington (bot)
f2a0dcbfac
[3.14] Prevent GitHub's web conflict editor from converting LF to CRLF (GH-148739) (#148748)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-19 09:46:41 +00:00
Miss Islington (bot)
b0104a9cfe
[3.14] gh-133403: Add type annotations to generate_levenshtein_examples.py (GH-143317) (#148734)
Co-authored-by: John Seong <39040639+sandole@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-19 12:22:26 +03:00
Miss Islington (bot)
a37b105eec
[3.14] gh-148653: Fix reference leaks in test_marshal introduced in gh-148698 (GH-148725) (GH-148727)
(cherry picked from commit 7ce737ea11)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-04-18 12:35:51 +00:00
Serhiy Storchaka
d496c637a3
[3.14] gh-148653: Fix some marshal errors related to recursive immutable objects (GH-148698) (GH-148711)
Forbid marshalling recursive code and slice objects which
cannot be correctly unmarshalled.
Add multiple tests for recursive data structures.
(cherry picked from commit 2e37d83641)
2026-04-18 08:57:55 +00:00
Miss Islington (bot)
67100b3e92
[3.14] gh-148222: Fix NULL dereference bugs in genericaliasobject.c (GH-148226) (#148705)
gh-148222: Fix NULL dereference bugs in genericaliasobject.c (GH-148226)
(cherry picked from commit 634568d030)

Co-authored-by: Prakash Sellathurai <prakashsellathurai@gmail.com>
2026-04-18 00:47:06 +00:00
Miss Islington (bot)
7f6a0c377b
[3.14] gh-148651: Fix refcount leak in _zstd decompressor options (GH-148657) (#148691)
gh-148651: Fix refcount leak in _zstd decompressor options (GH-148657)

The option parsing in Modules/_zstd/decompressor.c had a missing Py_DECREF(value) before the early return -1 when PyLong_AsInt(key) fails. The identical code in Modules/_zstd/compressor.c line 158 has the fix.
(cherry picked from commit 446edda209)

Co-authored-by: Michael Bommarito <michael.bommarito@gmail.com>
2026-04-17 16:07:54 +00:00
Miss Islington (bot)
2fdccb3f88
[3.14] gh-148535: Don't use gcc -fprofile-update=atomic flag on i686 (GH-148554) (#148655)
gh-148535: Don't use gcc -fprofile-update=atomic flag on i686 (GH-148554)

The -fprofile-update=atomic flag was added to fix a random GCC
internal error on PGO build (gh-145801) caused by corruption of
profile data (.gcda files). The problem is that it makes the PGO
build way slower (up to 47x slower) on i686. Since the GCC internal
error was not seen on i686 so far, don't use -fprofile-update=atomic
on i686.
(cherry picked from commit 2faceeec5c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-16 17:46:06 +00:00
Jelle Zijlstra
1c9de6bbaa
[3.14] gh-137814: Fix __qualname__ of __annotate__ functions in the interpreter (#148221)
gh-137814: [3.14] Fix __qualname__ of __annotate__ functions in the interpreter

I'd still like to do #137842 on 3.15+, but that requires changing bytecode and we can't
really afford to do that in 3.14. So to fix this in 3.14, let's patch things up in the
ceval loop instead.

This is safe because the compiler only sets __annotate__ to just-created dedicated
annotate functions.
2026-04-15 21:52:43 -07:00
Miss Islington (bot)
0a6bc082b7
Add PyManager documentation for index signatures (GH-148631)
(cherry picked from commit 54607eec34)

Co-authored-by: Steve Dower <steve.dower@python.org>
2026-04-15 21:54:01 +00:00
Miss Islington (bot)
0d2101de2a
[3.14] gh-100305: Deemphasize that ast.literal_eval is safe in eval documentation (GH-100326) (#148420)
(cherry picked from commit b3b0cef0c2)

Co-authored-by: Ram Vikram Singh <ramvikrams243@gmail.com>
Co-authored-by: Éric <merwok@netwok.org>
2026-04-15 17:15:42 +01:00
Miss Islington (bot)
0968f332f4
[3.14] Docs: Use bash lexer for http.server CLI commands, not Python (GH-148612) (#148620)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-15 18:27:06 +03:00