Commit graph

129126 commits

Author SHA1 Message Date
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
Miss Islington (bot)
bfbabb556c
[3.14] tiny edit, fix a couple of minor typos in enum and sqlite3 docs (GH-148580) (#148581)
tiny edit, fix a couple of minor typos in enum and sqlite3 docs (GH-148580)

pair of minor doc typo fixes
(cherry picked from commit 236aa0a4e2)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-04-14 17:06:41 -07:00
Miss Islington (bot)
e590f007ed
[3.14] gh-137335: remove a mktemp use in multiprocessing.connection to avoid security scanner noise (GH-148578) (#148583)
gh-137335: remove a mktemp use in multiprocessing.connection to avoid security scanner noise (GH-148578)

remove a mktemp use to avoid security scanner noise
(cherry picked from commit fd81246bd5)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-04-14 17:06:25 -07:00
Miss Islington (bot)
5dc69a6502
[3.14] gh-148186: Improve assertCountEqual description in docs. (GH-148463) (#148585)
gh-148186: Improve `assertCountEqual` description in docs. (GH-148463)
(cherry picked from commit 94d42bf5c2)

Co-authored-by: Kliment Lamonov <klimentlamonov@yandex.ru>
2026-04-14 23:45:18 +00:00
Miss Islington (bot)
d26fef174a
[3.14] gh-72406: Document argument ordering in argparse help output (GH-148534) (#148562)
gh-72406: Document argument ordering in argparse help output (GH-148534)
(cherry picked from commit 4286227308)

Co-authored-by: Santi Hernandez <santi@santihdzs.com>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-04-14 10:42:10 -07:00
Miss Islington (bot)
b988157e87
[3.14] gh-148192: Fix Generator._make_boundary behavior with CRLF line endings. (GH-148193) (#148550)
The Generator._make_boundary regex did not match on boundary phrases correctly when using CRLF line endings due to re.MULTILINE not considering \r\n as a line ending.
(cherry picked from commit 4af46b4ab5)

Co-authored-by: Henry Jones <44321887+henryivesjones@users.noreply.github.com>
2026-04-14 12:04:50 -04:00
Miss Islington (bot)
314f12c015
[3.14] gh-148487: Fix issues in test_add_python_opts (GH-148507) (#148545)
gh-148487: Fix issues in `test_add_python_opts` (GH-148507)
(cherry picked from commit 44f1b987ed)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-14 10:12:42 +00:00
Miss Islington (bot)
adb2a3ac51
[3.14] gh-148508: Add resilience to SSL preauth tests on iOS (GH-148536) (#148539)
Adds handling for a test case seen in the iOS SSL tests where an SSL connection fails to
handshake correctly.
(cherry picked from commit c40e8b016a)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-04-14 12:41:37 +08:00
Miss Islington (bot)
d42874a1ba
[3.14] gh-148370: prevent quadratic behavior in configparser.ParsingError.combine (GH-148452) (#148532)
gh-148370: prevent quadratic behavior in `configparser.ParsingError.combine` (GH-148452)
(cherry picked from commit 2662db0c45)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-04-13 22:59:47 +00:00
Miss Islington (bot)
592c68cf6b
[3.14] gh-146139: Disable socketpair authentication on WASI (GH-146140) (#148526)
gh-146139: Disable `socketpair` authentication on WASI (GH-146140)

Calling `connect(2)` on a non-blocking socket on WASI may leave the socket in a
"connecting" but not yet "connected" state.  In the former case, calling
`getpeername(2)` on it will fail, leading to an unhandled exception in Python.
(cherry picked from commit a5b76d53bb)

Co-authored-by: Joel Dice <joel.dice@akamai.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Brett Cannon <brett@python.org>
2026-04-13 21:34:06 +00:00
Miss Islington (bot)
0b9332bc05
[3.14] InternalDocs: Correct struct path for latin1 singletons in string_interning.md (GH-148358) (#148492)
(cherry picked from commit 0274d8304e)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-13 18:52:55 +00:00
Miss Islington (bot)
1fa52c3c84
[3.14] gh-148393: Use acquire load for _ma_watcher_tag in dict notify event (gh-148509) (#148512)
The watcher-bits read in _PyDict_NotifyEvent needs to use acquire to
synchronize with the release from PyDict_Watch so that the callback
publication is visible before the callback is invoked.
(cherry picked from commit 19f96f99fe)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-04-13 18:38:15 +00:00
Miss Islington (bot)
e74e59d42a
[3.14] Fix "encodings" typo in argparse.FileType documentation (GH-148502) (#148513)
Fix "encodings" typo in argparse.FileType documentation (GH-148502)
(cherry picked from commit 8ecb6b8b0c)

Co-authored-by: Gleb Popov <gvpopov.dev@gmail.com>
2026-04-13 11:33:28 -07:00
Miss Islington (bot)
6a5f79c8d7
[3.14] gh-148395: Fix a possible UAF in {LZMA,BZ2,_Zlib}Decompressor (GH-148396) (#148480)
gh-148395: Fix a possible UAF in `{LZMA,BZ2,_Zlib}Decompressor` (GH-148396)

Fix dangling input pointer after `MemoryError` in _lzma/_bz2/_ZlibDecompressor.decompress
(cherry picked from commit 8fc66aef6d)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-13 01:40:54 +00:00
Miss Islington (bot)
48c3c7fb73
[3.14] gh-146450: Ensure Android gradle build uses custom cross-build dir (GH-148319) (#148470)
Ensures that the testbed's Gradle configuration uses the cross-build environment
variable, and that variable is passed to Gradle by the cross-build script.
(cherry picked from commit b29afe62f7)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2026-04-13 09:13:49 +08:00
Miss Islington (bot)
82ab8fb666
[3.14] tests: use errno.EBADF instead of hardcoded number in _close_file() (GH-148345) (#148410)
tests: use errno.EBADF instead of hardcoded number in _close_file() (GH-148345)

test_interpreters: use errno.EBADF instead of hardcoded number in _close_file()

Replace the hardcoded `9` check in `Lib/test/test_interpreters/utils.py` with `errno.EBADF`.

Using `errno.EBADF` makes the helper portable across platforms with different errno numbering while preserving the intended behavior.
(cherry picked from commit cef334fd4c)

Co-authored-by: Artem Yarulin <artem.yarulin@kapteko.com>
2026-04-12 18:13:14 -07:00
Miss Islington (bot)
942d3024b3
[3.14] gh-105936: Properly update closure cells for __setattr__ and __delattr__ in frozen dataclasses with slots (GH-144021) (#148469)
gh-105936: Properly update closure cells for `__setattr__` and `__delattr__` in frozen dataclasses with slots (GH-144021)
(cherry picked from commit 8a398bfbbc)

Co-authored-by: Prometheus3375 <prometheus3375@gmail.com>
Co-authored-by: Sviataslau <35541026+Prometheus3375@users.noreply.github.com>
2026-04-12 21:45:43 +00:00
Miss Islington (bot)
7ecd85c032
[3.14] gh-146313: Fix multiprocessing ResourceTracker deadlock after os.fork() (GH-146316) (#148425)
gh-146313: Fix multiprocessing ResourceTracker deadlock after os.fork() (GH-146316)

`ResourceTracker.__del__` (added in gh-88887 circa Python 3.12) calls
os.waitpid(pid, 0) which blocks indefinitely if a process created via os.fork()
still holds the tracker pipe's write end. The tracker never sees EOF, never
exits, and the parent hangs at interpreter shutdown.

Fix with two layers:

- **At-fork handler.** An os.register_at_fork(after_in_child=...)
  handler closes the inherited pipe fd in the child unless a preserve
  flag is set. popen_fork.Popen._launch() sets the flag before its
  fork so mp.Process(fork) children keep the fd and reuse the parent's
  tracker (preserving gh-80849). Raw os.fork() children close the fd,
  letting the parent reap promptly.

- **Timeout safety-net.** _stop_locked() gains a wait_timeout
  parameter. When called from `__del__`, it polls with WNOHANG using
  exponential backoff for up to 1 second instead of blocking
  indefinitely. The at-fork handler makes this unreachable in
  well-behaved paths; it remains for abnormal shutdowns.
(cherry picked from commit 3a7df632c9)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Itamar Oren <itamarost@gmail.com>
2026-04-12 10:08:23 -07:00
Miss Islington (bot)
a89b2419e0
[3.14] gh-148393: Use atomic ops on _ma_watcher_tag in free threading build (gh-148397) (#148451)
Fixes data races between dict mutation and watch/unwatch on the same dict.
(cherry picked from commit 3ab94d6842)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-04-12 15:05:34 +00:00
Miss Islington (bot)
a9d122fb05
[3.14] gh-148208: Fix recursion depth leak in PyObject_Print (GH-148209) (#148412)
gh-148208: Fix recursion depth leak in `PyObject_Print` (GH-148209)
(cherry picked from commit e2fa10e04d)

Co-authored-by: Wulian233 <1055917385@qq.com>
2026-04-12 00:52:21 +00:00
Miss Islington (bot)
a4f9bbf5b8
[3.14] gh-147965: Add shutdown() to multiprocessing.Queue excluded methods (GH-147970) (#148416)
gh-147965: Add shutdown() to multiprocessing.Queue excluded methods (GH-147970)

The multiprocessing.Queue documentation states it implements all
methods of queue.Queue except task_done() and join(). Since
queue.Queue.shutdown() was added in Python 3.13,
multiprocessing.Queue also does not implement it. Update the docs
to include shutdown() in the list of excluded methods.
(cherry picked from commit 22290ed011)

Co-authored-by: WYSIATI <chester.lee.cold@gmail.com>
2026-04-12 00:51:58 +00:00
Miss Islington (bot)
47b916e213
[3.14] gh-148337: Document importlib.resources security model (GH-148340) (#148356)
gh-148337: Document `importlib.resources` security model (GH-148340)
(cherry picked from commit 70b86e7829)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-11 17:10:41 -07:00
Hugo van Kemenade
838c602828
[3.14] Default GHA permissions to contents: read (GH-148346) (#148386)
(cherry picked from commit 9c9df8ac8c)
2026-04-11 17:06:34 -07:00
Miss Islington (bot)
af2f5189a1
[3.14] gh-146333: Fix quadratic regex backtracking in configparser option parsing (GH-146399) (#148287)
gh-146333: Fix quadratic regex backtracking in configparser option parsing (GH-146399)

Use negative lookahead in option regex to prevent backtracking, and to avoid changing logic outside the regexes (since people could use the regex directly).
(cherry picked from commit 7e0a0be409)

Co-authored-by: Joshua Swanson <22283299+joshuaswanson@users.noreply.github.com>
2026-04-12 00:05:10 +00:00
Miss Islington (bot)
4f8a77bf3f
[3.14] gh-145105: Fix crash in csv.reader with re-entrant iterator (GH-145106) (#148404)
gh-145105: Fix crash in csv.reader with re-entrant iterator (GH-145106)

When a custom iterator calls next() on the same csv.reader from
within __next__, the inner iteration sets self->fields to NULL.
The outer iteration then crashes in parse_save_field() by passing
NULL to PyList_Append.

Add a guard after PyIter_Next() to detect that fields was set to
NULL by a re-entrant call, and raise csv.Error instead of crashing.
(cherry picked from commit 20994b1809)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
2026-04-11 22:46:26 +00:00
Miss Islington (bot)
d6be9fb077
[3.14] gh-146264: Use static HACL deps for static module builds (GH-146265) (#148403)
gh-146264: Use static HACL deps for static module builds (GH-146265)
(cherry picked from commit f445d2e866)

Co-authored-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2026-04-11 21:54:29 +00:00
Kumar Aditya
6112e2dd44
[3.14] gh-142518: add thread safety docs for dict and set APIs (#148392)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-11 21:52:38 +05:30
Miss Islington (bot)
620fb74384
[3.14] gh-148320: document that import sys.monitoring raises ModuleNotFoundError (GH-148365) (#148385)
gh-148320: document that `import sys.monitoring` raises `ModuleNotFoundError` (GH-148365)
(cherry picked from commit d7c9f1877c)

Co-authored-by: Jonathan Dung <jonathandung@yahoo.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-04-11 15:30:24 +00:00
Kumar Aditya
f36da66c71
[3.14] gh-148037: remove critical section from PyCode_Addr2Line (GH… (#148353)
[3.14] gh-148037: remove critical section from `PyCode_Addr2Line` (GH-148103)
(cherry picked from commit d3b7b93cbb)
2026-04-10 23:59:38 +05:30
Miss Islington (bot)
288cbacfb9
[3.14] gh-148284: Block inlining of gigantic functions in ceval.c for clang 22 (GH-148334) (GH-148349)
gh-148284: Block inlining of gigantic functions in ceval.c for clang 22 (GH-148334)
(cherry picked from commit e007631e99)

Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-11 01:32:26 +08:00
Hugo van Kemenade
429c1d3c19
[3.14] Fix mixed line endings with pre-commit (GH-148336) (#148338)
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2026-04-10 18:36:12 +03:00
Miss Islington (bot)
e8f3f7668f
[3.14] gh-145831: email.quoprimime: decode() leaves stray \r when eol='\r\n' (GH-145832) (#148312)
decoded[:-1] only strips one character, leaving a stray \r when eol
is two characters. Fix: decoded[:-len(eol)].
(cherry picked from commit 1a0edb1fa8)

Co-authored-by: Stefan Zetzsche <120379523+stefanzetzsche@users.noreply.github.com>
2026-04-10 08:49:59 -04:00
Miss Islington (bot)
b87590fd27
[3.14] gh-148091: clarify asyncio.Future.cancel(msg) behaviour (GH-148248) (#148299)
gh-148091: clarify asyncio.Future.cancel(msg) behaviour (GH-148248)
(cherry picked from commit 2acb8d9257)

Co-authored-by: Manoj K M <136242596+manoj-k-m@users.noreply.github.com>
2026-04-09 20:51:16 +05:30
Hugo van Kemenade
1f177749c5
[3.14] gh-148254: Use singular "sec" in timeit verbose output (GH-148290) (#148303)
Co-authored-by: gaweng <38250674+gaweng@users.noreply.github.com>
2026-04-09 15:17:55 +00:00
Miss Islington (bot)
1a3c03c3c9
[3.14] gh-148067: Fix typo in asyncio event loop docs: 'signals' -> 'signal' (GH-148073) (#148246)
Co-authored-by: TT <70463940+Herrtian@users.noreply.github.com>
2026-04-09 14:07:55 +00:00
Miss Islington (bot)
bb78ec8fa8
[3.14] gh-148274: properly handle result from PyObject_VisitManagedDict (GH-148275) (#148295)
gh-148274: properly handle result from `PyObject_VisitManagedDict` (GH-148275)
(cherry picked from commit ee2775cfae)

Co-authored-by: Max Bachmann <kontakt@maxbachmann.de>
2026-04-09 13:49:09 +00:00
Miss Islington (bot)
571c337a5d
[3.14] gh-106318: Add example for str.swapcase() method (GH-144575) (#148296)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
2026-04-09 13:39:39 +00:00
Miss Islington (bot)
88fc1e6003
[3.14] gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (GH-148251) (#148293)
gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (GH-148251)
(cherry picked from commit 8c524503cd)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-09 11:59:06 +00:00
Miss Islington (bot)
d31a16e662
[3.14] gh-146646: Document that glob functions suppress OSError (GH-147996) (#148288)
gh-146646: Document that glob functions suppress OSError (GH-147996)
(cherry picked from commit 8000a9de3c)

Co-authored-by: WYSIATI <chester.lee.cold@gmail.com>
2026-04-09 11:00:23 +00:00
Miss Islington (bot)
f46a17b19f
[3.14] gh-70039: smtplib: store the server name in ._host in .connect() (GH-115259) (#148273)
Original patch by gigaplastik, extended with a few more tests.

Addresses gh-70039 and bpo-25852: failure of starttls if connect is called explicitly.
(cherry picked from commit 442f83a5ea)

Co-authored-by: nmartensen <nis.martensen@web.de>
2026-04-08 18:14:15 -04:00