cpython/Doc/c-api
Alex Waygood 7756f59892
[3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813)
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



* 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

---------

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: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-06-02 22:22:46 +00:00
..
abstract.rst
allocation.rst [3.14] Add a new Sphinx soft-deprecated directive (GH-148630) (#148714) 2026-04-23 00:41:40 +03:00
apiabiversion.rst [3.14] gh-143578: Restore note about patchlevel.h (GH-143596) (#143725) 2026-01-12 13:49:43 +02:00
arg.rst [3.14] Docs: Fix a grammatical error in Doc/c-api/arg.rst (GH-140525) (GH-140538) 2025-10-24 12:24:26 +00:00
bool.rst gh-110481, doc: Add "immortal" term to the glossary (#112180) 2023-11-17 15:09:19 +01:00
buffer.rst [3.14] gh-141004: Document PyBUF_WRITEABLE (GH-141255) (GH-141261) 2025-11-08 17:36:00 +00:00
bytearray.rst [3.14] gh-142518: add thread safety annotations for bytearray C-API (GH-146514) (#146516) 2026-03-27 19:21:05 +05:30
bytes.rst [3.14] gh-142518: add thread safety docs on bytes C-API (GH-146415) (#146515) 2026-03-27 13:07:37 +00:00
call.rst [3.14] gh-141004: Document old provisional names for vectorcall/code API (GH-143568) (GH-143828) 2026-01-14 11:01:37 +01:00
capsule.rst [3.14] gh-141004: Document PyCapsule_Type (GH-141079) (GH-141199) 2025-11-07 14:16:43 +00:00
cell.rst [3.14] Fix minor typos and wording in C API docs (GH-140955) (#140966) 2025-11-04 09:46:08 +02:00
code.rst [3.14] gh-141004: Document old provisional names for vectorcall/code API (GH-143568) (GH-143828) 2026-01-14 11:01:37 +01:00
codec.rst [3.14] gh-141004: Document Py_hexdigits (GH-141059) (GH-141138) 2025-11-06 13:56:41 +00:00
complex.rst gh-128813: hide mixed-mode functions for complex arithmetic from C-API (#131703) 2025-04-22 14:18:18 +02:00
concrete.rst [3.14] gh-141004: Document the PyPickleBuffer_* C API (GH-141630) (GH-141632) 2025-11-16 18:56:41 +00:00
contextvars.rst gh-124872: Replace enter/exit events with "switched" (#125532) 2024-10-16 13:53:21 +02:00
conversion.rst [3.14] gh-141004: Mark up constants for PyOS_double_to_string (GH-143867) (GH-144146) 2026-01-22 13:30:14 +01:00
coro.rst
curses.rst [3.14] gh-141004: document curses C API (GH-141254) (#141292) 2025-11-09 15:50:21 +00:00
datetime.rst [3.14] gh-141004: Document missing PyDateTime* APIs (GH-141543) (GH-141791) 2025-11-20 13:54:48 +00:00
descriptor.rst [3.14] gh-141004: Document descriptor and dict proxy type objects (GH-141803) (GH142147) 2025-12-01 15:57:31 +00:00
dict.rst [3.14] docs: Clarify docs for error case of PyDict_GetItemRef (GH-149506) (#149547) 2026-05-08 16:37:00 +05:30
exceptions.rst [3.14] Fix a typo in 'Exception Handling' C-API documentation (GH-150674) 2026-06-02 12:28:35 +01:00
extension-modules.rst [3.14] Docs: Remove unnecessary trailing backslashes (GH-135781) (GH-135791) 2025-06-21 13:07:51 +00:00
file.rst [3.14] Add a new Sphinx soft-deprecated directive (GH-148630) (#148714) 2026-04-23 00:41:40 +03:00
float.rst [3.14] Docs: fix a form error and a grammatical error in float.rst (GH-140989) (#146012) 2026-03-16 14:38:00 +05:30
frame.rst [3.14] Add a new Sphinx soft-deprecated directive (GH-148630) (#148714) 2026-04-23 00:41:40 +03:00
function.rst [3.14] gh-141004: Document PyFunction_SetKwDefaults (GH-141294) (GH-141304) 2025-11-09 17:55:09 +00:00
gcsupport.rst [3.14] gh-123241: Document restrictions for tp_traverse implementations (gh-142272) (#142423) 2025-12-08 17:27:57 +00:00
gen.rst [3.14] gh-141004: Document several soft-deprecated C APIs (GH-141634) (GH-143837) 2026-01-14 13:25:57 +00:00
hash.rst [3.14] gh-141004: correctly document Py_HASH_* and PyHASH_* as hash_info attributes (GH-141233) (#141234) 2025-11-08 12:28:01 +00:00
import.rst [3.14] gh-141004: Document PyImport_Inittab (GH-141844) (GH-141915) 2025-11-24 12:16:31 -05:00
index.rst [3.14] gh-141811: Split up init.rst into multiple pages (GH-144844) (GH-145061) 2026-02-23 10:38:43 -05:00
init.rst [3.14] gh-141811: Split up init.rst into multiple pages (GH-144844) (GH-145061) 2026-02-23 10:38:43 -05:00
init_config.rst [3.14] Fix typos and grammar errors across documentation (GH-144709) (#144801) 2026-02-17 12:53:42 +00:00
interp-lifecycle.rst [3.14] gh-141811: Split up init.rst into multiple pages (GH-144844) (GH-145061) 2026-02-23 10:38:43 -05:00
intro.rst [3.14] Fix typos and grammar errors across documentation (GH-144709) (#144801) 2026-02-17 12:53:42 +00:00
iter.rst gh-105201: Add PyIter_NextItem() (#122331) 2024-08-08 00:47:15 +02:00
iterator.rst [3.14] gh-141004: Document PyODict* APIs (GH-141136) (GH-141677) 2025-11-17 19:46:23 +00:00
lifecycle.dot [3.14] gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) (GH-134344) 2025-05-20 19:11:01 +02:00
lifecycle.dot.css [3.14] gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) (GH-134344) 2025-05-20 19:11:01 +02:00
lifecycle.dot.pdf [3.14] gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) (GH-134344) 2025-05-20 19:11:01 +02:00
lifecycle.dot.svg [3.14] gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) (GH-134344) 2025-05-20 19:11:01 +02:00
lifecycle.rst [3.14] gh-75459: versionadded for PyObject_CallFinalizer*() API (GH-143982) (#144026) 2026-01-20 12:06:21 +02:00
list.rst [3.14] gh-142518: Annotate PyList_* C APIs for thread safety (GH-146109) (#146125) 2026-03-18 17:48:38 +01:00
long.rst [3.14] Add a new Sphinx soft-deprecated directive (GH-148630) (#148714) 2026-04-23 00:41:40 +03:00
mapping.rst [3.14] Fix minor typos and wording in C API docs (GH-140955) (#140966) 2025-11-04 09:46:08 +02:00
marshal.rst [3.14] Fix minor typos and wording in C API docs (GH-140955) (#140966) 2025-11-04 09:46:08 +02:00
memory.rst [3.14] gh-142518: Improve mimalloc allocator docs (GH-145224) (#145823) 2026-03-11 15:28:11 +01:00
memoryview.rst [3.14] gh-141004: Document PyMemoryView_Type (GH-141034) (GH-141054) 2025-11-05 16:51:34 +00:00
method.rst
module.rst [3.14] Add a new Sphinx soft-deprecated directive (GH-148630) (#148714) 2026-04-23 00:41:40 +03:00
monitoring.rst [3.14] Add a new Sphinx soft-deprecated directive (GH-148630) (#148714) 2026-04-23 00:41:40 +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 [3.14] gh-146056: Fix repr() for lists and tuples containing NULLs (GH-146129) (GH-146155) 2026-03-22 09:25:02 +02:00
objimpl.rst [3.14] gh-75459: Doc: C API: Improve object life cycle documentation (GH-125962) (GH-134344) 2025-05-20 19:11:01 +02:00
perfmaps.rst gh-127989: C API: Refer to "attached thread states" instead of the GIL (GH-127990) 2025-03-20 13:06:59 +01:00
picklebuffer.rst [3.14] gh-141004: Document the PyPickleBuffer_* C API (GH-141630) (GH-141632) 2025-11-16 18:56:41 +00:00
profiling.rst [3.14] gh-141811: Split up init.rst into multiple pages (GH-144844) (GH-145061) 2026-02-23 10:38:43 -05:00
refcounting.rst [3.14] gh-144277: Fix usage of free-threaded terminology in the documentation (GH-144333) (GH-144385) 2026-02-01 21:01:43 -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
sequence.rst [3.14] Add a new Sphinx soft-deprecated directive (GH-148630) (#148714) 2026-04-23 00:41:40 +03:00
set.rst [3.14] gh-142518: add thread safety docs for dict and set APIs (#148392) 2026-04-11 21:52:38 +05:30
slice.rst gh-130214: Document PyEllipsis_Type (GH-130215) 2025-02-17 13:56:33 +01:00
stable.rst [3.14] gh-134830: Fix reference in Doc/extending/windows.rst (GH-134831) (GH-135058) 2025-06-03 06:33:04 +00:00
structures.rst [3.14] Fix typos and grammar errors across documentation (GH-144709) (#144801) 2026-02-17 12:53:42 +00:00
subinterpreters.rst [3.14] gh-141811: Split up init.rst into multiple pages (GH-144844) (GH-145061) 2026-02-23 10:38:43 -05:00
synchronization.rst [3.14] gh-141811: Split up init.rst into multiple pages (GH-144844) (GH-145061) 2026-02-23 10:38:43 -05:00
sys.rst [3.14] gh-141004: Document PyOS_InterruptOccurred (GH-141526) (GH-141549) 2025-11-14 11:26:37 +00:00
threads.rst [3.14] Docs: Improve the C API documentation involving threads (GH-145520) (GH-145757) 2026-03-10 15:03:28 +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 [3.14] gh-141811: Split up init.rst into multiple pages (GH-144844) (GH-145061) 2026-02-23 10:38:43 -05:00
tuple.rst [3.14] Fix minor typos and wording in C API docs (GH-140955) (#140966) 2025-11-04 09:46:08 +02:00
type.rst [3.14] Document that PyType_GetModule returns a borrowed ref (GH-145612) (GH-145682) 2026-03-10 10:06:08 +01:00
typehints.rst [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
typeobj.rst [3.14] gh-142518: Add thread safety notes for the buffer protocol (GH-145911) (#146106) 2026-03-18 14:28:52 +01:00
unicode.rst [3.14] Fix minor typos in unicode.rst (GH-149587) (#149621) 2026-05-09 21:38:55 +00:00
utilities.rst gh-110850: Add PyTime_t C API (GH-115215) 2024-02-12 18:13:10 +01:00
veryhigh.rst [3.14] Fix typos and grammar errors across documentation (GH-144709) (#144801) 2026-02-17 12:53:42 +00:00
weakref.rst [3.14] gh-141004: Document PyType_SUPPORTS_WEAKREFS (GH-141408) (GH-141470) 2025-11-12 16:44:17 +00:00