Commit graph

126005 commits

Author SHA1 Message Date
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)
b836d40269
[3.13] gh-151693: Add curses tests for panels, textpad, and window behavior (GH-151694) (GH-151721)
Add curses tests for panels, textpad, and window behavior

Extend test_curses with behavior-verifying tests that go beyond the
existing smoke tests:

* curses.panel stacking: new_panel/top/bottom/above/below ordering,
  hide/show/hidden, move, replace and userptr round-trip.
* Real-window curses.textpad.Textbox: gather(), edit(), stripspaces,
  insert mode and the Emacs-like editing commands (previously only
  exercised through a MagicMock).
* Window output: addstr cursor advance and addnstr truncation,
  insstr/insnstr shifting without cursor movement, and pad behavior
  (instr, subpad cell sharing, the required 6-argument refresh()).
* Error handling: out-of-range coordinates raising curses.error and
  bad character/string argument types.
(cherry picked from commit b4cfb992ed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 10:17:22 +00:00
Miss Islington (bot)
8650126189
[3.13] gh-151678: Add tests for tkinter.Text (GH-151681) (GH-151705) (GH-151715)
Cover previously-untested Text methods (indices, content, marks, tags,
undo/redo, dump, embedded images and windows, peers, and geometry) and
the tag, embedded-image and embedded-window configuration options.
(cherry picked from commit 4ac809e10b)
(cherry picked from commit 22c000eeb4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 09:28:36 +00:00
Miss Islington (bot)
6e356cc4a7
[3.13] gh-151678: Add tests for tkinter.Listbox (GH-151686) (GH-151714)
Cover previously-untested Listbox methods in ListboxTest: size, delete,
index resolution, nearest, see, activate, and the selection methods
(selection_set/clear/includes/anchor and their select_* aliases),
including the errors raised for invalid indices.
(cherry picked from commit cf3b3c1148)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 09:27:30 +00:00
Miss Islington (bot)
c0c9920560
[3.13] gh-151678: Add tests for tkinter.Menu (GH-151685) (GH-151711)
Cover previously-untested Menu methods in MenuTest: adding, inserting and
deleting items of every type, index resolution, invoking items, entry x/y
positions, and post/unpost/tk_popup mapping.

Also test per-entry configuration options and the errors raised for
invalid indices, entry types, option names and option values.
(cherry picked from commit ef5c32a40b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 09:23:43 +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
Miss Islington (bot)
e87e0ad27d
[3.13] gh-151427: add 'not macOS' and 'not iOS' restrictions on availability state of some functions in os module. (GH-151537) (#151697)
(cherry picked from commit da69fcf98d)
Co-authored-by: Duprat <yduprat@gmail.com>
2026-06-19 08:17:02 +00:00
Serhiy Storchaka
aae671d484
[3.13] gh-86726: Fix the documented return type of tkinter info_patchlevel() (GH-151655) (GH-151660)
It returns a sys.version_info-like named tuple, not a string.
(cherry picked from commit 3cd02a1c2d)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 14:44:23 +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
Hugo van Kemenade
f57b80cd2e
[3.13] gh-151623: Improve curses documentation style (GH-151635) (#151638) 2026-06-18 10:10:37 +00:00
Serhiy Storchaka
805830831f
[3.13] gh-151623: Improve curses documentation and docstrings (GH-151625) (GH-151629) (GH-151630)
(cherry picked from commit 015cc42bc2)

Fix errors and clarify the curses, curses.panel and curses.ascii docs
against X/Open Curses and ncurses, and sync the affected docstrings.
(cherry picked from commit 65afcdd8df)
2026-06-18 09:51:51 +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)
733411a219
[3.13] gh-151519: Check effective gid in _test_all_chown_common group-0 guard (GH-151521) (#151551)
gh-151519: Check effective gid in `_test_all_chown_common` group-0 guard (GH-151521)

The guard that skips the "chown to gid 0 should fail" assertion used
only `os.getgroups()` (supplementary groups). The kernel also accepts
the effective/filesystem gid for chown, so when a process runs with
egid 0 and a non-zero uid (common in containers and user namespaces),
chown(-1, 0) succeeds and the assertion spuriously fails.

Add an `os.getegid() != 0` check alongside the existing
`0 not in os.getgroups()` guard.
(cherry picked from commit 2ce260033b)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
2026-06-16 09:42:16 -07:00
Miss Islington (bot)
c8e60d5897
[3.13] gh-151522: Guard against None transport in slow-socket SSL test (GH-151523) (#151530)
gh-151522: Guard against None transport in slow-socket SSL test (GH-151523)
(cherry picked from commit 11f032f904)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
2026-06-15 22:54:53 -07: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)
ffa440acb4
[3.13] gh-150389: Make perf profiler tests resilient (GH-150437) (GH-151501) (#151503)
[3.14] gh-150389: Make perf profiler tests resilient (GH-150437) (GH-151501)

gh-150389: Make perf profiler tests resilient (GH-150437)

(cherry picked from commit 638754cb85)
(cherry picked from commit d06b473f8f)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2026-06-15 13:39:52 +00:00
Miss Islington (bot)
6c88cb99e1
[3.13] Add .toml to .editorconfig (GH-151481) (#151493)
Add `.toml` to `.editorconfig` (GH-151481)
(cherry picked from commit 7a70afa199)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-15 09:40:58 +00:00
Miss Islington (bot)
fa8bf7df09
[3.13] gh-139837: Document attributes of objects recorded by warnings.catch_warnings (GH-139893) (GH-151473) (#151494)
[3.14] gh-139837: Document attributes of objects recorded by warnings.catch_warnings (GH-139893) (GH-151473)

* gh-139837: Document attributes of objects recorded by warnings.catch_warnings (GH-139893)
(cherry picked from commit 47b7dc788c)




* Apply suggestions from code review



---------
(cherry picked from commit eb612f4571)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-06-15 09:30:46 +00:00
Hugo van Kemenade
6971e05978
[3.13] Add a new Sphinx soft-deprecated directive (GH-148630) (#148715)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-14 19:08:04 +03: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)
348622a96d
[3.13] gh-151443: Fix documented default of unittest.mock.mock_open's read_data parameter (GH-151444)
(cherry picked from commit 9ad6ba0324)

Co-authored-by: Shardul Deshpande <iamsharduld@users.noreply.github.com>
2026-06-13 18:37:47 +00:00
Stan Ulbrych
9cbbb07990
[3.13] gh-77328: Update base64 module RFC references to RFC 4648 (GH-151275) (#151441)
(cherry picked from commit e933987688)
2026-06-13 13:27:27 +00: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)
52ee4d8e8d
[3.13] Docs: Fix method directive signatures in enum docs (GH-151429) (#151433)
(cherry picked from commit 5b38519762)

Co-authored-by: Jonathan Dung <jonathandung@yahoo.com>
2026-06-13 08:55:39 +00:00
Miss Islington (bot)
a1d247f357
[3.13] Fix typos in the curses.ascii module documentation (GH-129300) (#151415)
(cherry picked from commit f4f102027a)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-12 16:09:38 +00:00
Hugo van Kemenade
ebc2a625ad
[3.13] Docs: avoid repetitions of class references in functions.rst (GH-150891) (#151407)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
2026-06-12 18:04:54 +03: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)
5bc20725e2
[3.13] gh-138991: Update dataclass documentation for new eq behavior in Python 3.13 (GH-139007) (#151374)
gh-138991: Update dataclass documentation for new eq behavior in Python 3.13 (GH-139007)

And add tests.
(cherry picked from commit 402668b2b1)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-11 17:39:04 +00:00
Miss Islington (bot)
c4f3d8c343
[3.13] gh-150285: Fix too long docstrings in GenericAlias and __class_getitem__ (GH-151354) (GH-151369)
(cherry picked from commit 65047f2e2f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-06-11 17:11:49 +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
Miss Islington (bot)
bba688665f
[3.13] gh-101100: Fix Sphinx nitpick in unittest.mock.rst (GH-151302)
(cherry picked from commit b18168cb32)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2026-06-11 16:38:41 +01:00
Miss Islington (bot)
8b20bedaf5
[3.13] gh-150285: Suppress showing the __getstate__() comment in the help for dataclasses (GH-151328) (GH-151333)
(cherry picked from commit 0066fd73a2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-06-11 18:02:38 +03: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)
003db2ffd0
[3.13] gh-151284: Fix test_capi on UBSan (GH-151286) (#151325)
gh-151284: Fix test_capi on UBSan (GH-151286)

Comment two checks relying on undefined behavior in
test_fromwidechar() of test_capi.

Enable test_capi in GitHub Action "Reusable Sanitizer".
(cherry picked from commit d87d772873)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-11 11:19:54 +00:00
Serhiy Storchaka
f1c8176636
[3.13] gh-150285: Fix merging error in GH-150458 (GH-151320) 2026-06-11 14:06:27 +03:00
Miss Islington (bot)
807333df72
[3.13] gh-151112: Move an assert that may fail in cfg_builder_check (GH-151153) (#151315)
(cherry picked from commit 2d3381035d)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-11 09:40:49 +00: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
Miss Islington (bot)
d5468ba70b
[3.13] gh-136880: Add warning about PYTHONPATH (GH-151098) (GH-151298)
(cherry picked from commit 84630e2cb9)
2026-06-11 07:38:47 +01: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
Victor Stinner
fd0839de33
[3.13][3.14] GHA: Display output when a sanitizer test fails (#151268) (#151273) (#151280)
[3.14] GHA: Display output when a sanitizer test fails (#151268) (#151273)

GHA: Display output when a sanitizer test fails (#151268)

Modify GitHub Action "Reusable Sanitizer" to display output when a
test fails: pass -W option.

(cherry picked from commit 3a8bebd86f)
(cherry picked from commit bc75e47ffa)
2026-06-10 21:25:15 +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
Victor Stinner
a1f43ef9d9
[3.13][3.14] gh-89554: Document socket.SocketType as a class (#150683) (#151245) (#151254)
[3.14] gh-89554: Document socket.SocketType as a class (#150683) (#151245)

gh-89554: Document socket.SocketType as a class (#150683)

socket.SocketType is a class (re-exported from _socket as an alias of
_socket.socket, the base class of socket.socket), but was documented with
the ".. data::" directive, so ":class:" cross-references to it cannot
resolve against a py:class target.

Switch the entry to ".. class::", correct the misleading description
(SocketType is the base class of the socket type, not "type(socket(...))"
which is socket.socket; addresses gh-88427), move it into the Socket
Objects section, and document the socket object methods and attributes
nested under the socket class, dropping the redundant "socket." prefix.

Backport to 3.13: Replace ":platform: Windows" with
".. availability:: Windows" in ioctl() method.

(cherry picked from commit a621e8ad81)


(cherry picked from commit 4ef6a375a1)

Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
2026-06-10 19:02:34 +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
Thomas Wouters
d3e29c1157 Post 3.13.14 2026-06-10 18:01:10 +02:00
Miss Islington (bot)
60123e619a
[3.13] Docs: Fix typos in the "Memory Management" section (GH-151243)
(cherry picked from commit 8c0e2515bb)

Co-authored-by: Manoj K M <manojkm24dev@gmail.com>
2026-06-10 13:20:03 +00:00