cpython/Objects
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 builtins (GH-150293) (GH-150466) (GH-150472) 2026-05-26 10:34:50 +00:00
mimalloc [3.13] Fix typos (#123775) (#123866) 2024-10-07 23:44:31 +02:00
stringlib [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
abstract.c gh-116316: Fix typo in UNARY_FUNC(PyNumber_Positive) macros (GH-116317) 2024-03-04 17:57:01 +00:00
boolobject.c [3.13] gh-122982: Extend the deprecation period for bool inversion by two years (GH-123306) (#123316) 2024-08-25 19:48:34 +00:00
bytearrayobject.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
bytes_methods.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
bytesobject.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
call.c [3.13] gh-142737: Handle lost io.open in _Py_FindSourceFile (GH-142747) (GH-142774) 2025-12-15 23:27:15 +00:00
capsule.c [3.13] gh-124538: Fix crash when using gc.get_referents on an untracked capsule object (GH-124559) (#124588) 2024-09-26 13:51:58 -07:00
cellobject.c gh-117323: Make cell thread-safe in free-threaded builds (#117330) 2024-03-29 13:35:43 -04:00
classobject.c [3.13] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136126) 2025-07-01 11:26:52 +02:00
codeobject.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
complexobject.c [3.13] gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211) (#127216) 2024-12-02 15:42:02 +01:00
descrobject.c [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814) 2026-06-02 22:26:33 +00:00
dictnotes.txt bpo-46845: Reduce dict size when all keys are Unicode (GH-31564) 2022-03-02 08:09:28 +09:00
dictobject.c [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814) 2026-06-02 22:26:33 +00:00
enumobject.c [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814) 2026-06-02 22:26:33 +00:00
exception_handling_notes.txt GH-105848: Simplify the arrangement of CALL's stack (GH-107788) 2023-08-09 18:19:39 +00:00
exceptions.c [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814) 2026-06-02 22:26:33 +00:00
fileobject.c gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() (GH-117160) 2024-03-25 16:32:11 +01:00
floatobject.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
frame_layout.md gh-109094: replace frame->prev_instr by frame->instr_ptr (#109095) 2023-10-26 13:43:10 +00:00
frameobject.c [3.13] gh-146092: Handle _PyFrame_GetFrameObject() failures properly (GH-146124) (GH-146132) (#146138) 2026-03-18 21:23:26 +01:00
funcobject.c [3.13] gh-146615: Fix format specifiers in Objects/ directory (GH-146620) (GH-146655) 2026-03-31 08:44:51 +00:00
genericaliasobject.c [3.13] gh-150146: Fix NULL dereference in _Py_subs_parameters (GH-150147) (#150155) 2026-05-20 14:04:17 +00:00
genobject.c [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814) 2026-06-02 22:26:33 +00:00
iterobject.c [3.13] gh-128078: Clear exception in anext before calling _PyGen_SetStopIterationValue (GH-128780) (#128785) 2025-01-13 13:20:49 +00:00
listobject.c [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814) 2026-06-02 22:26:33 +00:00
listsort.txt GH-116939: Rewrite binarysort() (#116940) 2024-03-21 22:27:25 -05:00
lnotab_notes.txt Document the co_lines method on code objects (#113682) 2024-01-03 19:29:24 +00:00
locations.md GH-88116: Use a compact format to represent end line and column offsets. (GH-91666) 2022-04-21 16:10:37 +01:00
longobject.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
memoryobject.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
methodobject.c [3.13] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136126) 2025-07-01 11:26:52 +02:00
moduleobject.c [3.13] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136126) 2025-07-01 11:26:52 +02:00
namespaceobject.c [3.13] gh-143636: fix a crash when calling `__replace__ on invalid SimpleNamespace` instances (GH-143655) (#145940) 2026-03-14 11:00:56 +00:00
object.c [3.13] gh-102809: No longer mention Misc/gdbinit in the code (GH-143980) (#144045) 2026-01-19 17:59:44 +00:00
object_layout.md GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_312.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_312.png [3.13] gh-71648: Optimize PNG files (GH-138842) (#138852) 2025-09-14 08:29:59 -07:00
object_layout_313.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_313.png [3.13] gh-71648: Optimize PNG files (GH-138842) (#138852) 2025-09-14 08:29:59 -07:00
object_layout_full_312.gv GH-96068: Document object layout (GH-96069) 2022-08-23 13:55:43 +01:00
object_layout_full_312.png [3.13] gh-71648: Optimize PNG files (GH-138842) (#138852) 2025-09-14 08:29:59 -07:00
object_layout_full_313.gv GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115) 2024-04-02 11:59:21 +01:00
object_layout_full_313.png [3.13] gh-71648: Optimize PNG files (GH-138842) (#138852) 2025-09-14 08:29:59 -07:00
obmalloc.c [3.13] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (gh-136480) 2025-07-30 11:06:44 -07:00
odictobject.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
picklebufobject.c [3.13] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136126) 2025-07-01 11:26:52 +02:00
rangeobject.c [3.13] GH-141312: Allow only integers to longrangeiter_setstate state (GH-141317) (GH-141568) 2025-11-15 21:14:17 +02:00
README
setobject.c [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814) 2026-06-02 22:26:33 +00:00
sliceobject.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
structseq.c [3.13] gh-145376: Fix GC tracking in structseq.__replace__ (GH-145820) (#145924) 2026-03-16 14:38:24 +05:30
tupleobject.c [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814) 2026-06-02 22:26:33 +00:00
typeobject.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
typeslots.inc
typeslots.py
typevarobject.c [3.13] gh-146615: Fix format specifiers in Objects/ directory (GH-146620) (GH-146655) 2026-03-31 08:44:51 +00:00
unicodectype.c [3.13] gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130127) 2025-02-17 15:02:39 +01:00
unicodeobject.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
unicodetype_db.h gh-96954: Fix make regen-unicodedata in out-of-tree builds (#112118) 2023-11-15 16:42:17 +00:00
unionobject.c [3.13] gh-132713: Fix typing.Union[index] race condition (GH-132802) (#132839) 2025-04-23 14:12:03 +00:00
weakrefobject.c [3.13] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150814) 2026-06-02 22:26:33 +00:00

Source files for various builtin objects