Commit graph

31570 commits

Author SHA1 Message Date
Serhiy Storchaka
bcabbd02f6
[3.14] gh-80667: Fix lookup for Tangut ideographs in unicodedata (GH-144789) (GH-144871)
(cherry picked from commit 8b7b5a9946)

Co-authored-by: Pierre Le Marre <dev@wismill.eu>
2026-02-16 14:25:43 +02:00
Miss Islington (bot)
53b8e64150
[3.14] gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843) (#144858)
gh-144833: Fix use-after-free in SSL module when SSL_new() fails (GH-144843)

In newPySSLSocket(), when SSL_new() returns NULL, Py_DECREF(self)
was called before _setSSLError(get_state_ctx(self), ...), causing
a use-after-free. Additionally, get_state_ctx() was called with
self (PySSLSocket*) instead of sslctx (PySSLContext*), which is
a type confusion bug.

Fix by calling _setSSLError() before Py_DECREF() and using
sslctx instead of self for get_state_ctx().
(cherry picked from commit c91638ca06)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
2026-02-16 03:10:23 +00:00
Miss Islington (bot)
70ecd56113
[3.14] gh-144759: Fix undefined behavior from NULL pointer arithmetic in lexer (GH-144788) (#144834)
gh-144759: Fix undefined behavior from NULL pointer arithmetic in lexer (GH-144788)

Guard against NULL pointer arithmetic in `_PyLexer_remember_fstring_buffers`
and `_PyLexer_restore_fstring_buffers`. When `start` or `multi_line_start`
are NULL (uninitialized in tok_mode_stack[0]), performing `NULL - tok->buf`
is undefined behavior. Add explicit NULL checks to store -1 as sentinel
and restore NULL accordingly.

Add test_lexer_buffer_realloc_with_null_start to test_repl.py that
exercises the code path where the lexer buffer is reallocated while
tok_mode_stack[0] has NULL start/multi_line_start pointers. This
triggers _PyLexer_remember_fstring_buffers and verifies the NULL
checks prevent undefined behavior.
(cherry picked from commit e6110efd03)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
2026-02-15 15:10:15 +00:00
Miss Islington (bot)
5b0c1f780f
[3.14] gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (GH-143892) (#144786)
gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (GH-143892)
(cherry picked from commit 82b92e3cd1)

Co-authored-by: Priyanshu Singh <priyanshu2282@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-02-14 17:07:32 +00:00
Miss Islington (bot)
77b71ac793
[3.14] gh-144766: Fix a crash in fork child process when perf support is enabled. (GH-144795) (#144816) 2026-02-14 12:09:00 +00:00
Zachary Ware
a7f06e3840
[3.14] gh-144551: Update Windows builds to use OpenSSL 3.0.19 (GH-144797)
(cherry picked from commit 928602c0ac)
2026-02-13 19:38:31 +00:00
Miss Islington (bot)
ac9e9e2c8f
[3.14] gh-80667: Fix case-sensitivity of some Unicode literal escapes (GH-107281) (GH-144753)
Lookup for CJK ideograms and Hangul syllables is now case-insensitive,
as is the case for other character names.
(cherry picked from commit e66f4a5a9c)

Co-authored-by: James <snoopjedi@gmail.com>
2026-02-12 17:22:05 +00:00
Serhiy Storchaka
4d3e8c1c85
[3.14] gh-84424: Use numeric_changed for UCD.numeric (GH-19457) (GH-144731)
This was causing ucd_3_2_0.numeric() to pick up only decimal
changes between Unicode 3.2.0 and the current version.
(cherry picked from commit 3e0322ff16)

Co-authored-by: William Meehan <wmeehan@fb.com>
2026-02-12 08:38:27 +00:00
Miss Islington (bot)
7d074702eb
[3.14] gh-143650: Fix importlib race condition on import failure (GH-143651) (#144662)
gh-143650: Fix importlib race condition on import failure (GH-143651)

Fix a race condition where a thread could receive a partially-initialized
module when another thread's import fails. The race occurs when:

1. Thread 1 starts importing, adds module to sys.modules
2. Thread 2 sees the module in sys.modules via the fast path
3. Thread 1's import fails, removes module from sys.modules
4. Thread 2 returns a stale module reference not in sys.modules

The fix adds verification after the "skip lock" optimization in both Python
and C code paths to check if the module is still in sys.modules. If the
module was removed (due to import failure), we retry the import so the
caller receives the actual exception from the import failure rather than
a stale module reference.
(cherry picked from commit ac8b5b6890)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 06:06:51 +00:00
Bartosz Sławecki
616e611844
[3.14] gh-144563: Fix remote debugging with duplicate libpython mappings from ctypes (GH-144595) (#144655) 2026-02-10 14:31:49 +00:00
Miss Islington (bot)
13b3dd0622
[3.14] gh-143543: Fix re-entrant use-after-free in itertools.groupby (GH-143738) (GH-144626)
(cherry picked from commit a91b5c3fb5)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-10 14:01:10 +01:00
Miss Islington (bot)
2e3f0146f2
[3.14] gh-144363: Update bundled libexpat to 2.7.4 (GH-144365) (GH-144499)
(cherry picked from commit d5cb9f6a9b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-09 14:21:54 +01:00
Miss Islington (bot)
226eb88ff2
[3.14] gh-144538: Upgrade bundled pip to 26.0.1 (gh-144556) (#144562)
gh-144538: Upgrade bundled pip to 26.0.1 (gh-144556)

Upgrade bundled pip to 26.0.1
(cherry picked from commit f4364a51c1)

Co-authored-by: Damian Shaw <damian.peter.shaw@gmail.com>
2026-02-07 14:22:45 +02:00
Miss Islington (bot)
6006005893
[3.14] gh-144446: Fix some frame object thread-safety issues (gh-144479) (#144546)
Fix thread-safety issues when accessing frame attributes while another
thread is executing the frame:

- Add critical section to frame_repr() to prevent races when accessing
  the frame's code object and line number

- Add _Py_NO_SANITIZE_THREAD to PyUnstable_InterpreterFrame_GetLasti()
  to allow intentional racy reads of instr_ptr.

- Fix take_ownership() to not write to the original frame's f_executable
(cherry picked from commit 5bb3bbb9c6)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-02-06 15:25:36 +00:00
Miss Islington (bot)
f4239df276
[3.14] gh-140414: add fastpath for current running loop in asyncio.all_tasks (GH-140542) (#144494)
* gh-140414: add fastpath for current running loop in `asyncio.all_tasks` (GH-140542)

Optimize `asyncio.all_tasks()` for the common case where the event loop is running in the current thread by avoiding stop-the-world pauses and locking.

This optimization is already present for `asyncio.current_task()` so we do the same for `asyncio.all_tasks()`.
(cherry picked from commit 95e5d59630)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-02-06 08:48:06 +05:30
Hugo van Kemenade
323c59a5e3 Python 3.14.3 2026-02-03 17:32:20 +02:00
Miss Islington (bot)
72ec166846
[3.14] gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713) (#144396)
gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713)
(cherry picked from commit 39f16a93ef)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-02-03 11:38:50 +01:00
Miss Islington (bot)
b3937135a6
[3.14] gh-144415: Android testbed fixes (GH-142912) (#144416)
Modifies handling of `.gz` files in Android app payloads, and ensures that
when the Android testbed streams logs, stream flushes aren't treated as
newlines. This improves the output of test suites that use "one dot per test"
progress indicators.
(cherry picked from commit cb1dc91dcb)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2026-02-03 17:18:49 +08:00
Miss Islington (bot)
343679ee6a
[3.14] gh-144380: Fix incorrect type check in buffered_iternext() (GH-144381) (#144389)
gh-144380: Fix incorrect type check in `buffered_iternext()` (GH-144381)
(cherry picked from commit 40d07cad38)

Co-authored-by: Ruiyang Ke <me@ry.ke>
2026-02-02 10:30:34 +00:00
Miss Islington (bot)
49ce23f2d7
[3.14] gh-144307: Fix a reference leak during module teardown (GH-144308) (GH-144327)
gh-144307: Fix a reference leak during module teardown (GH-144308)
(cherry picked from commit 219b7ac9d5)

Signed-off-by: Yongtao Huang <yongtaoh2022@gamil.com>
Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-01-29 19:19:14 +00:00
Miss Islington (bot)
157e946d78 [3.14] gh-144194: Fix mmap failure check in perf_jit_trampoline.c (GH-143713) (#144301)
gh-144194: Fix mmap failure check in perf_jit_trampoline.c (GH-143713)

mmap() returns MAP_FAILED ((void*)-1) on error, not NULL. The current
check never detects mmap failures, so jitdump initialization proceeds
even when the memory mapping fails.
(cherry picked from commit 8fe8a94a7c)

Co-authored-by: stratakis <cstratak@redhat.com>
2026-01-28 13:57:19 +00:00
Miss Islington (bot)
237467f474
[3.14] gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (GH-144108) (#144244)
gh-144100: Fix crash for POINTER(str) used in ctypes argtypes (GH-144108)
(cherry picked from commit 8f459255eb)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-26 12:53:20 +00:00
Miss Islington (bot)
7ae9a479cf
[3.14] gh-144169: Fix three crashes in AST objects with non-str kwargs (GH-144178) (#144227)
gh-144169: Fix three crashes in AST objects with non-str kwargs (GH-144178)
(cherry picked from commit 639c1ad4f1)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-01-26 12:14:39 +00:00
Miss Islington (bot)
7877fe4244
[3.14] gh-144125: email: verify headers are sound in BytesGenerator (#144182)
gh-144125: email: verify headers are sound in BytesGenerator
(cherry picked from commit 052e55e7d4)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Denis Ledoux <dle@odoo.com>
Co-authored-by: Denis Ledoux <5822488+beledouxdenis@users.noreply.github.com>
Co-authored-by: Petr Viktorin <302922+encukou@users.noreply.github.com>
Co-authored-by: Bas Bloemsaat <1586868+basbloemsaat@users.noreply.github.com>
2026-01-25 19:18:08 +02:00
Miss Islington (bot)
c9548f3dfc
[3.14] gh-143237: Fix support of named pipes in the rotating logging handlers (GH-143259) (#143297)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-25 17:11:45 +00:00
Miss Islington (bot)
61614a5e50
[3.14] gh-143935: Email preserve parens when folding comments (GH-143936) (#144034)
Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Denis Ledoux <dle@odoo.com>
2026-01-25 17:11:33 +00:00
Miss Islington (bot)
05356b1cc1
[3.14] gh-143925: Reject control characters in data: URL mediatypes (#144084)
Co-authored-by: Seth Michael Larson <seth@python.org>
2026-01-23 13:45:00 +02:00
Miss Islington (bot)
712452e6f1
[3.14] gh-143919: Reject control characters in http cookies (#144089)
Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2026-01-23 13:44:29 +02:00
Miss Islington (bot)
1fa166888b
[3.14] gh-143513: Remove importlib.abc documentation for removed ABCs (GH-143605) (GH-144166)
gh-143513: Remove importlib.abc documentation for removed ABCs (GH-143605)

In 3.11 ResourceReader, Traversable, & TraversableResources moved from importlib.abc to importlib.resources.abc (commit e712a5b277).

In 3.12 old import locations were deprecated (commit 71848c9609).

In 3.14 backwards-compat support was removed (commit 0751511d24).
(cherry picked from commit f8262b84f5)

Co-authored-by: Alex Willmer <alex@moreati.org.uk>
Co-authored-by: Brett Cannon <brett@python.org>
2026-01-22 14:44:32 -08:00
Stan Ulbrych
fbc81558a4
[3.14] gh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022) (#144151)
[3.14] gh-144023: Prevent follow_symlinks from being allowed with an fd of 0 (GH-144022)

The check was (fd > 0), should be (fd >= 0).
(cherry picked from commit fa44efa0ef)

Co-authored-by: AZero13 <gfunni234@gmail.com>
2026-01-22 15:53:02 +00:00
Miss Islington (bot)
482a2536bc
[3.14] gh-143874: Use self.message instead of raw print in _exec_in_closure() (GH-143875) (#144061)
gh-143874: Use self.message instead of raw print in `_exec_in_closure()`  (GH-143875)
(cherry picked from commit e66597d6c8)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2026-01-20 16:35:30 -08:00
AN Long
f7567b44a1
[3.14] gh-144012: Check null binary op extend (GH-144014) (GH-144038)
(cherry picked from commit 54bedcf714)
2026-01-20 18:05:56 +00:00
Miss Islington (bot)
56cf72d626
[3.14] gh-144050: Fix stat.filemode pure Python file type detection (GH-144059) (GH-144073)
(cherry picked from commit fe629262c0)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
2026-01-20 12:47:21 +00:00
Miss Islington (bot)
6293e1e7b4
[3.14] gh-143999: Fix: handle suspended state on types.coroutine wrappers (GH-144000) (GH-144066)
(cherry picked from commit 76b484b9d1)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2026-01-20 12:59:42 +02:00
Miss Islington (bot)
f318126907
[3.14] gh-143774 - Improve IDLE Format Paragraph doc (GH-143775) (#144062)
gh-143774 - Improve IDLE Format Paragraph doc (GH-143775)

Add a reminder to not rewrap code line to the Menu => Format => Reformat Paragraph entry.
In Editing and Nagivagion, add a new 'Format block' subsection that defines 'paragraph'
to better match what is dependably handled as more or less expected.
In particular, specify equal indents and that the resulting indent equals original indent.
Also mention that selections are expanded to complete lines and how to modify max length.

(Also fix a couple case errors in cross references.)
(cherry picked from commit fa3abf5a51)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2026-01-20 09:34:29 +00:00
Miss Islington (bot)
8d42420fae
[3.14] gh-142461: Move misplaced NEWS entries to an appropriate section (GH-143392) (GH-144039)
(cherry picked from commit 72bacb0cd0)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
2026-01-19 13:07:31 +00:00
Miss Islington (bot)
2147d3fa2b
[3.14] gh-143831: Compare cells by identity in forward references (GH-143848) (#144020)
gh-143831: Compare cells by identity in forward references (GH-143848)
(cherry picked from commit 59d3594ca1)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2026-01-19 05:57:54 +00:00
Miss Islington (bot)
23e3c0ae86
[3.14] gh-143916: Reject control characters in wsgiref.headers.Headers (GH-143917) (#143972)
gh-143916: Reject control characters in wsgiref.headers.Headers  (GH-143917)

* Add 'test.support' fixture for C0 control characters
* gh-143916: Reject control characters in wsgiref.headers.Headers
(cherry picked from commit f7fceed79c)

Co-authored-by: Seth Michael Larson <seth@python.org>
2026-01-17 18:11:52 +00:00
Miss Islington (bot)
e4c596dab8
[3.14] gh-133253: making linecache thread-safe (GH-133305) (gh-143910)
(cherry picked from commit 8054184f9f)

Co-authored-by: vfdev <vfdev.5@gmail.com>
2026-01-16 13:34:38 -05:00
Miss Islington (bot)
94ae09273e
[3.14] gh-65784: Add support for parametrized resource wantobjects in regrtests (GH-143570) (GH-143913)
This allows to run Tkinter tests with the specified value of
tkinter.wantobjects, for example "-u wantobjects=0".
(cherry picked from commit 21ed1e2a94)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-16 17:04:33 +00:00
Sam Gross
0042384bd5
[3.14] gh-143880: Fix data race in functools.partial in free threading build (#143882)
gh-143880: Fix data race in `functools.partial` in free threading build

The assignment to `pto->vectorcall` isn't thread-safe in the free
threading build. Note that this is already fixed in the main branch.
2026-01-16 22:25:40 +05:30
Victor Stinner
1241432150
[3.14] gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629) (#143872)
gh-143602: Fix duplicate buffer exports in io.BytesIO.write (#143629)

Fix an inconsistency issue in io.BytesIO.write() where the buffer was exported
twice, which could lead to unexpected data overwrites and position drift when
the buffer changes between exports.

(cherry picked from commit c461aa99e2)

Co-authored-by: zhong <60600792+superboy-zjc@users.noreply.github.com>
2026-01-15 16:02:46 +00:00
Miss Islington (bot)
601ccb7f89
[3.14] gh-141805: Fix crash after concurrent addition objects with the same hash to set (GH-143815) (GH-143849)
This happens when the set contained several elements with the same hash,
and then some of them were removed.
(cherry picked from commit b8e925b4f8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-15 09:31:16 +02:00
Miss Islington (bot)
38f0114ff1
[3.14] gh-143635: Fix crash in ga_repr_items_list (GH-143670) (#143851)
gh-143635: Fix crash in `ga_repr_items_list` (GH-143670)
(cherry picked from commit bdba5f0db2)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-01-15 04:16:46 +00:00
Miss Islington (bot)
ae5760527a
[3.14] gh-106287: Do not write objects after an unmarshalling error (GH-132715) (GH-143832)
Writing out an object may involve a slot lookup, which is not safe to do with
an exception raised. In debug mode an assertion failure will occur if this
happens.
(cherry picked from commit ce8f5f98c6)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2026-01-14 11:52:20 +00:00
Miss Islington (bot)
4a191f9e70
[3.14] gh-143249: Fix buffer leak when overlapped operation fails to start on windows (GH-143250) (#143795)
gh-143249: Fix buffer leak when overlapped operation fails to start on windows (GH-143250)
(cherry picked from commit 103a384bfd)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2026-01-13 13:57:54 +00:00
Inada Naoki
5d26a0410e
[3.14] gh-143189: fix insertdict() for non-Unicode key (GH-143285) (#143771) 2026-01-13 11:58:53 +02:00
Miss Islington (bot)
f663aa226a
[3.14] gh-143706: Fix sys.argv not set during multiprocessing forkserver __main__ preload (GH-143717) (#143763)
gh-143706: Fix sys.argv not set during multiprocessing forkserver `__main__` preload (GH-143717)

The forkserver was not passing sys.argv to its main() function, causing
sys.argv to be empty during `__main__` module import in child processes. This
fixes a non-obvious regression inadvertently introduced by the gh-126631 main
preloading fix.
(cherry picked from commit 298d5440eb)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-01-13 00:13:41 +00:00
Miss Islington (bot)
7a066ad020
[3.14] gh-143196: Fix crash in non-standard use of internal JSON encoder object (GH-143618) (GH-143748)
The internal encoder object returned by undocumented function
json.encoder.c_make_encoder() (aka _json.make_encoder()) crashed
when it was called with non-zero second argument.
(cherry picked from commit c559135c93)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-12 18:50:40 +00:00
Miss Islington (bot)
9c7785e83a
[3.14] gh-142461: Move misplaced NEWS entries to an appropriate section (GH-143411) (GH-143746)
(cherry picked from commit 3d44f0ab65)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
2026-01-12 18:20:11 +00:00