Commit graph

14456 commits

Author SHA1 Message Date
Miss Islington (bot)
6aa7fa0625
[3.13] gh-138659: Typo in the gc module docstring (GH-138660) (#138663)
gh-138659: Typo in the gc module docstring (GH-138660)

docs(gc): fix typo in get_threshold() docstring

Removes a duplicate "the" from the docstring for the `gc.get_threshold()` function.
(cherry picked from commit c006a623e7)

Co-authored-by: Aalaap Dey <65075436+axdeyy@users.noreply.github.com>
2025-09-08 14:39:43 +00:00
Miss Islington (bot)
837df2774f
[3.13] fix comment reference from man 7 signal to man 7 signal-safety (GH-138554) (#138595)
fix comment reference from man 7 signal to man 7 signal-safety (GH-138554)
(cherry picked from commit 2f5ace780b)


docs: fix comment reference from man 7 signal to man 7 signal-safety

Co-authored-by: mqudah <mohghq@gmail.com>
2025-09-06 19:02:33 +00:00
Bénédikt Tran
afec2c70eb
[3.13] gh-116946: fully implement GC protocol for _curses_panel.panel (GH-138333) (#138428)
[3.14] gh-116946: fully implement GC protocol for `_curses_panel.panel` (GH-138333)

This commit fixes possible reference loops via `panel.set_userptr`
by implementing `tp_clear` and `tp_traverse` for panel objects.
(cherry picked from commit 572df47840)
2025-09-06 12:17:57 +02:00
Miss Islington (bot)
a7fd73e43f
[3.13] gh-60462: Fix locale.strxfrm() on Solaris (GH-138242) (GH-138449)
It should interpret the result of wcsxfrm() as a sequence of abstract
integers, not a sequence of Unicode code points or using other encoding
scheme that does not preserve ordering.
(cherry picked from commit 482fd0c811)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-03 13:31:23 +00:00
Miss Islington (bot)
06dbf81a56
[3.13] gh-138204: Forbid expansion of a shared anonymous mmap on Linux (GH-138220) (GH-138387)
This is a Linux kernel bug which caused a bus error.
https://bugzilla.kernel.org/show_bug.cgi?id=8691
(cherry picked from commit 33fcb0c4a0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-03 11:33:08 +03:00
Bénédikt Tran
a38f0266df
[3.13] gh-116946: Revert GC protocol for immutable empty heap types (GH-138322, GH-138323, GH-138326) (#138337)
* Revert "[3.13] gh-116946: fully implement GC protocol for `bz2` objects (GH-138266) (#138322)"

This reverts commit 90036f51fe.

* Revert "[3.13] gh-116946: fully implement GC protocol for `lzma` objects (GH-138288) (#138323)"

This reverts commit 828682df86.

* Revert "[3.13] gh-116946: fully implement GC protocol for `_hashlib` objects (GH-138289) (#138326)"

This reverts commit 21b593219a.
2025-09-01 21:14:47 +05:30
Bénédikt Tran
d25d2d6b95
[3.13] gh-116946: fully implement GC protocol for zlib objects (GH-138290) (#138328)
(cherry picked from commit 2a54acf3c3)
2025-09-01 12:25:11 +02:00
Bénédikt Tran
21b593219a
[3.13] gh-116946: fully implement GC protocol for _hashlib objects (GH-138289) (#138326)
(cherry picked from commit 6f1dd9551a)
2025-09-01 12:23:28 +02:00
Bénédikt Tran
828682df86
[3.13] gh-116946: fully implement GC protocol for lzma objects (GH-138288) (#138323)
(cherry picked from commit 3ea16f990f)
2025-09-01 12:22:06 +02:00
Bénédikt Tran
90036f51fe
[3.13] gh-116946: fully implement GC protocol for bz2 objects (GH-138266) (#138322)
(cherry picked from commit 9be91f6a20)
2025-09-01 12:21:40 +02:00
Miss Islington (bot)
502ca0d1ad
[3.13] bpo-41839: Fix error checking in sched_get_priority_ functions (GH-22374) (GH-138202)
(cherry picked from commit bbcb75c986)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2025-08-27 18:05:36 +00:00
Serhiy Storchaka
59068dfcf4
[3.13] gh-137986: Fix and improve the csv functions docstrings (GH-137987) (GH-138108)
The csv.register_dialect() docstring no longer imply that it returns a
dialect.
All functions have now signatures.
(cherry picked from commit aa1dbd4dde)

Co-authored-by: maurycy <5383+maurycy@users.noreply.github.com>
2025-08-24 08:37:41 +00:00
Gregory P. Smith
9face218e7
[3.13] gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) (GH-137827)
* [3.13] gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805)

Instead of surprise crashes and memory corruption, we now hang threads that attempt to re-enter the Python interpreter after Python runtime finalization has started. These are typically daemon threads (our long standing mis-feature) but could also be threads spawned by extension modules that then try to call into Python. This marks the `PyThread_exit_thread` public C API as deprecated as there is no plausible safe way to accomplish that on any supported platform in the face of things like C++ code with finalizers anywhere on a thread's stack. Doing this was the least bad option.

(cherry picked from commit 8cc5aa47ee)

Co-authored-by: Jeremy Maitin-Shepard <jeremy@jeremyms.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>

* state "3.13.7 and earlier"
* backport: do not add the deprecated marker
* fix Py_IsFinalizing doc ref

---------

Co-authored-by: Jeremy Maitin-Shepard <jeremy@jeremyms.com>
2025-08-17 09:08:14 -07:00
Peter Bierma
da39cb9716
[3.13] gh-137583: Only lock the SSL context, not the SSL socket (GH-137588) (GH-137613)
Fixes a deadlock introduced in 3.13.6.

(cherry picked from commit 55788a9096)
2025-08-11 22:05:13 -04:00
Miss Islington (bot)
8905f7a99b
[3.13] gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338) (GH-137507)
* Return large limit values as positive integers instead of negative integers
  in resource.getrlimit().
* Accept large values and reject negative values (except RLIM_INFINITY)
  for limits in resource.setrlimit().
(cherry picked from commit baefaa6cba)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-07 09:37:02 +00:00
Bénédikt Tran
3c37483731
[3.13] gh-132710: only use stable _uuid.generate_time_safe() to deduce MAC address (GH-132901) (#134704)
This commit includes the original commit and the NEWS entry that was added separately.

(cherry picked from commit 3bffada467)
(cherry picked from commit 9eb84d83e0)
2025-08-05 07:56:03 +00:00
sobolevn
17392a71ae
[3.13] gh-135839: Fix module_traverse and module_clear in subinterp modules (GH-135937) (GH-135943)
(cherry picked from commit bcc2cbaa7f)
2025-08-04 14:34:47 +02:00
Miss Islington (bot)
a32bd11cb0
[3.13] gh-137273: Fix debug assertion failure in locale.setlocale() on Windows (GH-137300) (GH-137306)
It happened when there were at least 16 characters after dot in the
locale name.
(cherry picked from commit 718e0c89ba)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-01 15:06:16 +00:00
Gregory P. Smith
4a37dd6cef
[3.13] gh-134698: Hold a lock when the thread state is detached in ssl (GH-134724) (#137126)
Lock when the thread state is detached.
(cherry picked from commit e047a35b23) or really from the 3.14 backport fd565fdfc9

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-07-27 08:30:25 -07:00
Miss Islington (bot)
89f256ecd1
[3.13] gh-126662: naming consistency for signal.ItimerError (GH-126712) (#137123)
gh-126662: naming consistency for `signal.ItimerError` (GH-126712)
(cherry picked from commit d5fa437dfb)

Co-authored-by: Stephen Morton <git@tungol.org>
2025-07-27 09:58:21 +05:30
Zachary Ware
fddb58a5ef
[3.13] gh-136710: Fix bad indentation in os.chdir docstring (GH-136721)
(cherry picked from commit bde808ad6b)

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2025-07-16 16:33:46 +00:00
Miss Islington (bot)
d733a1ed77
[3.13] gh-136549: Fix signature of threading.excepthook() (GH-136559) (GH-136590)
(cherry picked from commit be2c3d284e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-12 16:16:19 +00:00
Miss Islington (bot)
a717ed986d
[3.13] gh-136288: Fix error message in _testcapi/vectorcall.c (GH-136258) (GH-136295)
gh-136288: Fix error message in `_testcapi/vectorcall.c` (GH-136258)

Use the %N format specifier instead of %s and `PyType_GetName`.
(cherry picked from commit d1d5dce14f)

Co-authored-by: William S Fulton <wsf@fultondesigns.co.uk>
2025-07-04 16:17:10 +00:00
Miss Islington (bot)
67c74398fa
[3.13] Fix comments for heapq.siftup_max (GH-135359) (#136233)
Fix comments for `heapq.siftup_max` (GH-135359)
(cherry picked from commit 8f8bdf251a)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: mpage <mpage@meta.com>
2025-07-03 10:15:01 +00:00
Victor Stinner
e3a277c8d8
[3.13] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136126)
gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614)

(cherry picked from commit b1056c2a44)

Co-authored-by: Xuanteng Huang <44627253+xuantengh@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-01 11:26:52 +02:00
Miss Islington (bot)
ad1b0c942d
[3.13] gh-108765: fix comment about macro definitions in _stat.c post GH-108854 (GH-136027) (#136044)
gh-108765: fix comment about macro definitions in `_stat.c` post GH-108854 (GH-136027)
(cherry picked from commit 0141e7f9e6)

Co-authored-by: Lee Dogeon <dev.moreal@gmail.com>
2025-06-27 15:39:18 +00:00
sobolevn
28c5adfca9
[3.13] gh-135839: Fix module_traverse and module_clear in _interpchannelsmodule (GH-135840) (#135919)
(cherry picked from commit dd59c786cf)
2025-06-25 12:25:27 +03:00
Brian Schubert
3e4362812e
[3.13] gh-135855: Raise TypeError When Passing Non-dict Object to _interpreters.set___main___attrs (gh-135903)
(cherry picked from commit 4e6f0d116e, AKA gh-135856)
2025-06-24 16:23:26 -06:00
Eric Snow
666795ae34
[3.13] gh-135698: Fix Cross-interpreter Queue.full() With Negative/Default max_size (gh-135778)
We weren't handling non-positive maxsize values (including the default) properly
in Queue.full().  This change fixes that and adjusts an associated assert.

(cherry picked from commit c5ea8e8, AKA gh-135724)
2025-06-23 19:38:41 +00:00
Miss Islington (bot)
3bfb7da3d7
[3.13] gh-135641: Fix flaky test_capi.test_lock_two_threads test case (gh-135642) (gh-135688)
The mutex may have the `_Py_HAS_PARKED` bit set.
(cherry picked from commit 17ac3933c3)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-06-18 18:47:59 +00:00
Miss Islington (bot)
871adc8e9f
[3.13] gh-135321: Always raise a correct exception for BINSTRING argument > 0x7fffffff in pickle (GH-135322) (GH-135383)
(cherry picked from commit 2b8b4774d2)

Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-11 14:00:59 +03:00
Serhiy Storchaka
37027ab535
[3.13] gh-135326: Restore support of __index__ in random.getrandbits() (#135332) 2025-06-10 12:41:10 +02:00
Miss Islington (bot)
7620805480
[3.13] gh-134160: Use PyModuleDef.m_free in the example module xxlimited (GH-135174) (GH-135214)
gh-134160: Use PyModuleDef.m_free in the example module xxlimited (GH-135174)
(cherry picked from commit 1adca08d65)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2025-06-07 11:03:32 +02:00
Serhiy Storchaka
e2a9a3fa98
[3.13] gh-131884: Fix incorrect formatting in json.dumps() when using indent and skipkeys=True (GH-132200) (GH-135061)
(cherry picked from commit ec12559eba)

Co-authored-by: Roei Ben Artzi <155478676+roeibenartzi@users.noreply.github.com>
2025-06-05 14:38:11 +00:00
Miss Islington (bot)
9d5543ae70
[3.13] gh-135108: Fix utmp.h inclusion in posixmodule.c on NetBSD (GH-135109) (GH-135128)
(cherry picked from commit 5b3865418c)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2025-06-04 13:16:09 +00:00
Sam Gross
b21d15fa95
[3.13] gh-127081: use getlogin_r if available (gh-132751) (#135098)
The `getlogin` function is not thread-safe: replace with `getlogin_r` where
available.
(cherry picked from commit 1ffe913c20)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-06-03 14:41:26 -04:00
Serhiy Storchaka
3e1b8d6e67
[3.13] gh-133489: Remove size restrictions on getrandbits() and randbytes() (GH-133658) (GH-134965)
random.getrandbits() can now generate more that 2**31 bits.
random.randbytes() can now generate more that 256 MiB.
(cherry picked from commit 68784fed78)
2025-06-02 23:16:30 +03:00
Sam Gross
a9b8ffd9b9
[3.13] gh-134908: Protect textiowrapper_iternext with critical section (gh-134910) (gh-135040)
The `textiowrapper_iternext` function called `_textiowrapper_writeflush`, but did not
use a critical section, making it racy in free-threaded builds.
(cherry picked from commit 44fb7c361c)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-06-02 19:40:42 +00:00
Bénédikt Tran
2c325e28c3
[3.13] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134962)
OpenSSL and HACL*-based hash functions constructors now support both `data` and `string` parameters.
Previously these constructor functions inconsistently supported sometimes `data` and sometimes `string`,
while the documentation expected `data` to be given in all cases.

(cherry picked from commit c6e63d9d35)
(cherry picked from commit 379d0bc956)
2025-06-01 10:27:02 +02:00
Bénédikt Tran
5fb05ea679
[3.13] gh-134210: handle signals in _curses.window.getch (GH-134326) (#134784)
(cherry picked from commit 51762b6cad)
2025-05-27 09:17:27 +00:00
Sergey B Kirpichev
e483dcf19e
[3.13] gh-132876: workaround broken ldexp() on Windows 10 (GH-133135) (#134685)
* gh-132876: workaround broken ldexp() on Windows 10

ldexp() fails to round subnormal results before Windows 11,
so hide their bug.
(cherry picked from commit cf8941c603)

Co-authored-by: Tim Peters <tim.peters@gmail.com>
2025-05-25 22:39:34 -05:00
Miss Islington (bot)
e4c4ecccec
[3.13] gh-134381: Fix RuntimeError when starting not-yet started Thread after fork (gh-134514) (gh-134597)
(cherry picked from commit 9a2346df86)

Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com>
2025-05-23 19:45:51 +00:00
mkaraev
532acbd0fa
[3.13] gh-133904: Fix math.factorial documentation (GH-133907) (#133922)
* [3.13] gh-133904: Fix `math.factorial` documentation (GH-133907)
(cherry picked from commit 27ed64575d)

Co-authored-by: mkaraev <maruf.karaev97@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2025-05-12 12:17:17 +00:00
Miss Islington (bot)
9718880ba9
[3.13] gh-133009: fix UAF in xml.etree.ElementTree.Element.__deepcopy__ (GH-133010) (#133806)
gh-133009: fix UAF in `xml.etree.ElementTree.Element.__deepcopy__` (GH-133010)
(cherry picked from commit 116a9f9b37)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-05-10 07:55:47 +00:00
Serhiy Storchaka
973e2d3e29
[3.13] gh-122559: Synchronize C and Python implementation of the io module about pickling (GH-122628) (GH-133381)
In the C implementation, remove __reduce__ and __reduce_ex__ methods
that always raise TypeError and restore __getstate__ methods that always
raise TypeErrori.

This restores fine details of the pre-3.12 behavior and unifies
both implementations.
(cherry picked from commit e9253ebf74)
2025-05-04 16:04:09 +00:00
Serhiy Storchaka
3c9d1778ef
[3.13] bpo-44172: Keep reference to original window in curses subwindow objects (GH-26226) (GH-133370)
The X/Open curses specification[0] and ncurses documentation[1]
both state that subwindows must be deleted before the main window.

Deleting the windows in the wrong order causes a double-free with
NetBSD's curses implementation.

To fix this, keep track of the original window object in the subwindow
object, and keep a reference to the original for the lifetime of
the subwindow.

[0] https://pubs.opengroup.org/onlinepubs/7908799/xcurses/delwin.html
[1] https://invisible-island.net/ncurses/man/curs_window.3x.html
(cherry picked from commit 0af61fe2f4)

Co-authored-by: Michael Forney <mforney@mforney.org>
2025-05-04 11:15:43 +00:00
Miss Islington (bot)
e75f528e78
[3.13] gh-133290: Use PyObject_SetAttr to set _type_ (GH-133292) (GH-133295)
gh-133290: Use PyObject_SetAttr to set _type_ (GH-133292)
(cherry picked from commit 2590774c9b)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-05-02 18:10:32 +02:00
Miss Islington (bot)
3ff35ba471
[3.13] gh-132527: Added missing w typecode to array() error message (GH-132529) (#132938)
Co-authored-by: Christian Veenhuis <124370897+ChVeen@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-04-25 17:12:02 +03:00
Serhiy Storchaka
3c29fb2974
[3.13] gh-132753: Argument Clinic: Fix support of c_default for the bool converter (GH-132754) (GH-132766)
(cherry picked from commit 78cfee6f09)
2025-04-21 07:10:31 +00:00
Peter Bierma
47c8df6172
[3.13] gh-132673: Fix a crash with zero-alignment in ctypes.Structure (#132695) 2025-04-19 14:29:05 +00:00