Commit graph

55745 commits

Author SHA1 Message Date
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
Miss Islington (bot)
f24009feeb
[3.14] gh-144787: [tests] Allow TLS v1.2 to be minimum version (GH-144790) (#144791)
gh-144787: [tests] Allow TLS v1.2 to be minimum version (GH-144790)

Allow TLS v1.2 to be minimum version

Updates test_min_max_version to allow TLS v1.2 to be minimum version if
TLS 1.0 and 1.1 are disabled in OpenSSL.
(cherry picked from commit d625f7da33)

Co-authored-by: Colin McAllister <colinmca242@gmail.com>
2026-02-13 12:28:06 -08:00
Victor Stinner
c11e70a712
[3.14] gh-135906: Test more internal headers in test_cext/test_cppext (#144758)
* gh-141563: Enable test_cppext internal C API tests on macOS (#144711)

Build the C API in C++11 mode on macOS.

(cherry picked from commit c6e418d174)

* gh-135906: Test more internal headers in test_cext/test_cppext (#144751)

(cherry picked from commit b488f338cf)
2026-02-13 08:30:22 +01: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
Hugo van Kemenade
bbd682d1f4
[3.14] gh-144639: Ruff: target Python 3.14 syntax in Lib/test (GH-144656) (#144710)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2026-02-11 17:33:51 +02: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
Victor Stinner
815f21bda9
[3.14] gh-144490: Test the internal C API in test_cext (#144678)
Backport changes from the main branch.

Test also datetime.h in test_cppext.
2026-02-10 20:04:13 +00:00
Miss Islington (bot)
befa954efe
[3.14] gh-144629: Add test for the PyFunction_GetAnnotations() function (GH-144630) (#144670)
gh-144629: Add test for the PyFunction_GetAnnotations() function (GH-144630)
(cherry picked from commit cc81707e40)

Co-authored-by: Nybblista <170842536+nybblista@users.noreply.github.com>
2026-02-10 15:05:25 +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
Victor Stinner
8b4210c30e
[3.14] gh-138744: Skip test_dtrace on Windows (#144657)
Co-authored-by: Ken Jin <kenjin@python.org>
2026-02-10 15:30:05 +01: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)
caab302332
[3.14] gh-144652: Support Windows exit status in support get_signal_name() (GH-144653) (#144658)
gh-144652: Support Windows exit status in support get_signal_name() (GH-144653)

Format Windows exit status as hexadecimal.
(cherry picked from commit b121dc4347)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-02-10 11:42:26 +00:00
Victor Stinner
2abaf12917
[3.14] gh-144490: Test the internal C API in test_cppext (#144547)
Backport changes from the main branch.
2026-02-10 11:55:57 +01:00
Miss Islington (bot)
9cc8e4948c
[3.14] gh-134179: Use sys._clear_internal_caches() at test_cmd_line (GH-134180) (#144631)
gh-134179: Use sys._clear_internal_caches() at test_cmd_line (GH-134180)

Use sys._clear_internal_caches() instead of deprecated sys._clear_type_cache() at test_cmd_line.
(cherry picked from commit dd2da42ea4)

Co-authored-by: alexey semenyuk <alexsemenyuk88@gmail.com>
2026-02-09 15:06:28 +00: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
Victor Stinner
160810de89
[3.14] gh-144330: Initialize classmethod and staticmethod in new (#144498)
gh-144330: Initialize classmethod and staticmethod in new

Initialize cm_callable and sm_callable to None in classmethod and
staticmethod constructor.

Co-authored-by: Aniket Singh Yadav <singhyadavaniket43@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-06 10:21:02 +01:00
Serhiy Storchaka
2fb9cde118
[3.14] gh-144148: Update the urllib.parse documentation (GH-144497) (GH-144507)
Document urlsplit() as the main parsing function and urlparse() as
an obsolete variant.
(cherry picked from commit 67ddba9aa9)
2026-02-05 17:24:24 +02:00
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)
5af4e680a9
[3.14] gh-75572: Speed up test_xpickle (GH-144393) (GH-144403)
Run a long living subprocess which handles multiple requests instead of
running a new subprocess for each request.
(cherry picked from commit 29acc08c8d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-02-03 10:34:16 +00: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)
8ba2ddb95c
[3.14] gh-144348: annotationlib: fix test that relies on set ordering (GH-144359) (#144375)
gh-144348: annotationlib: fix test that relies on set ordering (GH-144359)
(cherry picked from commit b6256014be)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-02-02 15:12:12 +00:00
Sam Gross
06f9c8ca1c
[3.14] gh-144295: Fix data race in dict method lookup and global load (gh-144312) (#144346)
In `_Py_dict_lookup_threadsafe_stackref`, call `ensure_shared_on_read()` to
prevent a race between the lookup and concurrent dict resizes, which may free
the PyDictKeysObject (i.e., it ensures that the resize uses QSBR).

(cherry picked from commit e666a01ef4)
2026-01-30 12:15:47 -05:00
Miss Islington (bot)
d11c067246
[3.14] gh-126014: test_makefile_test_folders: Ignore basically-empty directories (GH-140466) (#144269)
gh-126014: test_makefile_test_folders: Ignore basically-empty directories (GH-140466)

The code in test_makefile was attempting to ignore any
non-interesting files, but missed some corners:

1. There is never a *file* called `__pycache__`.
2. A directory containing only a `__pycache__` subdirectory should be
   ignored.
3. A directory containing only hidden files should be ignored.

Simplify this all into a couple of filters that let us check for empty
lists.
(cherry picked from commit 17d447e993)

Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
2026-01-27 10:30:59 +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
Terry Jan Reedy
f3a6e8ed8d
[3.14] gh-135142: Initial 3.15 News3.txt entries (GH-144200) (#144201)
(cherry picked from commit 29f1e778fa)
2026-01-23 22:16:00 -05:00
Miss Islington (bot)
1947d6ea56
[3.14] gh-144027: Fix documentation for ignorechars in base64.a85decode() (GH-144028) (GH-144192)
It does not support an ASCII string.

Also add more tests.
(cherry picked from commit 25a10b60b0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-23 19:24:06 +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
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)
6ec94858bc
[3.14] gh-143959: Make _datetime optional for test_sys (GH-144003) (#144143)
gh-143959: Make _datetime optional for test_sys (GH-144003)
(cherry picked from commit c447d1bc14)

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2026-01-22 11:24:24 +00:00
Miss Islington (bot)
a74709d2c9
[3.14] gh-77188: Add pickle tests for objects with slots (GH-144116) (GH-144119)
(cherry picked from commit cf71e34940)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-21 17:47:27 +00:00
Miss Islington (bot)
aa223bdec6
[3.14] gh-144085: Add {gi,cr}_suspended to inspect comments and generator/coroutine tests (GH-144086) (#144104)
gh-144085: Add `{gi,cr}_suspended` to `inspect` comments and `generator/coroutine` tests (GH-144086)
(cherry picked from commit 4ef30a5871)

Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com>
2026-01-21 11:02:35 +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
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)
5573df18d9
[3.14] gh-143754: Modernize Tkinter docs (GH-143841) (GH-144032)
Use more relevant terminology instead of "master"/"slave" widgets where possible.
(cherry picked from commit 813fc7a291)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-01-19 12:27:32 +00:00
Miss Islington (bot)
ea18782814
[3.14] gh-143866: Verify return value of pathlib.write_{bytes,text} methods in tests (GH-143870) (#144029)
gh-143866: Verify return value of `pathlib.write_{bytes,text}` methods in tests (GH-143870)
(cherry picked from commit cb6a662bb0)

Co-authored-by: b9788213 <b9788213@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
2026-01-19 11:50:54 +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