Commit graph

56501 commits

Author SHA1 Message Date
Colin McAllister
d625f7da33
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.
2026-02-13 17:17:53 +00:00
Priyanshu Singh
82b92e3cd1
gh-143637: Fix re-entrant mutation of ancillary data in socket.sendmsg() (#143892)
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-13 16:35:08 +01:00
Seth Michael Larson
66da7bf6fe
gh-143916: Allow HTAB in wsgiref header values
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-02-12 20:40:21 +00:00
Victor Stinner
b488f338cf
gh-135906: Test more internal headers in test_cext/test_cppext (#144751) 2026-02-12 19:40:42 +01:00
James
e66f4a5a9c
gh-80667: Fix case-sensitivity of some Unicode literal escapes (GH-107281)
Lookup for CJK ideograms and Hangul syllables is now case-insensitive,
as is the case for other character names.
2026-02-12 18:50:40 +02:00
Victor Stinner
9e5e1f9988
gh-121617: Include <string.h> for Py_CLEAR() macro (#144666)
Python.h now also includes <string.h> in the limited C API version 3.11
and newer to fix the Py_CLEAR() macro which uses memcpy().

Add a Py_CLEAR() test in test_cext.

Modify also _Py_TYPEOF to use C23 typeof() if available.
2026-02-12 17:03:55 +01:00
Bartosz Sławecki
b6b72e7663
gh-144285: Improve AttributeError attribute suggestions (#144299) 2026-02-12 14:12:49 +00:00
Pablo Galindo Salgado
7854597d88
gh-142349: Fix build errors from PEP 810 (#144726) 2026-02-12 08:18:36 +00:00
Pablo Galindo Salgado
46d5106cfa
gh-142349: Implement PEP 810 - Explicit lazy imports (#142351)
Co-authored-by: T. Wouters <twouters@meta.com >
Co-authored-by: Brittany Reynoso <breynoso@meta.com>
Co-authored-by: Dino Viehland <dinoviehland@meta.com>
2026-02-12 00:15:33 +00:00
William Meehan
3e0322ff16
gh-84424: Use numeric_changed for UCD.numeric (GH-19457)
This was causing ucd_3_2_0.numeric() to pick up only decimal
changes between Unicode 3.2.0 and the current version.
2026-02-11 20:58:24 +00:00
Victor Stinner
c6e418d174
gh-141563: Enable test_cppext internal C API tests on macOS (#144711)
Build the C API in C++11 mode on macOS.
2026-02-11 18:38:23 +01:00
Hugo van Kemenade
cf23fcd5f7 Merge branch 'main' of https://github.com/python/cpython 2026-02-11 17:34:44 +02:00
Hugo van Kemenade
81484c5629
gh-144639: Ruff: target Python 3.14 syntax in Lib/test (#144656)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2026-02-11 14:12:31 +00:00
bkap123
17ab556e39
gh-144321: Fix named tuple bug when input is a non-sequence iterable (#144600) 2026-02-11 12:44:22 +00:00
Hugo van Kemenade
15b216f30d Python 3.15.0a6 2026-02-11 14:23:15 +02:00
Victor Stinner
b67a64d7e2
gh-141563: Fix test_cppext on macOS (#144685)
Don't test internal header files including mimalloc on macOS since
mimalloc emits compiler warnings:

  In file included from extension.cpp:21:
  In file included from Include/internal/pycore_backoff.h:15:
  In file included from Include/internal/pycore_interp_structs.h:15:
  In file included from Include/internal/pycore_tstate.h:14:
  In file included from Include/internal/pycore_mimalloc.h:43:
  Include/internal/mimalloc/mimalloc.h:464:85: error: defaulted
  function definitions are a C++11 extension
  [-Werror,-Wc++11-extensions]
    mi_stl_allocator() mi_attr_noexcept = default;
                                                                                      ^
  Include/internal/mimalloc/mimalloc.h:465:85: error: defaulted
  function definitions are a C++11 extension
  [-Werror,-Wc++11-extensions]
    mi_stl_allocator(const mi_stl_allocator&) mi_attr_noexcept = default;

Log also CXX and CXXFLAGS env vars in test_cppext. Log also CPPFLAGS
in test_cext.
2026-02-10 20:31:12 +01:00
Victor Stinner
eb6d0e0b2b
gh-141563: Fix test_cext on Windows (#144677)
The 'module' argument is now always needed to call the test_datetime
method.
2026-02-10 17:27:44 +00:00
Victor Stinner
23d45f0c24
gh-141563: Don't test datetime.h with the limited C API (#144673)
Fix test_cext and test_cppext.
2026-02-10 15:45:24 +00:00
Victor Stinner
3dadc22a27
gh-141563: Add missing cast to _PyDateTime_IMPORT() (#144667)
Fix compilation on C++.

Add test on PyDateTime_IMPORT in test_cext and test_cppext.
2026-02-10 14:47:12 +00:00
Nybblista
cc81707e40
gh-144629: Add test for the PyFunction_GetAnnotations() function (#144630) 2026-02-10 14:38:24 +00:00
Sacul
6c8ca1c378
gh-134584: Optimize _BINARY_OP_SUBSCR_LIST_SLICE (GH-144659) 2026-02-10 22:33:32 +08:00
Gregory P. Smith
ac8b5b6890
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.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 14:08:33 +01:00
Victor Stinner
b121dc4347
gh-144652: Support Windows exit status in support get_signal_name() (#144653)
Format Windows exit status as hexadecimal.
2026-02-10 12:15:14 +01:00
Alper
73fa6be2fe
gh-144490: Fix mimalloc debug build for C++ (#144620) 2026-02-10 11:56:52 +01:00
Pablo Galindo Salgado
2c1ca6bb5b
gh-144563: Fix remote debugging with duplicate libpython mappings from ctypes (#144595)
When _ctypes is imported, it may call dlopen on the libpython shared
library, causing the dynamic linker to load a second mapping of the
library into the process address space. The remote debugging code
iterates memory regions from low addresses upward and returns the first
mapping whose filename matches libpython. After _ctypes is imported, it
finds the dlopen'd copy first, but that copy's PyRuntime section was
never initialized, so reading debug offsets from it fails.

Fix this by validating each candidate PyRuntime address before accepting
it. The validation reads the first 8 bytes and checks for the "xdebugpy"
cookie that is only present in an initialized PyRuntime. Uninitialized
duplicate mappings will fail this check and be skipped, allowing the
search to continue to the real, initialized PyRuntime.
2026-02-10 10:04:50 +00:00
Steve Dower
a9b6788ae6
gh-144278: Enable overriding sys.implementation's name and cache_tag when building sysmodule.c (GH-144293)
Changing the values requires forking and patching, which is intentional. Simply rebuilding from source does not change the implementation enough to justify changing these values - they would still be `cpython` and compatible with existing `.pyc` files. But people who maintain forks are better served by being able to easily override these values in a place that can be forward-ported reliably.
2026-02-10 00:01:17 +00:00
Victor Stinner
245ba3d6cb
gh-144490: Fix test_cppext on Windows (#144628)
Don't include pycore_backoff.h and pycore_cell.h on Windows, since
they emit C++ compiler warnings.
2026-02-09 17:17:00 +01:00
Peter Bierma
fd6b639a49
gh-144601: Avoid sharing exception objects raised in a PyInit function across multiple interpreters (GH-144602) 2026-02-09 16:57:03 +01:00
alexey semenyuk
dd2da42ea4
gh-134179: Use sys._clear_internal_caches() at test_cmd_line (#134180)
Use sys._clear_internal_caches() instead of deprecated sys._clear_type_cache() at test_cmd_line.
2026-02-09 15:40:17 +01:00
Bartosz Sławecki
ff531f9005
gh-132604: Deprecate inherited runtime checkability of protocols (GH-143806)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-02-09 15:13:47 +01:00
VanshAgarwal24036
a91b5c3fb5
gh-143543: Fix re-entrant use-after-free in itertools.groupby (GH-143738)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-09 15:12:25 +01:00
Jason Yalim, PhD
d99f3fc474
gh-140715: Add %F format code support to strptime() (GH-140647)
Also: add tests for the `%T` format code

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-09 13:24:15 +01:00
Petr Viktorin
b22ff1e543
gh-140550: allow slots that repeat information from PyModuleDef (GH-144340)
When integrating slots-based module creation is with the inittab,
which currently requires PyModuleDef, it would be convenient to
reuse the the same slots array for the MethodDef.

Allow slots that match what's already present in the PyModuleDef.
2026-02-09 11:35:43 +01:00
Sacul
cfeede85a7
GH-131798: Optimize _GUARD_TOS_SLICE (GH-144470) 2026-02-08 18:08:26 +00:00
Damian Shaw
f4364a51c1
gh-144538: Upgrade bundled pip to 26.0.1 (gh-144556)
Upgrade bundled pip to 26.0.1
2026-02-07 10:59:54 +00:00
Hugo van Kemenade
28fb13cb33
gh-143658: Use str.lower and replace to further improve performance of importlib.metadata.Prepared.normalized (#144083)
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2026-02-06 19:38:58 +02:00
Ken Jin
25e99b375d
gh-132132: Upgrade to VS 2026 on Windows tailcall CI (GH-144544)
Upgrade to VS 2026 on Windows tailcall CI
2026-02-06 16:36:51 +00:00
Victor Stinner
172135cc42
gh-144490: Fix test_cppext: test the internal C API (#144536)
Add missing TEST_INTERNAL_C_API env var.
2026-02-06 16:42:42 +01:00
Sam Gross
5bb3bbb9c6
gh-144446: Fix some frame object thread-safety issues (gh-144479)
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
2026-02-06 09:43:36 -05:00
kangtastic
45d4a34720
gh-101178: Add Ascii85, Base85, and Z85 support to binascii (GH-102753)
Add Ascii85, Base85, and Z85 encoders and decoders to binascii,
replacing the existing pure Python implementations in base64.

This makes the codecs two orders of magnitude faster and consume
two orders of magnitude less memory.

Note that attempting to decode Ascii85 or Base85 data of length 1 mod 5
(after accounting for Ascii85 quirks) now produces an error, as no
encoder would emit such data. This should be the only significant
externally visible difference compared to the old implementation.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-02-06 16:43:16 +02:00
Seth Michael Larson
957f9fe162
gh-74453: Deprecate os.path.commonprefix (#144436)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-02-05 22:37:05 +02:00
Zackery Spytz
01a1dd283b
gh-77188: Add support for pickling private methods and nested classes (GH-21480)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-02-05 19:50:51 +00:00
Serhiy Storchaka
4644fed819
gh-144001: Support ignoring the invalid pad character in Base64 decoding (GH-144306) 2026-02-05 21:14:49 +02:00
Serhiy Storchaka
67ddba9aa9
gh-144148: Update the urllib.parse documentation (GH-144497)
Document urlsplit() as the main parsing function and urlparse() as
an obsolete variant.
2026-02-05 16:32:17 +02:00
Victor Stinner
ffa68529b4
gh-144330: Initialize classmethod and staticmethod in new (#144469)
Move classmethod and staticmethod initialization from __init__() to
__new__().

PyClassMethod_New() and PyStaticMethod_New() now copy attributes of
the wrapped functions: __module__, __name__, __qualname__ and
__doc__.

Change static type initialization: initialize PyStaticMethod_Type and
PyCFunction_Type earlier.

Remove test_refleaks_in_classmethod___init__() and
test_refleaks_in_staticmethod___init__() tests from test_descr since
classmethod and staticmethod have no __init__() method anymore.
2026-02-05 11:32:56 +01:00
Mark Shannon
b53fc7caa6
GH-144179: Use recorded values to make optimizer more robust (GH-144437)
* Add three new symbol kinds
* Do not smuggle code object in _PUSH_FRAME operand
* Fix small bug in predicate analysis
2026-02-05 08:58:41 +00:00
Pieter Eendebak
009c8c052f
gh-123471: Make concurrent iteration over itertools.permutations and itertools.combinations_with_replacement thread-safe (gh-144402) 2026-02-04 13:38:45 -05:00
Serhiy Storchaka
dd0fde58cc
gh-143962: Improve name suggestions for not normalized names (GH-144154)
Suggest the normalized name or the closest name to the normalized name.
If the suggested name is not ASCII, include also its ASCII representation.
2026-02-04 17:23:09 +00:00
Victor Stinner
2aea861fe0
gh-140824: Fix _Py_DumpExtensionModules() to ignore sub-modules (#144339)
Ignore "math.integer" extension if "math" is in
sys.stdlib_module_names.
2026-02-04 16:06:35 +01:00
Serhiy Storchaka
f73d2e7003
gh-144386: Add support for descriptors in ExitStack and AsyncExitStack (#144420)
__enter__(), __exit__(), __aenter__(), and __aexit__() can now be
arbitrary descriptors, not only normal methods, for consistency with the
"with" and "async with" statements.
2026-02-04 13:20:18 +02:00