Commit graph

2062 commits

Author SHA1 Message Date
Miss Islington (bot)
400c7eca4a
[3.15] Docs: Fix incomplete sentence in tp_itemsize documentation (GH-152381) (GH-152417)
(cherry picked from commit 0a21a248cc)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
2026-06-27 13:52:57 +00:00
Miss Islington (bot)
bc52a01e71
[3.15] gh-140550: Docs additions & fixups for PEP 793 (GH-151661) (GH-152064)
gh-140550: Docs additions & fixups for PEP 793 (GH-151661)
(cherry picked from commit 763cc2209d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-06-24 14:00:28 +02:00
Hugo van Kemenade
cf16a33fad Python 3.15.0b3 2026-06-23 12:35:49 +03:00
Miss Islington (bot)
fd3c510827
[3.15] gh-146353: Document PyBytesWriter_GetData pointer validity (GH-151418) (GH-151664)
gh-146353: Document `PyBytesWriter_GetData` pointer validity (GH-151418)
(cherry picked from commit e99b319682)

Co-authored-by: Harjoth Khara <harjoth.khara@gmail.com>
2026-06-18 17:39:20 +00:00
Miss Islington (bot)
e9c7cc1f0b
[3.15] gh-149044: Improve Py_tp_base[s] docs & error message for non-type bases (GH-151252) (GH-151606)
gh-149044: Improve Py_tp_base[s] docs & error message for non-type bases (GH-151252)

The initial implementation of PEP 820 worsened the error message
when non-types are given as base types in Py_tp_bases & Py_tp_base.
Bring back the 'bases must be types' wording and add a 'got' note for
easier debugging.

Improve slot ID documentation, and soft-deprecate Py_tp_base
(as per the PEP).
(cherry picked from commit 16185e9fe2)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-06-18 10:17:15 +02:00
Miss Islington (bot)
ff6e973c3b
[3.15] gh-151218: Replace sys.flags in PyConfig_Set() (GH-151402) (#151552)
gh-151218: Replace sys.flags in PyConfig_Set() (GH-151402)

PyConfig_Set() and sys.set_int_max_str_digits() now replace
sys.flags (create a new object), instead of modifying sys.flags in-place.

Modifying sys.flags in-place can lead to data races when multiple
threads are reading or writing sys.flags in parallel.

Use _Py_atomic functions to get and set max_str_digits members.
(cherry picked from commit b16d23fc9f)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-06-16 16:48:56 +00:00
Miss Islington (bot)
488a03bd2b
[3.15] gh-149716: Document PySlot_DATA for Py_mod_gil and Py_mod_multiple_interpreters (GH-150053) (#151322)
Co-authored-by: Taeknology <20297177+Taeknology@users.noreply.github.com>
2026-06-16 14:52:39 +03:00
Miss Islington (bot)
9761ef9bb8
[3.15] Docs: Fix typos in the "Memory Management" section (GH-151243) (GH-151247)
Docs: Fix typos in the "Memory Management" section (GH-151243)
(cherry picked from commit 8c0e2515bb)

Co-authored-by: Manoj K M <manojkm24dev@gmail.com>
2026-06-10 13:21:48 +00:00
Serhiy Storchaka
0b6adeb20f
[3.15] gh-80384: Fix docs for PyWeakref_NewRef() and PyWeakref_NewProxy() (GH-151146)
The type of the callback argument is not checked.
2026-06-10 13:41:19 +03:00
Pablo Galindo Salgado
83e26a43a7
[3.15] gh-149321: Remove lazy_imports=none startup mode (GH-149389) (#150129) 2026-06-08 22:55:57 +00:00
Miss Islington (bot)
1f3ee9248a
[3.15] gh-101100: Fix Sphinx warnings in 'Buffer Object Structures' documentation (GH-151058)
(cherry picked from commit a1873300ee)

Co-authored-by: Christian Zinck <christian.zinck@gmail.com>
2026-06-08 10:32:43 +00:00
Miss Islington (bot)
ec9b40d740
[3.15] Doc: fix order of PyLong_FromUnsignedLongLong (GH-150937) (GH-151012)
(cherry picked from commit 4833b2031e)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2026-06-06 15:06:37 +03:00
Miss Islington (bot)
f3956c659a
[3.15] Fix 2 broken links in documentation (GH-150892)
(cherry picked from commit cb064e746d)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-04 09:51:34 +00:00
Miss Islington (bot)
0f08c550bc
[3.15] gh-141004: Document unstable perf map functions in ceval.h (GH-143492) (GH-150849)
gh-141004: Document unstable perf map functions in `ceval.h` (GH-143492)
(cherry picked from commit 6453065db9)

Co-authored-by: Yashraj <yashrajpala8@gmail.com>
2026-06-03 12:44:34 +00:00
Miss Islington (bot)
1c2daa08fb
[3.15] gh-150319: Replace all documentation which says "See PEP 585" (GH-150325) (#150808)
gh-150319: Replace all documentation which says "See PEP 585" (GH-150325)

* Replace all documentation which says "See PEP 585"

The following classes in the stdlib get simple updates:

- array.array
- asyncio.Future
- asyncio.Task
- collections.defaultdict
- collections.deque
- contextvars.ContextVar
- contextvars.Token
- ctypes.Array
- os.DirEntry
- re.Match
- re.Pattern
- string.templatelib.Interpolation
- string.templatelib.Template
- types.MappingProxyType
- queue.SimpleQueue
- weakref.ref

The following classes are documented publicly as functions, and are
therefore updated internally (`__class_getitem__.__doc__`) but not in the
public docs:

- functools.partial
- itertools.chain

The following builtin types have updates to `__class_getitem__.__doc__`
but not to any documentation pages:

- BaseExceptionGroup
- coroutines (from generators)
- dict
- enumerate
- frozendict
- frozenset
- generators (and async generators)
- list
- memoryview
- set
- slice
- tuple

Special cases:

- union objects are now documented as "supporting class-level []",
  rather than anything to do with generics.

- Templates might be generic over a single type (union, in theory) or
  over a TypeVarTuple. As this is not currently fully settled, it is
  marked with a comment and a mild hint that it is a single type is used
  (namely, "type" is singular rather than "types", plural)

* Apply suggestions from code review



* Correct several class getitem docs

And expand the text for tuples.



* Add notes on generic typing of builtins

* Fix typo in tuple.__class_getitem__ docstring

* Typo fix: malformed refs

Fix `generic` links which weren't marked as `:ref:`.

* Strike unnecessary docs on generic-ness



* Apply suggestions from code review

These are applied at both the originally indicated locations and in the
corresponding docstring definitions.



* Update Doc/library/re.rst



* Update Objects/enumobject.c



* Remove tuple generic doc in 'stdtypes' page

This is covered in more detail in the cross-linked typing documentation.
The other copy of this documentation -- in the docstring for
`tuple.__class_getitem__` -- is left in place.

* Fix whitespace around new doc of generics

Per review, do not introduce or remove whitespace such that section
breaks are altered by the introduction of doc on various generic types.

In most cases, this is a removal of an extra line.

In one case (Arrays), it is the reintroduction of a line.

Additionally, two other minor fixes are included:
- incorrect indent on 'defaultdicts'
- make `mappingproxy.__class_getitem__.__doc__` consistent with other
  mapping type generic docs



* Move placement of memoryview generic note

Previous placement was at the end of the main docstring, which is
consistent with other types but places it after a section on various
methods (which makes it read somewhat inconsistently). Moving it up
helps resolve.



* Ensure sphinxdoc does not start sentences lowercase

Lowercase class names at the start of sentences are marked out with the
`class` role. In the case of `deque`, documentation already refers to
these as `Deques`, so this form is preferred.

* Apply suggestions from code review



* Fix line endings and wrap more tightly

Line endings fixed by pre-commit ; also re-wrapped the MappingProxyType
text which was too long.

* Use 'ContextVars' style in sphinx doc

---------
(cherry picked from commit 50fe49c879)

Co-authored-by: Stephen Rosen <sirosen@globus.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <906600+JelleZijlstra@users.noreply.github.com>
Co-authored-by: Alex Waygood <66076021+AlexWaygood@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-06-02 20:40:52 +00:00
Miss Islington (bot)
8fcec28e66
[3.15] Fix typos in C API documentation (GH-149588) (#149662)
Co-authored-by: pengyu lee <lipengyu@kylinos.cn>
2026-06-02 14:31:13 +03:00
Miss Islington (bot)
0472179937
[3.15] Fix two typos in 'Exception Handling' C-API documentation (GH-150674) (#150772)
(cherry picked from commit cee3327b92)

Co-authored-by: Manoj K M <manojkm24dev@gmail.com>
2026-06-02 09:22:17 +00:00
Miss Islington (bot)
f5231469b5
[3.15] gh-148829: Make sentinels' repr and module customizable (GH-149654) (#150092)
Implementation of python/peps#4968.
(cherry picked from commit 08218030a5)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-22 07:44:34 -07:00
Miss Islington (bot)
894ec10b56
[3.15] Fix incorrect sentence in stable.rst (GH-149684) (GH-149814)
(cherry picked from commit 374f9d3f5e)

Co-authored-by: Manoj K M <manojkmdev24@gmail.com>
2026-05-14 01:34:59 +02:00
Miss Islington (bot)
a5f77a13fd
[3.15] gh-148829: Add PySentinel_CheckExact() (GH-149725) (#149766)
gh-148829: Add PySentinel_CheckExact() (GH-149725)
(cherry picked from commit 94df62542c)

Co-authored-by: scoder <stefan_ml@behnel.de>
2026-05-13 10:39:38 +00:00
Miss Islington (bot)
f488c7d45f
[3.15] Fix minor typos in unicode.rst (GH-149587) (#149620)
Fix minor typos in unicode.rst (GH-149587)
(cherry picked from commit 4e97ff3351)

Co-authored-by: Manoj K M <manojkmdev24@gmail.com>
2026-05-09 21:39:35 +00:00
Miss Islington (bot)
20e298bc37
[3.15] docs: Clarify docs for error case of PyDict_GetItemRef (GH-149506) (#149546)
docs: Clarify docs for error case of `PyDict_GetItemRef` (GH-149506)
(cherry picked from commit 3565d31690)

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
2026-05-08 16:36:52 +05:30
Hugo van Kemenade
f31a89bb90 Python 3.15.0b1 2026-05-07 16:26:31 +03:00
Peter Bierma
2b7c28a440
gh-149101: Implement PEP 788 (GH-149116)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-05-06 17:39:30 -04:00
Alex Malyshev
646853df13
gh-145559: Add PyUnstable_DumpTraceback() and PyUnstable_DumpTracebackThreads() (#148145)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-06 15:01:12 +00:00
Anuj Nitin Bharambe
f6d16a0d70
gh-149216: Notify type watchers on heap type deallocation (GH-149236)
Authored-by: Anuj Bharambe <anujnitinb@gmail.com>
2026-05-05 11:24:07 +01:00
Petr Viktorin
508b49845d
gh-149044: Implement PEP 820 – PySlot: Unified slot system for the C API (GH-149055)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-05-05 09:18:04 +02:00
Petr Viktorin
6ca5cdba18
gh-149225: Expose Py_CriticalSection in Stable ABI (GH-149227) 2026-05-04 17:32:17 +02:00
Diego Russo
c7b7ca2cd5
GH-126910: Add gdb support for unwinding JIT frames (#146071)
Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
2026-05-02 13:42:03 +00:00
Jelle Zijlstra
29a92abb60
gh-148829: Implement PEP 661 (#148831)
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-27 19:28:30 -07:00
Stan Ulbrych
3fd61b74de
Use soft-deprecated in more places (#148769) 2026-04-20 17:00:35 +01:00
Hugo van Kemenade
e9bbf8617d
Add a new Sphinx soft-deprecated directive (#148630)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-18 11:37:54 +03:00
Dino Viehland
c0af5c024b
gh-146031: Allow keeping specialization enabled when specifying eval frame function (#146032)
Allow keeping specialization enabled when specifying eval frame function
2026-04-16 09:44:26 -07:00
Petr Viktorin
0fcf2b72d3
gh-146636: PEP 803: Reference documentation (GH-148013)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-16 14:17:44 +02:00
Gregory P. Smith
64afa947f4
gh-146302: make Py_IsInitialized() thread-safe and reflect true init completion (GH-146303)
## Summary

- Move the `runtime->initialized = 1` store from before `site.py` import to the end of `init_interp_main()`, so `Py_IsInitialized()` only returns true after initialization has fully completed
- Access `initialized` and `core_initialized` through new inline accessors using acquire/release atomics, to also protect from data race undefined behavior
- `PySys_AddAuditHook()` now uses the accessor, so with the flag move it correctly skips audit hook invocation during all init phases (matching the documented "after runtime initialization" behavior) ... We could argue that running these earlier would be good even if the intent was never explicitly expressed, but that'd be its own issue.

## Motivation

`Py_IsInitialized()` returned 1 while `Py_InitializeEx()` was still running — specifically, before `site.py` had been imported. See https://github.com/PyO3/pyo3/issues/5900 where a second thread could acquire the GIL and start executing Python with an incomplete `sys.path` because `site.py` hadn't finished.

The flag was also a plain `int` with no atomic operations, making concurrent reads a C-standard data race, though unlikely to manifest.

## Regression test:

The added test properly fails on `main` with `ERROR: Py_IsInitialized() was true during site import`.

---

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 21:54:23 +00:00
Kumar Aditya
dd88e77fad
gh-142518: add thread safety docs for set C-APIs (#146562)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-10 19:33:24 +00:00
Lysandros Nikolaou
15d10a8243
gh-142518: annotate dict C-APIs for thread safety (#145875) 2026-04-10 18:41:12 +00:00
Victor Stinner
8c524503cd
gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (#148251) 2026-04-09 13:53:10 +02:00
Petr Viktorin
8923ca418c
gh-145921: Add "_DuringGC" functions for tp_traverse (GH-145925)
There are newly documented restrictions on tp_traverse:

    The traversal function must not have any side effects.
    It must not modify the reference counts of any Python
    objects nor create or destroy any Python objects.

* Add several functions that are guaranteed side-effect-free,
  with a _DuringGC suffix.
* Use these in ctypes
* Consolidate tp_traverse docs in gcsupport.rst, moving unique
  content from typeobj.rst there

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-08 09:15:11 +02:00
Kumar Aditya
03d712e9ba
gh-142518: add thread safety annotations for tuple C-API (#148012) 2026-04-08 01:55:44 +05:30
Hugo van Kemenade
d518f15ea4 Merge branch 'main' of https://github.com/python/cpython 2026-04-07 20:34:01 +03:00
Victor Stinner
feee573f36
gh-148014: Accept a function name in -X presite option (#148015) 2026-04-07 14:05:39 +00:00
Hugo van Kemenade
55ea59e7dc Python 3.15.0a8 2026-04-07 14:24:03 +03:00
Pablo Galindo Salgado
ca960b6f38
gh-148110: Resolve lazy import filter names for relative imports (#148111) 2026-04-06 22:29:02 +01:00
Petr Viktorin
a86963b3e2
gh-146636: Py_mod_abi mandatory for modules created from slots array (GH-146855) 2026-04-02 13:54:21 +02:00
Petr Viktorin
2452324001
gh-146636: PEP 803: add Py_TARGET_ABI3T and .abi3t.so extension (GH-146637)
- Add Py_TARGET_ABI3T macro.
- Add ".abi3t.so" to importlib EXTENSION_SUFFIXES.
- Remove ".abi3.so" from importlib EXTENSION_SUFFIXES on Free Threading.
- Adjust tests

This is part of the implementation for PEP-803.
Detailed documentation to come later.

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
2026-04-01 16:14:59 +02:00
Boy Steven
9e1f1644cd
Docs: fill in descriptor C API docs (GH-146644) 2026-03-31 17:52:11 -04:00
Kumar Aditya
5466f57ead
gh-142518: add thread safety annotations for bytearray C-API (#146514) 2026-03-27 18:40:26 +05:30
Kumar Aditya
6a94980301
gh-142518: add thread safety docs on bytes C-API (#146415) 2026-03-27 18:31:18 +05:30
Petr Viktorin
91cd2e5806
gh-146175: Soft-deprecate outdated macros; convert internal usage (GH-146178)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-23 12:42:09 +01:00