cpython/Python
Alex Waygood 7c5734c791
[3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814)
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:26:33 +00:00
..
clinic [3.13] gh-150285: Fix too long docstrings in Argument Clinic code (GH-150338) (GH-150350) (GH-150473) (GH-150526) 2026-05-27 18:06:50 +00:00
frozen_modules gh-97669: Create Tools/build/ directory (#97963) 2022-10-17 12:01:00 +02:00
_warnings.c [3.13] gh-139640: Fix swallowing syntax warnings in different modules (GH-139755) (GH-140119) 2025-10-14 15:46:11 +00:00
adaptive.md GH-98686: Get rid of "adaptive" and "quick" instructions (GH-99182) 2022-11-09 10:50:09 -08:00
asdl.c
asm_trampoline.S [3.13] gh-139808: Add branch protections for aarch64 in asm_trampoline.S (GH-130864) (GH-150189) (#150194) 2026-05-28 19:10:24 +02:00
asm_trampoline_aarch64.h [3.13] gh-139808: Add branch protections for aarch64 in asm_trampoline.S (GH-130864) (GH-150189) (#150194) 2026-05-28 19:10:24 +02:00
assemble.c [3.13] gh-130775: Allow negative locations in ast (GH-130795) (#132243) 2025-04-08 10:47:24 +02:00
ast.c gh-116126: Implement PEP 696 (#116129) 2024-05-03 06:17:32 -07:00
ast_opt.c [3.13] gh-123344: Add missing ast optimizations for PEP 696 (GH-123377) (#123427) 2024-08-28 14:02:34 +00:00
ast_unparse.c [3.13] gh-125268: Use static string for "1e309" in AST (GH-125272) (GH-125280) 2024-10-24 13:59:23 -04:00
bltinmodule.c [3.13] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) (GH-150472) 2026-05-26 10:34:50 +00:00
bootstrap_hash.c gh-110014: Fix bootstrap_hash.c: remove debug code (#110161) 2023-09-30 22:21:20 +00:00
brc.c gh-110481: Fix biased reference counting queue initialization. (#117271) 2024-03-28 09:28:39 -04:00
bytecodes.c [3.13] gh-145008: Maintain stack consistency in CALL_BOUND_METHOD_EXACT_ARGS (GH-145015) 2026-03-03 04:09:02 +08:00
ceval.c [3.13] gh-146615: Fix format specifiers in Python/ directory (GH-146619) (GH-146654) 2026-03-31 09:16:44 +00:00
ceval_gil.c [3.13] gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) (GH-137827) 2025-08-17 09:08:14 -07:00
ceval_macros.h [3.13] gh-117657: Avoid race in PAUSE_ADAPTIVE_COUNTER in free-threaded build (GH-122190) (#122475) 2024-07-30 18:18:25 +00:00
codecs.c [3.13] gh-58124: Avoid CP_UTF8 in UnicodeDecodeError (GH-137415) (#137461) 2025-08-06 12:59:11 +00:00
compile.c [3.13] gh-148973: fix segfault on mismatch between consts size and oparg in compiler (GH-148974) (#148997) 2026-04-25 22:59:40 +01:00
condvar.h gh-104530: Enable native Win32 condition variables by default (GH-104531) 2024-02-02 13:50:51 +00:00
config_common.h gh-76785: Add PyInterpreterConfig Helpers (gh-117170) 2024-04-02 20:35:52 +00:00
context.c [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814) 2026-06-02 22:26:33 +00:00
critical_section.c [3.13] gh-119344: Make critical section API public (GH-119353) (#120856) 2024-06-21 20:20:41 +00:00
crossinterp.c [3.13] gh-140306: Clear uncaught exception info after applying error in subinterpreter (GH-140397) 2026-01-12 18:19:57 +02:00
crossinterp_data_lookup.h gh-76785: Improved Subinterpreters Compatibility with 3.12 (gh-115424) 2024-02-13 14:56:49 -07:00
crossinterp_exceptions.h [3.13] gh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-120009) 2024-06-03 23:37:28 +00:00
dtoa.c gh-91565: Replace bugs.python.org links with Devguide/GitHub ones (GH-91568) 2024-04-01 13:02:07 +00:00
dup2.c gh-108765: Python.h no longer includes <unistd.h> (#108783) 2023-09-02 16:50:18 +02:00
dynamic_annotations.c
dynload_hpux.c gh-88402: Add new sysconfig variables on Windows (GH-110049) 2023-10-04 22:50:29 +00:00
dynload_shlib.c gh-88402: Add new sysconfig variables on Windows (GH-110049) 2023-10-04 22:50:29 +00:00
dynload_stub.c gh-88402: Add new sysconfig variables on Windows (GH-110049) 2023-10-04 22:50:29 +00:00
dynload_win.c gh-88402: Add new sysconfig variables on Windows (GH-110049) 2023-10-04 22:50:29 +00:00
emscripten_signal.c GH-108614: Unbreak emscripten build (GH-109132) 2023-09-08 17:54:45 +01:00
emscripten_trampoline.c [3.13] gh-121698 Emscripten: Use updated WebAssembly type reflection proposal (GH-121699) (GH-121745) 2024-07-14 12:01:03 +02:00
errors.c [3.13] gh-143547: Fix PyErr_FormatUnraisable() fallback (GH-143557) (GH-143603) (#143612) 2026-01-09 15:33:25 +00:00
executor_cases.c.h [3.13] gh-132744: Check recursion limit in _PY_FRAME_GENERAL (GH-132746) (GH-138032) 2025-08-22 20:25:24 +08:00
fileutils.c [3.13] gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale (GH-132477) (ПР-132528) 2025-04-14 18:59:07 +00:00
flowgraph.c [3.13] gh-148973: fix segfault on mismatch between consts size and oparg in compiler (GH-148974) (#148997) 2026-04-25 22:59:40 +01:00
formatter_unicode.c gh-92536: Remove PyUnicode_READY() calls (#105210) 2023-06-02 01:33:17 +02:00
frame.c gh-118272: set stacktop to 0 before freeing contents, to avoid access to invalid objects during GC (#118478) 2024-05-01 21:51:40 +01:00
frozen.c gh-108716: Cleanup remaining deepfreeze infrastructure (#116919) 2024-03-18 11:13:11 -07:00
frozenmain.c gh-105716: Fix _PyInterpreterState_IsRunningMain() For Embedders (gh-117140) 2024-03-21 18:20:20 -06:00
future.c [3.13] gh-126139: Improve error message location for future statement with unknown feature (GH-126140) (#126155) 2024-10-30 00:36:06 +00:00
gc.c [3.13] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (GH-144214) 2026-03-24 00:50:41 +01:00
gc_free_threading.c [3.13] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (GH-144214) 2026-03-24 00:50:41 +01:00
gc_gil.c gh-111968: Rename freelist related struct names to Eric's suggestion (gh-115329) 2024-02-14 00:32:51 +00:00
generated_cases.c.h [3.13] gh-145008: Maintain stack consistency in CALL_BOUND_METHOD_EXACT_ARGS (GH-145015) 2026-03-03 04:09:02 +08:00
getargs.c [3.13] gh-146615: Fix format specifiers in Objects/ directory (GH-146620) (#147705) 2026-04-01 21:52:14 +00:00
getcompiler.c
getcopyright.c Update copyright years to 2024. (GH-113608) 2024-01-16 21:54:05 +01:00
getopt.c gh-110079: Remove extern "C" { ...} in C code (#110080) 2023-09-29 10:56:49 +02:00
getplatform.c
getversion.c [3.13] gh-119132: Update sys.version to identify free-threaded or not. (gh-119134) (#119153) 2024-05-18 16:49:11 -04:00
hamt.c [3.13] gh-150178: Fix refcount leaks in hamt allocation failure paths (GH-150179) (#150301) 2026-05-23 14:54:11 +05:30
hashtable.c gh-111545: Add Py_HashPointer() function (#112096) 2023-12-06 15:09:22 +01:00
import.c [3.13] gh-150285: Fix too long docstrings in Argument Clinic code (GH-150338) (GH-150350) (GH-150473) (GH-150526) 2026-05-27 18:06:50 +00:00
importdl.c [3.13] gh-140011: Delete importdl assertion that prevents importing embedded modules from packages (GH-141605) (#141987) 2025-11-28 23:31:11 -08:00
initconfig.c [3.13] gh-146244: Fix initconfig.c SET_ITEM macro leaks dict on expression failure (GH-146246) (GH-146433) 2026-03-25 19:32:20 +00:00
instruction_sequence.c [3.13] gh-130740: Move some stdbool.h includes after Python.h (#130738) (#130756) 2025-03-03 13:09:59 +01:00
instrumentation.c [3.13] gh-120158: Fix inconsistent monitoring state when setting events too frequently (gh-141845) (gh-141880) 2025-11-23 15:30:37 +00:00
interpconfig.c [3.13] gh-146615: Fix format specifiers in Python/ directory (GH-146619) (GH-146654) 2026-03-31 09:16:44 +00:00
intrinsics.c [3.13] gh-130163: Fix crashes related to PySys_GetObject() (GH-130503) (GH-130556) 2025-02-25 22:50:26 +00:00
jit.c [3.13] GH-146128: Remove the buggy AArch64 "33rx" relocation (#146263) (#148199) 2026-04-07 20:10:33 +02:00
legacy_tracing.c [3.13] gh-137400: Fix thread-safety issues when profiling all threads (gh-137518) (gh-137733) 2025-10-09 11:42:47 -04:00
lock.c [3.13] gh-148820: Fix _PyRawMutex use-after-free on spurious semaphore wakeup (gh-148852) (#148885) 2026-04-22 18:56:24 +00:00
marshal.c [3.13] gh-150285: Fix too long docstrings in Argument Clinic code (GH-150338) (GH-150350) (GH-150473) (GH-150526) 2026-05-27 18:06:50 +00:00
modsupport.c [3.13] gh-132909: handle overflow for 'K' format in do_mkvalue (GH-132911) (#132932) 2025-04-25 12:44:53 +00:00
mysnprintf.c Add a warning message about PyOS_snprintf (#95993) 2022-10-07 11:49:53 -07:00
mystrtoul.c gh-108765: Python.h no longer includes <ctype.h> (#108831) 2023-09-03 18:54:27 +02:00
object_stack.c gh-111968: Split _Py_dictkeys_freelist out of _Py_dict_freelist (gh-115505) 2024-02-16 01:01:36 +00:00
opcode_targets.h GH-118095: Use broader specializations of CALL in tier 1, for better tier 2 support of calls. (GH-118322) 2024-05-04 12:11:11 +01:00
optimizer.c [3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) (#121043) 2024-06-26 15:35:19 +02:00
optimizer_analysis.c [3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) (#121043) 2024-06-26 15:35:19 +02:00
optimizer_bytecodes.c [3.13] gh-119258: Backport optimizer frame fixes in GH-119365 (GH-120699) 2024-06-20 23:55:20 +08:00
optimizer_cases.c.h [3.13] gh-132744: Check recursion limit in _PY_FRAME_GENERAL (GH-132746) (GH-138032) 2025-08-22 20:25:24 +08:00
optimizer_symbols.c [3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) (#121043) 2024-06-26 15:35:19 +02:00
parking_lot.c [3.13] gh-148820: Fix _PyRawMutex use-after-free on spurious semaphore wakeup (gh-148852) (#148885) 2026-04-22 18:56:24 +00:00
pathconfig.c gh-117987: Restore several functions removed in Python 3.13 alpha 1 (GH-117993) 2024-04-18 15:20:38 +02:00
perf_jit_trampoline.c [3.13] gh-139808: Add branch protections for aarch64 in asm_trampoline.S (GH-130864) (GH-150189) (#150194) 2026-05-28 19:10:24 +02:00
perf_trampoline.c [3.13] gh-149156: Fix perf trampoline crash after fork (GH-150347) (#150393) 2026-05-25 19:19:07 +01:00
preconfig.c [3.13] gh-145092: Fix compiler warning for memchr() and wcschr() returning const pointer (GH-145093) (GH-145101) 2026-02-22 08:28:24 +00:00
pyarena.c
pyctype.c
pyfpe.c
pyhash.c [3.13] gh-111389: Add PyHASH_MULTIPLIER constant (GH-119214) (#119334) 2024-06-04 09:26:25 +02:00
pylifecycle.c [3.13] gh-150644: Tag Apple system log messages as public. (GH-150645) (#150740) 2026-06-01 22:48:28 +00:00
pymath.c
pystate.c [3.13] gh-142183: Cache one datachunk per tstate to prevent alloc/dealloc thrashing (GH-145789) (#146123) 2026-03-24 02:27:57 +01:00
pystrcmp.c gh-108767: Replace ctype.h functions with pyctype.h functions (#108772) 2023-09-01 18:36:53 +02:00
pystrhex.c [3.13] gh-141370: Fix undefined behavior when using Py_ABS() (GH-141548) (#142304) 2025-12-05 15:52:12 +00:00
pystrtod.c gh-108765: Cleanup #include in Python/*.c files (#108977) 2023-09-06 15:56:08 +02:00
Python-ast.c [3.13] gh-144169: Fix three crashes in AST objects with non-str kwargs (GH-144178) (#144260) 2026-01-27 20:37:35 -08:00
Python-tokenize.c [3.13] gh-120317: Lock around global state in the tokenize module (GH-120318) (#121841) 2024-07-16 10:03:47 +00:00
pythonrun.c [3.13] gh-145376: Fix various reference leaks (GH-145377) (#148661) 2026-05-12 18:35:27 +00:00
pytime.c gh-110850: Remove _PyTime_TimeUnchecked() function (#118552) 2024-05-05 12:15:19 +02:00
qsbr.c [3.13] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (gh-136480) 2025-07-30 11:06:44 -07:00
README
specialize.c [3.13] gh-125610: Fix STORE_ATTR_INSTANCE_VALUE specialization check (GH-125612) (GH-127698) 2024-12-06 16:14:26 +00:00
stdlib_module_names.h [3.13] gh-126925: Modify how iOS test results are gathered (GH-127592) (#127754) 2024-12-09 14:39:11 +08:00
structmember.c [3.13] gh-117657: Fix __slots__ thread safety in free-threaded build (GH-119368) (#120655) 2024-06-17 19:12:25 +00:00
suggestions.c gh-113845: Fix a compiler warning in Python/suggestions.c (GH-113949) 2024-01-11 20:31:24 +02:00
symtable.c [3.13] gh-145701: Fix __classdict__ & __conditional_annotations__ in class-scope inlined comprehensions (GH-145702) (#145711) 2026-03-09 14:44:31 -07:00
sysmodule.c [3.13] gh-150285: Fix too long docstrings in Argument Clinic code (GH-150338) (GH-150350) (GH-150473) (GH-150526) 2026-05-27 18:06:50 +00:00
thread.c gh-110850: Cleanup PyTime API: PyTime_t are nanoseconds (#115753) 2024-02-21 11:46:00 +01:00
thread_nt.h [3.13] gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) (GH-137827) 2025-08-17 09:08:14 -07:00
thread_pthread.h [3.13] gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) (GH-137827) 2025-08-17 09:08:14 -07:00
thread_pthread_stubs.h GH-110829: Ensure Thread.join() joins the OS thread (#110848) 2023-11-04 13:59:24 +00:00
tier2_engine.md Docs: fix spelling of the word 'transferring' (#116641) 2024-03-13 23:53:32 +01:00
traceback.c [3.13] gh-142737: Handle lost io.open in _Py_FindSourceFile (GH-142747) (GH-142774) 2025-12-15 23:27:15 +00:00
tracemalloc.c [3.13] gh-128679: Clear the ref tracer in _PyTraceMalloc_Stop() (#129258) 2025-01-24 14:54:02 +01:00
vm-state.md High level docs for the VM state (#111621) 2023-11-01 22:55:10 +00:00

Miscellaneous source files for the main Python shared library