cpython/Doc/c-api
Stephen Rosen 50fe49c879
gh-150319: Replace all documentation which says "See PEP 585" (#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

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

* Correct several class getitem docs

And expand the text for tuples.

Co-authored-by: Jelle Zijlstra <906600+JelleZijlstra@users.noreply.github.com>

* 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

Co-authored-by: Jelle Zijlstra <906600+JelleZijlstra@users.noreply.github.com>

* Apply suggestions from code review

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

Co-authored-by: Alex Waygood <66076021+AlexWaygood@users.noreply.github.com>

* Update Doc/library/re.rst

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Update Objects/enumobject.c

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* 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

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

* 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.

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

* 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

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

* 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

---------

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 21:13:34 +01:00
..
abstract.rst gh-85275: Remove old buffer APIs (#105137) 2023-06-02 01:12:40 +00:00
allocation.rst Add a new Sphinx soft-deprecated directive (#148630) 2026-04-18 11:37:54 +03:00
apiabiversion.rst gh-143578: Restore note about patchlevel.h (#143596) 2026-01-12 11:21:14 +00:00
arg.rst Python 3.15.0a7 2026-03-10 14:31:15 +02:00
bool.rst gh-110481, doc: Add "immortal" term to the glossary (#112180) 2023-11-17 15:09:19 +01:00
buffer.rst Use soft-deprecated in more places (#148769) 2026-04-20 17:00:35 +01:00
bytearray.rst gh-142518: add thread safety annotations for bytearray C-API (#146514) 2026-03-27 18:40:26 +05:30
bytes.rst Add a new Sphinx soft-deprecated directive (#148630) 2026-04-18 11:37:54 +03:00
call.rst gh-141004: Document old provisional names for vectorcall/code API (GH-143568) 2026-01-14 10:54:45 +01:00
capsule.rst gh-141004: Document PyCapsule_Type (GH-141079) 2025-11-07 09:09:38 -05:00
cell.rst Fix minor typos and wording in C API docs (#140955) 2025-11-03 22:04:46 +02:00
code.rst Use soft-deprecated in more places (#148769) 2026-04-20 17:00:35 +01:00
codec.rst gh-141004: Document Py_hexdigits (GH-141059) 2025-11-06 08:48:42 -05:00
complex.rst Fix minor typos and wording in C API docs (#140955) 2025-11-03 22:04:46 +02:00
concrete.rst gh-148829: Implement PEP 661 (#148831) 2026-04-27 19:28:30 -07:00
contextvars.rst gh-124872: Replace enter/exit events with "switched" (#125532) 2024-10-16 13:53:21 +02:00
conversion.rst gh-141004: Mark up constants for PyOS_double_to_string (GH-143867) 2026-01-22 11:53:17 +01:00
coro.rst bpo-42528: Improve the docs of most Py*_Check{,Exact} API calls (GH-23602) 2021-01-06 12:38:26 +01:00
curses.rst gh-141004: document curses C API (#141254) 2025-11-09 15:44:26 +00:00
datetime.rst add whatsnew entry for PyUnstable_SetImmortal and PyDatetime_IMPORT (#144830) 2026-02-15 20:21:54 +05:30
descriptor.rst Use soft-deprecated in more places (#148769) 2026-04-20 17:00:35 +01:00
dict.rst docs: Clarify docs for error case of PyDict_GetItemRef (#149506) 2026-05-08 10:53:44 +00:00
exceptions.rst Fix two typos in 'Exception Handling' C-API documentation (#150674) 2026-06-02 10:14:13 +01:00
extension-modules.rst gh-149044: Implement PEP 820 – PySlot: Unified slot system for the C API (GH-149055) 2026-05-05 09:18:04 +02:00
file.rst Add a new Sphinx soft-deprecated directive (#148630) 2026-04-18 11:37:54 +03:00
float.rst Add a new Sphinx soft-deprecated directive (#148630) 2026-04-18 11:37:54 +03:00
frame.rst Add a new Sphinx soft-deprecated directive (#148630) 2026-04-18 11:37:54 +03:00
function.rst gh-141004: Document PyFunction_SetKwDefaults (GH-141294) 2025-11-09 12:49:17 -05:00
gcsupport.rst Python 3.15.0b1 2026-05-07 16:26:31 +03:00
gen.rst Use soft-deprecated in more places (#148769) 2026-04-20 17:00:35 +01:00
hash.rst gh-141004: correctly document Py_HASH_* and PyHASH_* as hash_info attributes (#141233) 2025-11-08 12:22:02 +00:00
import.rst gh-149321: Remove lazy_imports=none startup mode (#149389) 2026-05-19 16:01:15 -07:00
index.rst gh-149044: Implement PEP 820 – PySlot: Unified slot system for the C API (GH-149055) 2026-05-05 09:18:04 +02:00
init.rst gh-141811: Split up init.rst into multiple pages (GH-144844) 2026-02-20 16:37:39 +00:00
init_config.rst gh-148014: Accept a function name in -X presite option (#148015) 2026-04-07 14:05:39 +00:00
interp-lifecycle.rst Python 3.15.0b1 2026-05-07 16:26:31 +03:00
intro.rst Use soft-deprecated in more places (#148769) 2026-04-20 17:00:35 +01:00
iter.rst Fix typo in PyIter_Send docs (#140336) 2025-10-20 14:23:57 +05:30
iterator.rst gh-141004: Document PyODict* APIs (GH-141136) 2025-11-17 14:40:47 -05:00
lifecycle.dot gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) 2025-05-20 14:25:50 +02:00
lifecycle.dot.css gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) 2025-05-20 14:25:50 +02:00
lifecycle.dot.pdf gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) 2025-05-20 14:25:50 +02:00
lifecycle.dot.svg gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) 2025-05-20 14:25:50 +02:00
lifecycle.rst gh-75459: versionadded for PyObject_CallFinalizer*() API (GH-143982) 2026-01-19 11:22:16 +01:00
list.rst gh-142518: Annotate PyList_* C APIs for thread safety (#146109) 2026-03-18 17:42:20 +01:00
long.rst Add a new Sphinx soft-deprecated directive (#148630) 2026-04-18 11:37:54 +03:00
mapping.rst Fix minor typos and wording in C API docs (#140955) 2025-11-03 22:04:46 +02:00
marshal.rst Fix minor typos and wording in C API docs (#140955) 2025-11-03 22:04:46 +02:00
memory.rst gh-142518: Improve mimalloc allocator docs (#145224) 2026-03-11 15:14:47 +01:00
memoryview.rst gh-141004: Document PyMemoryView_Type (GH-141034) 2025-11-05 11:45:13 -05:00
method.rst gh-107091: Fix the use of some C domain roles (#107092) 2023-07-23 12:27:05 +02:00
module.rst Python 3.15.0b1 2026-05-07 16:26:31 +03:00
monitoring.rst Add a new Sphinx soft-deprecated directive (#148630) 2026-04-18 11:37:54 +03:00
none.rst gh-110481, doc: Add "immortal" term to the glossary (#112180) 2023-11-17 15:09:19 +01:00
number.rst gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) 2024-07-19 08:06:02 +00:00
object.rst gh-146056: Fix list.__repr__() for lists containing NULLs (GH-146129) 2026-03-19 09:59:48 +02:00
objimpl.rst gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) 2025-05-20 14:25:50 +02:00
perfmaps.rst GH-126910: Add gdb support for unwinding JIT frames (#146071) 2026-05-02 13:42:03 +00:00
picklebuffer.rst gh-141004: Document the PyPickleBuffer_* C API (GH-141630) 2025-11-16 13:50:54 -05:00
profiling.rst gh-141811: Split up init.rst into multiple pages (GH-144844) 2026-02-20 16:37:39 +00:00
refcounting.rst gh-144277: Fix usage of free-threaded terminology in the documentation (GH-144333) 2026-02-01 20:39:26 -05:00
reflection.rst gh-127989: C API: Refer to "attached thread states" instead of the GIL (GH-127990) 2025-03-20 13:06:59 +01:00
sentinel.rst gh-148829: Make sentinels' repr and module customizable (#149654) 2026-05-19 09:18:56 -07:00
sequence.rst Add a new Sphinx soft-deprecated directive (#148630) 2026-04-18 11:37:54 +03:00
set.rst Use soft-deprecated in more places (#148769) 2026-04-20 17:00:35 +01:00
slice.rst gh-130214: Document PyEllipsis_Type (GH-130215) 2025-02-17 13:56:33 +01:00
slots.rst Fix typos in C API documentation (GH-149588) 2026-05-11 10:28:19 +02:00
stable.rst Fix incorrect sentence in stable.rst (GH-149684) 2026-05-11 17:27:16 +02:00
structures.rst gh-146636: PEP 803: Reference documentation (GH-148013) 2026-04-16 14:17:44 +02:00
subinterpreters.rst gh-146031: Allow keeping specialization enabled when specifying eval frame function (#146032) 2026-04-16 09:44:26 -07:00
synchronization.rst Fix typos in C API documentation (GH-149588) 2026-05-11 10:28:19 +02:00
sys.rst gh-141004: Document PyOS_InterruptOccurred (GH-141526) 2025-11-14 06:20:36 -05:00
threads.rst Fix docs for PyThreadState_GetDict() in threads.rst (#150401) 2026-05-28 12:13:58 +00:00
time.rst gh-127989: C API: Refer to "attached thread states" instead of the GIL (GH-127990) 2025-03-20 13:06:59 +01:00
tls.rst gh-141811: Split up init.rst into multiple pages (GH-144844) 2026-02-20 16:37:39 +00:00
tuple.rst gh-142518: add thread safety annotations for tuple C-API (#148012) 2026-04-08 01:55:44 +05:30
type.rst Python 3.15.0b1 2026-05-07 16:26:31 +03:00
typehints.rst gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
typeobj.rst gh-149044: Implement PEP 820 – PySlot: Unified slot system for the C API (GH-149055) 2026-05-05 09:18:04 +02:00
unicode.rst Fix minor typos in unicode.rst (#149587) 2026-05-09 21:31:55 +00:00
utilities.rst gh-110850: Add PyTime_t C API (GH-115215) 2024-02-12 18:13:10 +01:00
veryhigh.rst Fix typos and grammar errors across documentation (#144709) 2026-02-11 16:35:25 +00:00
weakref.rst gh-141004: Document PyType_SUPPORTS_WEAKREFS (GH-141408) 2025-11-12 11:38:17 -05:00