Commit graph

30663 commits

Author SHA1 Message Date
sobolevn
f74dbc82fe
[3.13] gh-105895: Add match and case doc to help() (GH-152113) (#152128)
(cherry picked from commit 1d55b3778c)

Co-authored-by: dzherb <zherbin.dima@yandex.ru>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-24 22:05:05 +00:00
Jelle Zijlstra
d43f47bdca
[3.13] gh-151955: Allow more ParamSpec bounds (#152122)
gh-151955: Allow more ParamSpec and TypeVarTuple bounds (#151956)

(cherry picked from commit 0fb82b46df)
2026-06-24 20:08:56 +00:00
Miss Islington (bot)
f5ff45a386
[3.13] valgrind-python.supp: Update suppression for readline leaks (GH-151783) (#152086)
`valgrind-python.supp`: Update suppression for readline leaks (GH-151783)
(cherry picked from commit 28b63d301d)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-24 16:02:51 +02:00
Miss Islington (bot)
36fd455ab6
[3.13] gh-151814: Fix unbounded memory growth from repeated empty writes to io.TextIOWrapper (GH-151817) (#152073)
(cherry picked from commit c61307222e)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-24 12:19:03 +00:00
Prakash Sellathurai
117b76a190
[3.13] gh-151905: fix memory error handling in PyFrame_GetBack (GH-151906) (#152065)
[3.13] gh-151905: fix memory error handling in PyFrame_GetBack
(pythonGH-151906)

Signed-off-by: Prakash Sellathurai <prakashsellathurai@gmail.com>
2026-06-24 11:40:07 +00:00
Miss Islington (bot)
aaf850fd33
[3.13] gh-143927: Normalize all line endings (CR, CRLF, and LF) in configparser (GH-143929) (GH-152004)
(cherry picked from commit 5858e42c53)

Co-authored-by: Seth Larson <seth@python.org>
2026-06-24 11:46:43 +02:00
Miss Islington (bot)
b83961ade8
[3.13] gh-151497: Avoid huge pre-allocation for oversized tarfile extended headers (GH-151498) (GH-151978)
tarfile reads a member's extended header (a GNU long name/link or a pax
header) with a single read sized by the header's size field:

    buf = tarfile.fileobj.read(self._block(self.size))

The size is taken from the archive and is not validated, so a ~512-byte
crafted file can claim several gigabytes (or, via base-256 encoding, far
more) and make read() pre-allocate that much memory -- on open/iterate,
before any extraction filter runs.

Read the extended-header data in bounded chunks instead, so an oversized
or truncated header can no longer force a huge allocation. The bytes
returned for valid archives are unchanged.
(cherry picked from commit da99711d37)

Co-authored-by: Shardul Deshpande <iamsharduld@users.noreply.github.com>
2026-06-24 11:23:45 +02:00
Miss Islington (bot)
32546b728e
[3.13] gh-126219: Fix crash in tkinter.Tk with non-BMP className on Tcl/Tk 8.x (GH-151980) (GH-152047)
Tcl 8.x crashes when title-casing a non-BMP character during Tk
initialization, so such a className is now rejected with a ValueError.
(cherry picked from commit 124c7cd91b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 09:31:24 +03:00
Miss Islington (bot)
0ba3fcdf2f
[3.13] gh-151596: Add missing argument 'size' to pure-Python implementation of TextIOBase.readline (GH-151679) (GH-151872)
(cherry picked from commit 30aeeb375b)

Co-authored-by: saber-bit <bryanventura0324@gmail.com>
2026-06-23 12:41:37 -04:00
Miss Islington (bot)
abf5016b4d
[3.13] gh-151126: Add missing PyErr_NoMemory() in type_from_slots_or_spec (GH-151582)
(cherry picked from commit 7928a8b730)

Co-authored-by: Ivy Xu <fakeshadow1337@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-23 15:12:29 +00:00
Miss Islington (bot)
a1f31af280
[3.13] gh-151773: Fix NULL dereference in PyContextVar_Set (GH-151836) (#152011)
gh-151773: Fix NULL dereference in `PyContextVar_Set` (GH-151836)
(cherry picked from commit d35b1719a5)

Co-authored-by: dev <b.chouksey27@gmail.com>
2026-06-23 14:39:29 +00:00
Miss Islington (bot)
771d12dda5
[3.13] gh-151558: Fix symlink escape via tarfile hardlink-extraction fallback (GH-151559)
(cherry picked from commit 27dd970bf6)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-23 13:56:51 +00:00
Miss Islington (bot)
3f031d431f
[3.13] gh-151981: Make tarfile._Stream.seek break at EOF (GH-151982) (#151993)
(cherry picked from commit f50bf13566)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-23 14:46:38 +01:00
Steve Dower
16c40f944b
gh-151544: Fixes CVE-2026-12003 by removing the fallback to %VPATH%/Modules/Setup.local for discovering sources in getpath.py (GH-151928) 2026-06-22 17:31:25 +01:00
Miss Islington (bot)
bae0ba9ec7
[3.13] gh-150484: Fix mock_open __exit__ with contextlib.ExitStack (GH-151829) (GH-151861)
mock_open's _exit_side_effect had a fixed 3-arg signature, but
  contextlib.ExitStack calls __exit__ with 4 args (self + 3 exc info).
  Use *args to accept any number of arguments.
(cherry picked from commit 85fa295073)

Co-authored-by: Zang Peiyu <166481866+factnn@users.noreply.github.com>
2026-06-21 17:02:30 +00:00
Serhiy Storchaka
e514b4a279
[3.13] gh-151695: Fix use-after-free of the curses screen encoding (GH-151696) (GH-151706) (GH-151723)
The module-global screen_encoding stored a borrowed pointer to the
encoding owned by the window returned by the first initscr() call.  That
window can be deallocated while unctrl() and ungetch(), which have no window
of their own, still use the pointer to encode non-ASCII characters.

Keep a private copy of the encoding instead.
(cherry picked from commit 551f8e16f8)
(cherry picked from commit 7b55e9a93e)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 10:30:35 +00:00
Miss Islington (bot)
423f620f31
[3.13] gh-101100: Document os.uname_result and os.statvfs_result with related constants (GH-151301) (GH-151691)
(cherry picked from commit 9688d252d3)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2026-06-19 08:42:41 +00:00
Serhiy Storchaka
33b9f75c58
[3.13] gh-86726: Document the full public API of tkinter (GH-151579) (GH-151650) (GH-151653)
Replace the previously sparse reference documentation with full coverage of
the public API of the tkinter package, written from the Tcl/Tk manual pages,
the existing documentation and the module docstrings.

* Doc/library/tkinter.rst gains a "Reference" section documenting every public
  class, method, function and constant of the core module -- the widgets, the
  Misc, Wm, Pack, Place, Grid, XView and YView mix-ins, the Variable and image
  classes, the module-level functions and the symbolic constants.
* Doc/library/tkinter.ttk.rst, dialog.rst, tkinter.font.rst and the other
  module pages document their remaining classes, methods and functions.

The descriptions are Python-oriented (correct return types -- tuples rather
than Tcl lists, booleans, integers, None on cancellation, and so on) and were
checked against the Tcl/Tk 9.1 manual pages and the implementation.

versionadded, versionchanged and deprecated directives are added for the
public API, determined from the git history relative to Python 3.0: the
tkinter.ttk module (3.1); the Text, Wm, Menu and Misc methods exposing Tk 8.5
features (3.3); and the many later additions and behavior changes up to 3.15.
The Tk version required by features added after Tk 8.6 is noted as well.  The
bundled Tcl/Tk version is updated to 9.0 and the manual-page links point at
the tcl9.0 reference.

--------
(cherry picked from commit 8b270b72a2)





* gh-86726: Adjust tkinter docs for the 3.14 backport

Remove documentation of API added only in 3.15 (the grid_content/
pack_content/place_content aliases, Text.search_all, the search
nolinestop/strictlimits parameters and Event.user_data/detail), date the
wm_attributes positional-argument deprecation to 3.13, and update the
bundled Tcl/Tk version to 8.6.



---------
(cherry picked from commit 1141d294ee)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-06-18 13:32:37 +00:00
Miss Islington (bot)
2ca9dae148
[3.13] gh-120665: make unittest loaders avoid loading test cases that are abstract base classes (GH-120666) (#151599)
gh-120665: make unittest loaders avoid loading test cases that are abstract base classes (GH-120666)
(cherry picked from commit 5ad3c6dfbf)

Co-authored-by: blhsing <blhsing@gmail.com>
2026-06-17 11:49:23 -04:00
Miss Islington (bot)
502534ed0b
[3.13] gh-148441: Avoid integer overflow in Expat's CharacterDataHandler (GH-148904) (#149637)
* gh-148441: Avoid integer overflow in Expat's CharacterDataHandler (GH-148904)
(cherry picked from commit bc1be4f617)

Co-authored-by: ByteFlow <fakeshadow1337@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Apply suggestion from @picnixz

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

---------

Co-authored-by: ByteFlow <fakeshadow1337@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-15 15:52:47 +02:00
Miss Islington (bot)
5810def6dd
[3.13] gh-151403: Fix use-after-free when an argv item's __fspath__ mutates args (GH-151404) (#151447)
gh-151403: Fix use-after-free when an argv item's __fspath__ mutates args (GH-151404)

---------
(cherry picked from commit 6679ac07d8)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
Co-authored-by: tonghuaroot <23011166+tonghuaroot@users.noreply.github.com>
2026-06-13 14:33:13 -07:00
Miss Islington (bot)
c606d1518c
[3.13] gh-101267: ProcessPoolExecutor no longer shares 1 BrokenProcessPool exception among all failed futures (GH-101268) (GH-151431) (#151435)
[3.14] gh-101267: ProcessPoolExecutor no longer shares 1 BrokenProcessPool exception among all failed futures (GH-101268) (GH-151431)

* gh-101267: ProcessPoolExecutor no longer shares 1 BrokenProcessPool exception among all failed futures (GH-101268)
(cherry picked from commit 3c00ebc2bb)




(cherry picked from commit 4e8c9c6a57)

* Drop the abrupt-exit-code reporting from the 3.14 backport

Reporting the exit codes of processes that died without a known cause
is a new feature, not part of the gh-101267 bugfix. Keep only the
bugfix on 3.14: each failed future gets its own BrokenProcessPool
exception instead of one shared instance.

---------
(cherry picked from commit 27ff2c8c53)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Daniel Shields <daniel.shields@twosigma.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-06-13 02:37:19 -07:00
Miss Islington (bot)
7c3f0bd9b0
[3.13] gh-151126: Fix crash on unset memory error in ctypes.get_errno (GH-151382) (#151400)
gh-151126: Fix crash on unset memory error in `ctypes.get_errno` (GH-151382)
(cherry picked from commit 6b217ea90b)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-12 11:27:19 +00:00
Miss Islington (bot)
8754abc358
[3.13] gh-151065: Copy fix for memory leak from mimalloc upstream (GH-151066) (GH-151385)
Applies d7a72c4912 to our copy of mimalloc.
(cherry picked from commit 80f9467434)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-06-11 21:18:14 -04:00
Miss Islington (bot)
e812fe9bc4
[3.13] gh-151337: Avoid possible memory leak in _tkinter.c on Windows. (GH-151340) (GH-151381)
(cherry picked from commit 71805db429)

Co-authored-by: Ivy Xu <fakeshadow1337@gmail.com>
2026-06-11 20:13:33 +00:00
Miss Islington (bot)
5a92c742e6
[3.13] gh-151126: Fix missing memory error in os._path_splitroot (GH-151339) (#151362)
gh-151126: Fix missing memory error in `os._path_splitroot` (GH-151339)
(cherry picked from commit 10595b1cb7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-11 16:43:15 +00:00
sobolevn
1d74300f9f
[3.13] gh-151126: Fix missing memory errors in _interpchannelsmodule.c (GH-151239) (#151338)
(cherry picked from commit 9fd1a125bc)
2026-06-11 13:31:10 +00:00
Hugo van Kemenade
06dce35b5a
[3.13] gh-130796: Undeprecate locale.getdefaultlocale() (GH-143069) (#151318)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-11 14:34:40 +03:00
Miss Islington (bot)
5c17ae6c1c
[3.13] gh-151295: Fix use-after-free in bytes.join()/bytearray.join() via re-entrant __buffer__ (GH-151296) (GH-151306)
(cherry picked from commit 84a322aa15)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
2026-06-11 11:30:49 +03:00
Victor Stinner
db9e7556c3
[3.13] gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250) (#151269) (#151283) (#151287)
[3.14][3.15] gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250) (#151269) (#151283)

[3.15] gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250) (#151269)

gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250)

If "import encodings" fails at Python startup, dump the Python path
configuration to help users debugging their configuration. The
encodings module is the first module imported during Python startup.

(cherry picked from commit 7b6e98911e)
(cherry picked from commit 10f616cf39)
(cherry picked from commit b3a7758d8a)
2026-06-10 23:24:46 +02:00
Ned Deily
8068f718bb
[3.13] Move blurb entry to correct section. (#151270) 2026-06-10 13:29:20 -04:00
Victor Stinner
87b9729522
[3.13][3.14] gh-143988: Fix re-entrant mutation crashes in socket sendmsg/recvmsg_into (#143987) (#151251) (#151256)
[3.14] gh-143988: Fix re-entrant mutation crashes in socket sendmsg/recvmsg_into (#143987) (#151251)

gh-143988: Fix re-entrant mutation crashes in socket sendmsg/recvmsg_into (#143987)

Fix crashes in socket.sendmsg() and socket.recvmsg_into() that could
occur if buffer sequences are mutated re-entrantly during argument
parsing via __buffer__ protocol callbacks.

The bug occurs because:

1. PySequence_Fast() returns the original list object when the input
   is already a list (not a copy).
2. During iteration, PyObject_GetBuffer() triggers __buffer__
   callbacks which may clear the list.
3. Subsequent iterations access invalid memory (heap OOB read).

The fix replaces PySequence_Fast() with PySequence_Tuple() which
always creates a new tuple, ensuring the sequence cannot be mutated
during iteration.

(cherry picked from commit 896f7fdc7d)



(cherry picked from commit 632daaf5e9)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
Co-authored-by: tonghuaroot <23011166+tonghuaroot@users.noreply.github.com>
2026-06-10 19:04:04 +02:00
Harjoth Khara
4866da0802
[3.13] gh-109940: Respect VIRTUAL_ENV_DISABLE_PROMPT in activate.bat (GH-151215) (GH-151263) 2026-06-10 17:49:45 +01:00
Thomas Wouters
3a04c62e38 Merge branch '3.13' of https://github.com/python/cpython into 3.13 2026-06-10 18:01:42 +02:00
Miss Islington (bot)
a1f9bd2346
[3.13] gh-150988: Fix refleak in OSError when attrs are set before super().__init__() (GH-150990) (#151242)
gh-150988: Fix refleak in `OSError` when attrs are set before `super().__init__()` (GH-150990)
(cherry picked from commit f2a0f82282)

Co-authored-by: Lukas Geiger <lukas.geiger94@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-10 12:51:12 +00:00
Thomas Wouters
fd17997c38 Python 3.13.14 2026-06-10 14:24:04 +02:00
Victor Stinner
c40e6d6ebb
[3.13][3.15] gh-143008: Fix race re-initializing TextIOWrapper (#151203) (#151227)
[3.15] gh-143008: Fix race re-initializing TextIOWrapper (#151203)

__init__() changes multiple variables and may be called more than once
from multiple threads.

(cherry picked from commit 0318867acf)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2026-06-10 09:40:14 +00:00
Serhiy Storchaka
52ffdeda1d
[3.13] gh-151130: Add more tests for PyWeakref_* C API (GH-151131) (GH-151141) (#151148)
(cherry picked from commit cb96d5ea4a)


(cherry picked from commit c3cd75afdf)
2026-06-09 22:24:39 +02:00
Petr Viktorin
743482a87e
[3.13] gh-149231: tomllib: Limit the number of parts in a key (GH-149233) (GH-149815) (#149848)
[3.14] gh-149231: tomllib: Limit the number of parts in a key (GH-149233) (GH-149815)

(cherry picked from commit bc7c102f34)
(cherry picked from commit 724a5e5e3b)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-09 22:20:07 +02:00
Miss Islington (bot)
310125eb9d
[3.13] gh-151112: Fix double free in assemble_init when out of memory (GH-151142) (#151207)
gh-151112: Fix double free in `assemble_init` when out of memory (GH-151142)
(cherry picked from commit 580499177c)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-09 21:13:40 +01:00
Zachary Ware
7d530aa588
[3.13] gh-151159: Bump OpenSSL version for Android (GH-151200) 2026-06-09 13:21:33 -05:00
Ned Deily
4a3d64eef0
[3.13] gh-151159: Update macOS installer to use OpenSSL 3.0.21. (#151195) 2026-06-09 13:40:05 -04:00
Zachary Ware
09c00dbfc3
[3.13] gh-151159: Update Windows builds to use OpenSSL 3.0.21 (GH-151191) 2026-06-09 17:39:56 +00:00
Miss Islington (bot)
04884519ce
[3.13] gh-151126: Add missing PyErr_NoMemory in _winapi module (GH-151154) (#151182)
gh-151126: Add missing `PyErr_NoMemory` in `_winapi` module (GH-151154)
(cherry picked from commit 8d94fa7b86)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-09 17:07:51 +00:00
Stan Ulbrych
fc9b11ff49
[3.13] gh-149018: Use XML_SetHashSalt16Bytes in pyexpat/_elementtree when possible (GH-149023)
(cherry picked from commit 24b8f12544)
2026-06-09 14:45:59 +00:00
Stan Ulbrych
19bc39127e
[3.13] gh-90949: expose Expat API to tune exponential expansion protections (GH-139368)
Expose the XML Expat 2.7.2 APIs to tune protections against
"billion laughs" [1] attacks.

The exposed APIs are available on Expat parsers, that is,
parsers created by `xml.parsers.expat.ParserCreate()`, as:

- `parser.SetBillionLaughsAttackProtectionActivationThreshold(threshold)`, and
- `parser.SetBillionLaughsAttackProtectionMaximumAmplification(max_factor)`.

This completes the work in f04bea44c3,
and improves the existing related documentation.

[1]: https://en.wikipedia.org/wiki/Billion_laughs_attack
(cherry picked from commit 666112376d)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-06-09 15:23:22 +01:00
Miss Islington (bot)
c68571c4bf
[3.13] gh-109503: Fix document for shutil.move() on usage of os.rename() since it's inaccurate (GH-109507) (GH-150613)
Nonatomic move might be used even if the files are
on the same filesystem in some cases.
(cherry picked from commit 6ecd197c03)

Co-authored-by: Fang Li <fangli@users.noreply.github.com>
2026-06-09 16:06:55 +03:00
Miss Islington (bot)
140af0fd14
[3.13] gh-151126: Fix missing PyErr_NoMemory() in remove_unused_consts (GH-151127) (#151136)
gh-151126: Fix missing `PyErr_NoMemory()` in `remove_unused_consts` (GH-151127)
(cherry picked from commit 3186547c1e)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-09 10:27:34 +00:00
Ned Deily
c51354e062
[3.13] gh-124111: Update macOS installer to use Tcl/Tk 8.6.18. (#151125) 2026-06-09 01:55:30 -04:00
Miss Islington (bot)
7372a146ac
[3.13] gh-115119: Update macOS installer to use libmpdecimal 4.0.1. (GH-140077) (#151124)
(cherry picked from commit 8e0bf4fe5d)
Co-authored-by: Ned Deily <nad@python.org>
2026-06-09 05:37:44 +00:00