Commit Graph

130167 Commits

Author SHA1 Message Date
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
Aarni Koskela 40a82abe93 Clarify the docs for args in asyncio callbacks (#143873)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-02-10 13:10:01 +00: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
kovan 9b8d59c136 gh-72798: Add mapping example to str.translate documentation (#144454)
Add an example showing how to use str.translate() with a dictionary
mapping directly, demonstrating character replacement and deletion.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 11:13:40 +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
Joshua Root d2d245942e gh-144648: Improve libproc usage in _remote_debugging (#144649) 2026-02-10 08:29:55 +00:00
Ned Deily 704b915494 gh-144551: Update macOS installer to use OpenSSL 3.5.5 (#144645) 2026-02-10 01:45:55 -05:00
Ned Deily 2042e26f8d gh-124111: Update macOS installer to use Tcl/Tk 9.0.3 (#144646) 2026-02-10 01:45:06 -05:00
Hugo van Kemenade 80ba4e10f5 Disable pip version check when upgrading certifi (#144632) 2026-02-09 22:04:52 -05: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
Savannah Ostrowski 30cfe6ee23 GH-144552: Clean up tail-call.yml CI (#144553)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-02-09 14:52:45 -08:00
Stan Ulbrych fd190d1fa1 gh-144492: Fix process_changed_files outputs for reusable-{macos, wasi}.yml (#144518)
Fix `process_changed_files` double-processing reusable-{macos, wasi] ending up with incorrect outputs
2026-02-09 19:30:19 +02: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
Hai Zhu 988286e510 gh-144623: Fix missing output uops in optimizer debug output (GH-144617) 2026-02-09 13:23:02 +00:00
Kumar Aditya dd30f16ac0 gh-141563: make PyDateTime_IMPORT thread-safe (#144210) 2026-02-09 13:20:35 +00: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
Sergey B Kirpichev aa6ed802f2 gh-119740: Remove obsoleted removal announce for trunc delegation (GH-144622)
This was done in GH-119743 (3.14).
2026-02-09 13:41:05 +02: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
Adorilson Bezerra 432ddd99e2 gh-106318: Add examples for str.partition() method (#142823) 2026-02-09 00:10:43 +02:00
Adorilson Bezerra 3dd7a3c65a gh-106318: Add example for str.isalnum() (#137550) 2026-02-09 00:08:18 +02:00
Sacul cfeede85a7 GH-131798: Optimize _GUARD_TOS_SLICE (GH-144470) 2026-02-08 18:08:26 +00:00
Guo Ci d73634935c For enum.bin, update versionadded directive from 3.10 to 3.11 (#144574) 2026-02-07 23:35:02 -08:00
Savannah Ostrowski e682141c49 Bump pre-commit hooks (#144576) 2026-02-07 23:14:18 +00:00
Bénédikt Tran 934997218e gh-143700: document secrets.DEFAULT_ENTROPY as an opaque value (#144568) 2026-02-07 23:36:42 +01:00
Guo Ci 6665115679 gh-84116: Add missing backslash to _SubParsersAction.add_parser signature (#144572) 2026-02-07 19:02:01 +01:00
kovan 0e7c06a858 gh-142044: Add note to prefer asyncio.timeout[_at] over asyncio.Timeout (#144449) 2026-02-07 12:22:51 +00:00
kovan 16efaa225c gh-140490: Document changes for PurePath.stem in Python 3.14 (#144450) 2026-02-07 13:19:20 +01: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
Alper a2495ff1e7 gh-144490: Fix C++ compatibility in pycore_cell.h (GH-144482) 2026-02-06 22:11:58 -05:00
Krishna-web-hub 74db4404ea gh-84116: Docs: Document help and aliases for argparse.add_parser() (#140574)
* gh-140281: Doc: Update free-threading how-to

* gh-140281: Doc: Update free-threading how-to

* Fix trailing whitespace

* doc fixing of the cpython fixes#84116

* Docs: Document help and aliases for argparse.add_parser() (gh-84116)

* Docs: Document help and aliases for argparse.add_parser() (gh-84116)

* Fix trailing whitespace

* Fix trailing whitespace

* Fix trailing whitespace

* Fix trailing whitespace

* Fix trailing whitespace

* Fix trailing whitespace

* Fix trailing errors

* Fix trailing errors and spaces

* Fix docutils formatting, NEWS ref, and trailing whitespace

* Docs: Update argparse.rst and add NEWS entry

* Delete Doc/howto/free-threading-python.rst

* Delete Misc/NEWS.d/next/Documentation/2025-10-25-00-49-43.gh-issue-140281.tuMQUe.rst

* adding the depreceated tag

* The error indexing was fixed

* Fix trailing whitespace

* Restore missing free-threading documentation

* fixing some minor error

* fixing some minor error part 2

* fixing some minor error part 3

* Fix NEWS entry format

* Final cleanup of NEWS entry format 2

* changes in the argparse.rst

* Remove unnecessary NEWS entry

* Fixing the issue as requested

* Added the Changes done before.

* done the changes

* done the changes#1

* Apply suggestion from @picnixz

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Apply suggestion from @picnixz

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Done the changes

* Done the new changes

* The versionadded is rectified

* Update Doc/library/argparse.rst

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>

* Docs editing

* Docs fixing whitespace

* Docs rectifiying

* little bit rectification

* Indentation rectification

* Indentation rectification 1

* Apply suggestion from @picnixz

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* deprecated rectification

* Remove mistakenly added NEWS entry

* Update Doc/library/argparse.rst

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* changes #1

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Update Doc/library/argparse.rst 2

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* removed useless thing

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* changed according to the request

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Updated the test part

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-06 13:26:44 -08:00
Ken Jin 895e83727d gh-144549: Fix tail calling interpreter on Windows for FT (GH-144550) 2026-02-06 19:20:28 +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
Stan Ulbrych fb196c6f32 gh-140715: Update datetime.*.str*time format code tables (GH-140716) 2026-02-06 17:08:26 +01: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 0fdf6a9a71 gh-144513: Skip critical section locking during stop-the-world (gh-144524)
When the interpreter is in a stop-the-world pause, critical sections
don't need to acquire locks since no other threads can be running.
This avoids a potential deadlock where lock fairness hands off ownership
to a thread that has already suspended for stop-the-world.
2026-02-06 15:14:08 +00: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
Sam Gross d891b2bbd1 gh-139103: Improve namedtuple scaling in free-threaded build (gh-144332)
Add `_Py_type_getattro_stackref`, a variant of type attribute lookup
that returns `_PyStackRef` instead of `PyObject*`. This allows returning
deferred references in the free-threaded build, reducing reference count
contention when accessing type attributes.

This significantly improves scaling of namedtuple instantiation across
multiple threads.

* Add blurb

* Rename PyObject_GetAttrStackRef to _PyObject_GetAttrStackRef

* Apply suggestion from @vstinner

Co-authored-by: Victor Stinner <vstinner@python.org>

* Apply suggestion from @vstinner

Co-authored-by: Victor Stinner <vstinner@python.org>

* format

* Update Include/internal/pycore_function.h

Co-authored-by: Victor Stinner <vstinner@python.org>

---------

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-02-06 09:43:05 -05:00
Ned Batchelder 638d22c6e7 Docs: module pages should not link to themselves (#144505)
* Docs: module pages should not link to themselves

* fix header punctuation
2026-02-06 06:48:27 -05:00
Petr Viktorin f85e1170d2 gh-141004: Reorganize and reword the 'Useful macros' section (GH-144471)
- Group the macros
- Roughly order them to put the most important ones first
- Add expansions where it makes sense; especially if there's
  an equivalent in modern C or a common compiler

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-02-06 11:55:11 +01:00