Commit graph

55369 commits

Author SHA1 Message Date
Miss Islington (bot)
d912e9a852
[3.14] gh-69605: Hardcode some stdlib submodules in PyREPL module completion (os.path, collections.abc...) (GH-138268) (GH-138943)
(cherry picked from commit 537133d2b6)

Co-authored-by: Loïc Simon <loic.simon@napta.io>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-10-07 21:24:01 +02:00
Miss Islington (bot)
cde02ae782
[3.14] gh-139283: correctly handle size limit in cursor.fetchmany() (GH-139296) (GH-139441)
Passing a negative or zero size to `cursor.fetchmany()` made it fetch all rows
instead of none.

While this could be considered a security vulnerability, it was decided to treat
this issue as a regular bug as passing a non-sanitized *size* value in the first
place is not recommended.
(cherry picked from commit bc172ee830)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 21:23:08 +02:00
Miss Islington (bot)
cd8fc3aad3
[3.14] gh-95844: Move help_url code to a help module function (GH-129971) (#138484)
gh-95844: Move help_url code to a help module function (GH-129971)

---------
(cherry picked from commit 3b4cd88563)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-10-07 15:14:54 -04:00
Miss Islington (bot)
2f14d23013
[3.14] gh-139210: Fix use-after-free in xml.etree.ElementTree.iterparse() (GH-139211) (GH-139455)
(cherry picked from commit c86eb4d3ac)

Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 21:13:27 +02:00
Miss Islington (bot)
df739f33d3
[3.14] gh-131178: Add tests for site command-line interface (GH-133582) (GH-137832)
gh-131178: Add tests for `site` command-line interface  (GH-133582)
(cherry picked from commit 03f5519d77)

Co-authored-by: ggqlq <124190229+ggqlq@users.noreply.github.com>
2025-10-07 19:11:43 +00:00
Miss Islington (bot)
ffc67b3505
[3.14] gh-138004: Fix setting a thread name on OpenIndiana (GH-138017) (#138384)
gh-138004: Fix setting a thread name on OpenIndiana (GH-138017)

Encode Solaris/Illumos thread names to ASCII, since
OpenIndiana does not support non-ASCII names.

Add tests for setting non-ASCII name for the main thread.
(cherry picked from commit c19db1d2b8)

Co-authored-by: jadonduff <jadon_duff@icloud.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 20:58:35 +02:00
Stan Ulbrych
a893270c6d
[3.14] gh-71648: Optimize PNG files (GH-138842) (GH-138851)
* Only keep > 1 kb savings
(cherry picked from commit 2e8f64c931)
2025-10-07 20:52:12 +02:00
Miss Islington (bot)
4429554223
[3.14] gh-116738: make cProfile module thread-safe (GH-138229) (#138575)
gh-116738: make `cProfile` module thread-safe (GH-138229)
(cherry picked from commit 8554c0917e)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 18:51:22 +00:00
Gregory P. Smith
e51acb3fa6
[3.14] gh-134698: Hold a lock when the thread state is detached in ssl (GH-134724) (GH-137107)
* [3.14] gh-134698: Hold a lock when the thread state is detached in `ssl` (GH-134724)

Lock when the thread state is detached.
(cherry picked from commit e047a35b23)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>

* Only lock the SSL context, not the SSL socket.

This solves a deadlock when a socket is blocked while waiting on data,
which ended up causing a major regression in 3.13.6 (see gh-137583).

---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-07 18:49:22 +00:00
Miss Islington (bot)
ed9c0c3cbe
[3.14] gh-137477: Fix inspect.getblock() for generator expressions (GH-137488) (#137993)
gh-137477: Fix inspect.getblock() for generator expressions (GH-137488)

This fixes also inspect.getsourcelines() and inspect.getsource().
(cherry picked from commit eae9d7de1c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 20:48:40 +02:00
Miss Islington (bot)
137c784fbf
[3.14] gh-136914: Fix support of cached functions and properties in DocTest's lineno computation (GH-136930) (#137616)
gh-136914: Fix support of cached functions and properties in DocTest's lineno computation (GH-136930)

Previously, DocTest's lineno of functions and methods decorated with
functools.cache(), functools.lru_cache() and functools.cached_property()
was not properly returned (None was returned) because the
computation relied on inspect.isfunction() which does not consider the
decorated result as a function.

We now use the more generic inspect.isroutine(), as elsewhere
in doctest's logic.

Also, added a special case for functools.cached_property().
(cherry picked from commit fece15d29f)

Co-authored-by: Denis Laxalde <denis@laxalde.org>
2025-10-07 20:48:10 +02:00
Miss Islington (bot)
e09f33e5bf
[3.14] gh-137433: Fix deadlock with stop-the-world and daemon threads (gh-137735) (GH-138965)
There was a deadlock originally seen by Memray when a daemon thread
enabled or disabled profiling while the interpreter was shutting down.
I think this could also happen with garbage collection, but I haven't
seen that in practice.

The daemon thread could be hung while trying acquire the global rwmutex
that prevents overlapping global and per-interpreter stop-the-world events.
Since it already held the main interpreter's stop-the-world lock, it
also deadlocked the main thread, which is trying to perform interpreter
finalization.

Swap the order of lock acquisition to prevent this deadlock.
Additionally, refactor `_PyParkingLot_Park` so that the global buckets
hashtable is left in a clean state if the thread is hung in
`PyEval_AcquireThread`.

(cherry picked from commit 90fe3250f8)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-07 20:46:52 +02:00
Miss Islington (bot)
c4be405fe9
[3.14] gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338) (#137506)
gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338)

* 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-10-07 20:43:12 +02:00
Miss Islington (bot)
b414ad1043
[3.14] gh-81325: Support path-like objects with streaming TarFile (GH-137188) (#137365)
gh-81325: Support path-like objects with streaming TarFile (GH-137188)
(cherry picked from commit 3ec3d05345)

Co-authored-by: Alexander Urieles <aeurielesn@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-10-07 20:40:42 +02:00
Miss Islington (bot)
14e8decde7
[3.14] gh-137273: Fix debug assertion failure in locale.setlocale() on Windows (GH-137300) (#137305)
gh-137273: Fix debug assertion failure in locale.setlocale() on Windows (GH-137300)

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-10-07 20:39:13 +02:00
Miss Islington (bot)
2de18f251a
[3.14] gh-138772: Add tests for Turtle.dot() signature (GH-138773) (GH-139326)
(cherry picked from commit 2462807b70)

Co-authored-by: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com>
2025-10-07 20:24:59 +02:00
Miss Islington (bot)
08673d8a51
[3.14] gh-116738: add multi-threaded tests for resource module on free-threading builds (GH-138504) (#138793)
gh-116738: add multi-threaded tests for `resource` module on free-threading builds (GH-138504)
(cherry picked from commit 32e1e0699f)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 18:23:58 +00:00
Miss Islington (bot)
b4c3c0f4bf
[3.14] gh-139308: Skip test_special_chars_csh on NetBSD due to csh variable expansion issue (GH-139341) (GH-139559)
(cherry picked from commit ae6e7f572c)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2025-10-07 20:20:57 +02:00
Miss Islington (bot)
85c45571ae
[3.14] gh-139646: fix typo in pickletools error message (GH-139647) (GH-139649)
(cherry picked from commit 36a6c2cdfa)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
2025-10-07 20:19:01 +02:00
Kumar Aditya
23cc8f789d
[3.14] gh-132551: make io.BytesIO thread safe (GH-132616) (#138551)
* [3.14] gh-132551: make `io.BytesIO` thread safe (GH-132616)
(cherry picked from commit 5dd3a3a58c)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 23:48:28 +05:30
Miss Islington (bot)
bf397e272c
[3.14] gh-133467: fix data race in type_set_name (GH-137302) (#137303)
gh-133467: fix data race in `type_set_name` (GH-137302)

Fix data race in `type_set_name` by assigning name under stop the world pause making it thread safe in free-threading.
(cherry picked from commit e99bc7fd44)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 18:18:23 +00:00
Miss Islington (bot)
070993b8ad
[3.14] gh-135729: Store reference to globals in Interpreter._decref (GH-139104) (GH-139112)
* gh-135729: Store reference to globals in `Interpreter._decref` (GH-139104)
(cherry picked from commit 571210b8f3)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-07 14:18:15 -04:00
Miss Islington (bot)
5b64b59618
[3.14] gh-138854: Skip test_script_shadowing_stdlib_cwd_failure on AIX (GH-138855) (GH-139674)
(cherry picked from commit 171f787a29)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2025-10-07 20:16:55 +02:00
Miss Islington (bot)
f38a015552
[3.14] gh-75989: TarFile.extractall and TarFile.extract now overwrite symlinks when extracting hardlinks (GH-137316) (GH-139705)
(cherry picked from commit 481d5b5455)

Co-authored-by: Alexander Urieles <aeurielesn@users.noreply.github.com>
2025-10-07 20:16:20 +02:00
Sergey B Kirpichev
058c2770a2
[3.14] gh-122450: Expand documentation for `Rational and Fraction` (GH-136800) (#137363)
(cherry picked from commit b266fbc9ec)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 19:15:22 +01:00
Miss Islington (bot)
93ac6f3472
[3.14] gh-135444: fix asyncio.DatagramTransport.sendto to account for datagram header size when data cannot be sent (GH-135445) (#137245)
gh-135444: fix `asyncio.DatagramTransport.sendto` to account for datagram header size when data cannot be sent (GH-135445)
(cherry picked from commit e3ea861351)

Co-authored-by: Justin Bronder <jsbronder@cold-front.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-07 23:40:03 +05:30
Miss Islington (bot)
98d33bf19c
[3.14] gh-139624: Skip problematic locales on AIX in test_date_locale2 (GH-139625) (GH-139644)
(cherry picked from commit 6f3dae0dc5)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 20:02:42 +02:00
Miss Islington (bot)
7a1a79d731
[3.14] gh-138163: skip failures if tests are run with SCHED_BATCH on glibc (GH-138576) (GH-138820)
(cherry picked from commit 492941459a)

Co-authored-by: jxes993409 <68891412+jxes993409@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 20:01:51 +02:00
Miss Islington (bot)
d7500f6078
[3.14] gh-138008: Fix segfaults in _ctypes due to invalid argtypes (GH-138285) (GH-138742)
(cherry picked from commit 1ce05537a3)

Signed-off-by: Nguyen Viet Dung <29406816+magnified103@users.noreply.github.com>
Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 20:00:28 +02:00
Miss Islington (bot)
7aab50cd7a
[3.14] gh-136507: Fix mimetypes CLI to handle multiple file parameters (GH-136508) (GH-138140)
(cherry picked from commit 81268a3e2a)

Co-authored-by: Wulian233 <1055917385@qq.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 19:59:52 +02:00
Miss Islington (bot)
7d9b2671c6
[3.14] gh-123681: Check NORMALIZE_CENTURY behavior at runtime; require C99 (GH-136022) (GH-137947)
A runtime check is needed to support cross-compiling.

Remove the _Py_NORMALIZE_CENTURY macro.
Remove _pydatetime.py's _can_support_c99.
(cherry picked from commit 719e5c3f71)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 19:59:06 +02:00
Miss Islington (bot)
a03dd74c94
[3.14] gh-137239: Add *_max functions to heapq.__all__ (gh-137241) (#137256)
gh-137239: Add *_max functions to heapq.__all__ (gh-137241)
(cherry picked from commit 5f35f9b8fa)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-07 23:22:07 +05:30
Sam Gross
fb699effbf
[3.14] gh-137400: Fix thread-safety issues when profiling all threads (gh-137518) (gh-137730)
There were a few thread-safety issues when profiling or tracing all
threads via PyEval_SetProfileAllThreads or PyEval_SetTraceAllThreads:

* The loop over thread states could crash if a thread exits concurrently
  (in both the free threading and default build)
* The modification of `c_profilefunc` and `c_tracefunc` wasn't
  thread-safe on the free threading build.
(cherry picked from commit a10152f8fd)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-07 13:45:23 -04:00
Miss Islington (bot)
98ca0b3e2b
[3.14] Fix docs for Queue.shutdown (gh-137028) (#137080)
Fix docs for Queue.shutdown (gh-137028)
(cherry picked from commit 245671555b)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Co-authored-by: Zachary Ware <zach@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 19:41:03 +02:00
Miss Islington (bot)
57c8e3eb8e
[3.14] gh-58124: Avoid CP_UTF8 in UnicodeDecodeError (GH-137415) (#137460)
gh-58124: Avoid CP_UTF8 in UnicodeDecodeError (GH-137415)

Fix name of the Python encoding in Unicode errors of the code page
codec: use "cp65000" and "cp65001" instead of "CP_UTF7" and "CP_UTF8"
which are not valid Python code names.
(cherry picked from commit ce1b747ff6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-07 19:39:31 +02:00
Miss Islington (bot)
e4e8c5a3b0
[3.14] gh-139208: Fix regrtest --fast-ci --verbose (GH-139240) (#139260)
gh-139208: Fix regrtest --fast-ci --verbose (GH-139240)

Don't ignore the --verbose option anymore.
(cherry picked from commit dd683f8f34)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-07 19:39:06 +02:00
Miss Islington (bot)
52e88585b0
[3.14] gh-137179: Fix flaky test_history_survive_crash test (gh-137180) (gh-137216)
Kill the REPL subprocess once it prints the output from the command
immediately before the `time.sleep()`.
(cherry picked from commit 98d462cf4d)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-07 17:38:30 +00:00
Miss Islington (bot)
6e9845455e
[3.14] gh-135329: Use longer timeout in pyrepl test_repl_eio() (GH-139503) (#139506)
gh-135329: Use longer timeout in pyrepl test_repl_eio() (GH-139503)

Replace hardcoded 5 seconds with support.SHORT_TIMEOUT.

Fix the following error on slow CI such as GitHub Action UBSan:

test test_pyrepl failed -- Traceback (most recent call last):
  File "Lib/test/test_pyrepl/test_unix_console.py", line 362, in test_repl_eio
    _, err = proc.communicate(timeout=5)  # sleep for pty to settle
             ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "Lib/subprocess.py", line 1219, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
                     ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Lib/subprocess.py", line 2126, in _communicate
    self._check_timeout(endtime, orig_timeout, stdout, stderr)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Lib/subprocess.py", line 1266, in _check_timeout
    raise TimeoutExpired(
    ...<2 lines>...
            stderr=b''.join(stderr_seq) if stderr_seq else None)
subprocess.TimeoutExpired: Command '[...]' timed out after 5 seconds
(cherry picked from commit c985822d86)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-07 19:38:12 +02:00
Kumar Aditya
5cd6cfe4cf
[3.14] gh-136234: Fix SelectorSocketTransport.writelines to be robust to connection loss (GH-136743) (#138702) 2025-10-07 23:06:04 +05:30
Miss Islington (bot)
de84d09050
[3.14] gh-139516: Fix lambda colon start format spec in f-string in tokenizer (GH-139657) (#139701)
gh-139516: Fix lambda colon start format spec in f-string in tokenizer (GH-139657)
(cherry picked from commit 539461d9ec)

Co-authored-by: Tomasz Pytel <tompytel@gmail.com>
2025-10-07 18:35:17 +01:00
Miss Islington (bot)
cec4ddf23e
[3.14] gh-128639: Don't assume one thread in subinterpreter finalization with fixed daemon thread support (GH-134606) (GH-139050)
gh-128639: Don't assume one thread in subinterpreter finalization with fixed daemon thread support (GH-134606)

This reapplies GH-128640.
(cherry picked from commit a64881363b)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-07 13:30:38 -04:00
Miss Islington (bot)
08bea299bf
[3.14] gh-112729: Correctly fail when the process is out of memory during interpreter creation (GH-139164) (GH-139168)
gh-112729: Correctly fail when the process is out of memory during interpreter creation (GH-139164)
(cherry picked from commit d06113c7a7)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-10-07 13:30:23 -04:00
Miss Islington (bot)
a69bdab541
[3.14] gh-123828: Fix data race in _interpchannels._waiting_release (GH-124107) (GH-139517)
gh-123828: Fix data race in `_interpchannels._waiting_release` (GH-124107)
(cherry picked from commit f39dea3bae)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
2025-10-07 13:29:37 -04:00
Miss Islington (bot)
ddd1264469
[3.14] gh-82916: Don't fail when importing from / with sys.pycache_prefix set (GH-30456) (GH-137906)
(cherry picked from commit d8a9466e29)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 18:55:33 +02:00
Hugo van Kemenade
ebf955df7a Python 3.14.0 2025-10-07 12:34:52 +03:00
Miss Islington (bot)
f776254080
[3.14] gh-137242: Allow Android testbed to take all Python command-line options (GH-138805) (#139637)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-10-06 15:15:06 +03:00
Miss Islington (bot)
66ca0d9ae6
[3.14] gh-139400: Make sure that parent parsers outlive their subparsers in pyexpat (GH-139403) (#139606)
Co-authored-by: Sebastian Pipping <sebastian@pipping.org>
2025-10-05 16:02:11 +00:00
Miss Islington (bot)
08d289208b
[3.14] gh-138130: Fix return value of libc_ver() on Emscripten (GH-138132) (#138312)
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-10-05 16:03:49 +03:00
Miss Islington (bot)
1ffd62baca
[3.14] gh-139310: skip test_aead_aes_gcm for Linux kernel between 6.16.0 and 6.17.x (GH-139552) (#139594)
gh-139310: skip `test_aead_aes_gcm` for Linux kernel between 6.16.0 and 6.17.x (GH-139552)

Currently, Fedora 42 uses a custom Linux Kernel 6.16.9 that backported an upstream change
from 6.17-rc7 [1,3] but not its subsequent fix [2]. Until the issue is resolved upstream,
we skip the failing test `test_socket.test_aead_aes_gcm` for kernel versions between 6.16
and 6.17.x.

[1] 1b34cbbf4f
[2] d0ca0df179.
[3] 45bcf60fe4
(cherry picked from commit 41712c4e09)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-05 08:53:23 +00:00
Miss Islington (bot)
8566ee2507
[3.14] gh-138703: clarify data buffer requirement of asyncio.StreamWriter.write (GH-139564) (#139570)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-04 16:40:21 +00:00