Commit graph

15115 commits

Author SHA1 Message Date
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)
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)
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
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)
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)
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
Erlend E. Aasland
ebbfd8f51a
[3.14] gh-138736: Fix sqlite3.Connection.blobopen 'row' parameter type and naming (#138738) (GH-139062)
(cherry picked from commit 8eb106240f)

Co-authored-by: chiri <chirizxc@proton.me>
2025-10-07 20:38:26 +02:00
Miss Islington (bot)
4bb33ff1c1
[3.14] gh-138779: Use the dev_t converter for st_rdev (GH-138780) (#138926)
gh-138779: Use the dev_t converter for st_rdev (GH-138780)

This allows to support device numbers larger than 2**63-1.
(cherry picked from commit 43013f72f0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 00:06:55 +05:30
Miss Islington (bot)
29cffb1c02
[3.14] fix comment reference from man 7 signal to man 7 signal-safety (GH-138554) (#138594)
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-10-07 19:34:15 +01:00
Miss Islington (bot)
6d94af4b98
[3.14] gh-139327: fix some reference leaks in sqlite3 error branches (GH-139328) (GH-139471)
(cherry picked from commit d0a3eff9d6)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-07 20:22:20 +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)
75de39ba1b
[3.14] gh-137185: Fix _Py_DumpStack() async signal safety (gh-137187) (gh-137206)
Call backtrace() once when installing the signal handler to ensure that
libgcc is dynamically loaded outside the signal handler.

This fixes a "signal-unsafe call inside of a signal" TSan error from
test_faulthandler.test_enable_fd.
(cherry picked from commit 11a8652e25)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-07 18:11:46 +00: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)
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)
c1cb785ebd
[3.14] gh-126662: naming consistency for signal.ItimerError (GH-126712) (#137122)
gh-126662: naming consistency for `signal.ItimerError` (GH-126712)
(cherry picked from commit d5fa437dfb)

Co-authored-by: Stephen Morton <git@tungol.org>
2025-10-07 19:42:46 +02:00
Miss Islington (bot)
9e13cc2896
[3.14] gh-137017: Ensure Thread.is_alive() only returns False after the underlying OS thread exits (gh-137315) (gh-138916)
(cherry picked from commit aa9ceb1721)

Co-authored-by: Abdul <abdulrasheedibrahim47@gmail.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-07 17:37:31 +00: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)
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)
8cb73119c6
[3.14] gh-139573: Update OpenSSL in CI (GH-139577) (#139583)
gh-139573: Update OpenSSL in CI (GH-139577)
(cherry picked from commit 98e748b3a0)

Co-authored-by: Zachary Ware <zach@python.org>
2025-10-05 07:50:26 +03:00
Miss Islington (bot)
57617732af
[3.14] gh-139312: Update bundled libexpat to 2.7.3 (GH-139319) (#139376)
gh-139312: Update bundled libexpat to 2.7.3 (GH-139319)

(cherry picked from commit 48d0d0dd97)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-09-27 08:10:07 +02:00
Miss Islington (bot)
97f4ac28cb
[3.14] gh-138998: Upgrade vendored expat to 2.7.2 (GH-138999) (#139024)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-09-17 15:41:02 +03:00
Miss Islington (bot)
c0d490d9c4
[3.14] gh-135755: Make Py_MAX_SCRIPT_PATH_SIZE private (GH-138350) (#138356)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-09-16 15:49:35 +03:00
Bénédikt Tran
c8cc39d938
[3.14] gh-116946: fully implement GC protocol for zlib objects (GH-138290) (#138327) 2025-09-12 16:22:33 +03:00
Miss Islington (bot)
1cb1c2c03b
[3.14] gh-138659: Typo in the gc module docstring (GH-138660) (#138662)
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:41:34 +00:00
Bénédikt Tran
9cc2b25101
[3.14] gh-116946: fully implement GC protocol for _curses_panel.panel (GH-138333) (#138427) 2025-09-06 21:20:35 +03:00
Miss Islington (bot)
6c2d42f3f2
[3.14] GH-132775: Fix argument parsing for `_interpqueues.put()` (GH-137686) (#138034)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-27 16:53:39 +03:00
Zachary Ware
d8f4d56f83
[3.14] gh-132339: Add support for OpenSSL 3.5 (GH-137720) (#137747)
* Add OpenSSL 3.5.2 definitions to Modules/_ssl_data_35.h (moved from Modules/_ssl_data_34.h)

* Demote OpenSSL 3.1 to "old", remove it from CI

* Update all OpenSSL versions to latest patchlevel in CI config and multissltests defaults

* Add OpenSSL 3.5.2 to CI configuration and multissltests default list

* Fix a typo in the argument parser description of multissltests.py
(cherry picked from commit 7a703c8f19)
2025-08-14 08:58:18 +03:00
Miss Islington (bot)
0fc49bed80
[3.14] gh-132983: Use `Py_UNREACHABLE in _zstd_load_impl()` (GH-137320) (#137360)
Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
2025-08-07 18:38:15 +03:00
Miss Islington (bot)
833d883ad4
[3.14] gh-132983: Fix docstrings in `ZstdDict` (GH-137321) (#137343)
Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-03 22:37:49 +03:00
Miss Islington (bot)
b7168d216b
[3.14] GH-136975: Emend a spelling error (algorthm -> algorithm) (GH-136999) (#137003)
GH-136975: Emend a spelling error (algorthm -> algorithm) (GH-136999)
(cherry picked from commit b6d3242244)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-23 23:48:11 +03:00
Serhiy Storchaka
805daa2edb
[3.14] Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303)" (GH-136991) (#137006) 2025-07-22 19:16:31 +03:00
Łukasz Langa
591019e1f2
[3.14] gh-124621: Emscripten: Support pyrepl in browser (GH-136931) (GH-136988)
Basic support for pyrepl in Emscripten. Limitations:
* requires JSPI
* no signal handling implemented

As followup work, it would be nice to implement a webworker variant
for when JSPI is not available and proper signal handling.

Because it requires JSPI, it doesn't work in Safari. Firefox requires
setting an experimental flag. All the Chromiums have full support since
May. Until we make it work without JSPI, let's keep the original web_example
around.
(cherry picked from commit c933a6bb32)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Éric <merwok@netwok.org>
2025-07-22 15:04:11 +02:00
Miss Islington (bot)
d118bc061b
[3.14] gh-124621: Emscripten: Add support for async input devices (GH-136822) (GH-136935)
This is useful for implementing proper `input()`. It requires the
JavaScript engine to support the wasm JSPI spec which is now stage 4.
It is supported on Chrome since version 137 and on Firefox and node
behind a flag.

We override the `__wasi_fd_read()` syscall with our own variant that
checks for a readAsync operation. If it has it, we use our own async
variant of `fd_read()`, otherwise we use the original `fd_read()`.
We also add a variant of `FS.createDevice()` called
`FS.createAsyncInputDevice()`.

Finally, if JSPI is available, we wrap the `main()` symbol with
`WebAssembly.promising()` so that we can stack switch from `fd_read()`.
If JSPI is not available, attempting to read from an AsyncInputDevice
will raise an `OSError`.
(cherry picked from commit 7ae4749d06)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2025-07-22 11:51:02 +02:00
Miss Islington (bot)
11f510167c
[3.14] gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899) (#136969)
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-07-22 12:44:59 +03:00
Miss Islington (bot)
ecd97caaf5
[3.14] gh-136421: Load _datetime static types during interpreter initialization (GH-136583) (GH-136943)
gh-136421: Load `_datetime` static types during interpreter initialization (GH-136583)

`_datetime` is a special module, because it's the only non-builtin C extension that contains static types. As such, it would initialize static types in the module's execution function, which can run concurrently. Since static type initialization is not thread-safe, this caused crashes. This fixes it by moving the initialization of `_datetime`'s static types to interpreter startup (where all other static types are initialized), which is already properly protected through other locks.
(cherry picked from commit a10960699a)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-07-21 19:23:05 -04:00
Miss Islington (bot)
201c765d76
[3.14] Fix typo: "occured" =>"occurred" (GH-134928) (#136771)
Co-authored-by: Roman <121314722+GameRoMan@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-19 09:13:51 +00:00
Zachary Ware
5f1d46f7d0
[3.14] gh-136710: Fix bad indentation in os.chdir docstring (GH-136719)
(cherry picked from commit bde808ad6b)

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2025-07-16 17:15:50 +00:00
Miss Islington (bot)
55eaaab8a4
[3.14] gh-116738: Make grp module thread-safe (GH-135434) (#136658)
gh-116738: Make grp module thread-safe (GH-135434)

Make grp module methods getgrgid() and getgrnam() thread-safe when the GIL is disabled and getgrgid_r()/getgrnam_r() C APIs are not available.
---------
(cherry picked from commit 9363703bd3)

Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-15 11:03:33 +05:30
Miss Islington (bot)
64df22c190
[3.14] gh-136549: Fix signature of threading.excepthook() (GH-136559) (GH-136589)
(cherry picked from commit be2c3d284e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-12 16:18:23 +00:00
Miss Islington (bot)
7880421983
[3.14] gh-136476: Remove creation of unused list (GH-136494) (GH-136495)
(cherry picked from commit b44316a097)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-10 08:36:48 +00:00
Miss Islington (bot)
4d025a2318
[3.14] gh-136476: Show the full stack in get_async_stack_trace in _remote_debugging (GH-136483) (#136490)
gh-136476: Show the full stack in get_async_stack_trace in _remote_debugging (GH-136483)
(cherry picked from commit ea45a2f97c)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-07-10 00:57:40 +01:00
Miss Islington (bot)
9a79c5128f
[3.14] gh-91048: Revert the memory cache removal for remote debugging (GH-136440) (#136443)
gh-91048: Revert the memory cache removal for remote debugging (GH-136440)
(cherry picked from commit 77d25e5b16)


gh-91048: Reintroduce the memory cache for remote debugging

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2025-07-09 02:21:56 +01:00
Miss Islington (bot)
376e037ecc
[3.14] gh-120713: Make _Py_NORMALIZE_CENTURY private (GH-135933) (#136387)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-08 11:43:57 +03:00
Miss Islington (bot)
6d21cc54ff
[3.14] gh-136288: Fix error message in _testcapi/vectorcall.c (GH-136258) (GH-136294)
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:18:32 +00:00
Miss Islington (bot)
f2f3edb8d7
[3.14] gh-135773: have pyvenv.cfg without home key anchor a venv and deduce home (GH-135831) (#136287)
gh-135773: have pyvenv.cfg without home key anchor a venv and deduce home (GH-135831)

This is still formally undefined behaviour, but we may as well
keep the *same* undefined behaviour as previous versions.

PEP 796 proposes a cleaner and more consistent replacement for 3.15+
(cherry picked from commit 93263d4314)

Co-authored-by: Richard Levasseur <rlevasseur@google.com>
2025-07-05 00:36:12 +10:00
Miss Islington (bot)
150262db4c
[3.14] gh-133740: Fix regression in locale.nl_langinfo(ALT_DIGITS) (GH-136237) (GH-136240)
There is no need to temporary switch locale for items ALT_DIGITS and ERA
if the nl_langinfo() result is empty (most locales).
(cherry picked from commit 5c984ae35e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-07-03 11:04:30 +00:00
Miss Islington (bot)
84cafc7e94
[3.14] Fix comments for heapq.siftup_max (GH-135359) (#136232)
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:17:10 +00:00
Miss Islington (bot)
f152d60b68
[3.14] gh-130396: Move PYOS_LOG2_STACK_MARGIN to internal headers (GH-135928) (#136173)
gh-130396: Move PYOS_LOG2_STACK_MARGIN to internal headers (GH-135928)

Move PYOS_LOG2_STACK_MARGIN, PYOS_STACK_MARGIN,
PYOS_STACK_MARGIN_BYTES and PYOS_STACK_MARGIN_SHIFT macros to
pycore_pythonrun.h internal header. Add underscore (_) prefix to the
names to make them private. Rename _PYOS to _PyOS.
(cherry picked from commit 28940e8e48)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-07-01 13:44:32 +00:00
Victor Stinner
3267847759
[3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136119)
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-06-30 15:59:22 +02:00