cpython/Objects
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
..
clinic [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
mimalloc [3.14] gh-145615: Fix mimalloc page leak in the free-threaded build (gh-145626) (#145691) 2026-03-09 14:17:57 -04:00
stringlib [3.14] gh-145092: Fix compiler warning for memchr() and wcschr() returning const pointer (GH-145093) (GH-145102) 2026-02-22 08:28:17 +00:00
abstract.c gh-131238: Remove includes from pycore_interp.h (#131495) 2025-03-20 11:35:23 +00:00
boolobject.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
bytearrayobject.c [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
bytes_methods.c [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
bytesobject.c [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
call.c [3.14] gh-145779: Improve classmethod/staticmethod scaling in free-threaded build (gh-145826) (#146088) 2026-03-19 10:49:12 -04:00
capsule.c gh-111178: fix UBSan failures in Objects/capsule.c (GH-128239) 2025-01-08 14:55:04 +01:00
cellobject.c gh-127271: Replace use of PyCell_GET/SET (gh-127272) 2024-12-03 10:33:06 -08:00
classobject.c [3.14] gh-145779: Improve classmethod/staticmethod scaling in free-threaded build (gh-145826) (#146088) 2026-03-19 10:49:12 -04:00
codeobject.c [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
complexobject.c gh-111178: Change Argument Clinic signature for @classmethod (#131157) 2025-03-12 17:42:07 +01:00
descrobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +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.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
enumobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
exceptions.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
fileobject.c gh-111178: fix UBSan failures for PyStdPrinter_Object (#131607) 2025-03-24 10:57:14 +01:00
floatobject.c [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
frameobject.c [3.14] gh-146092: Handle _PyFrame_GetFrameObject() failures properly (#146124) (#146132) 2026-03-18 17:57:08 +00:00
funcobject.c [3.14] gh-146615: Fix format specifiers in Objects/ directory (GH-146620) (GH-146651) 2026-03-31 09:17:58 +00:00
genericaliasobject.c [3.14] gh-150146: Fix NULL dereference in _Py_subs_parameters (GH-150147) (#150154) 2026-05-20 13:54:20 +00:00
genobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
interpolationobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
iterobject.c gh-131666: mark anext_awaitable.close as a METH_NOARGS instead of METH_VARARGS (#131671) 2025-03-25 09:03:22 +05:30
listobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
listsort.txt GH-116939: Rewrite binarysort() (#116940) 2024-03-21 22:27:25 -05:00
lnotab_notes.txt gh-119786: add code object doc, inline locations.md into it (#126832) 2024-11-22 19:27:41 +00:00
longobject.c [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
memoryobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
methodobject.c [3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136119) 2025-06-30 15:59:22 +02:00
moduleobject.c [3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136119) 2025-06-30 15:59:22 +02:00
namespaceobject.c [3.14] gh-143636: fix a crash when calling `__replace__ on invalid SimpleNamespace` instances (GH-143655) (#145938) 2026-03-14 10:35:41 +00:00
object.c [3.14] gh-113956: Make intern_common thread-safe in free-threaded build (gh-148886) (#148927) 2026-04-23 19:12:19 +00:00
object_layout.md GH-115776: Allow any fixed sized object to have inline values (GH-123192) 2024-08-21 15:52:04 +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.14] gh-71648: Optimize PNG files (GH-138842) (GH-138851) 2025-10-07 20:52:12 +02: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.14] gh-71648: Optimize PNG files (GH-138842) (GH-138851) 2025-10-07 20:52:12 +02: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.14] gh-71648: Optimize PNG files (GH-138842) (GH-138851) 2025-10-07 20:52:12 +02: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.14] gh-71648: Optimize PNG files (GH-138842) (GH-138851) 2025-10-07 20:52:12 +02:00
obmalloc.c [3.14] gh-145615: Fix mimalloc page leak in the free-threaded build (gh-145626) (#145691) 2026-03-09 14:17:57 -04:00
odictobject.c [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
picklebufobject.c [3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136119) 2025-06-30 15:59:22 +02:00
rangeobject.c [3.14] GH-141312: Allow only integers to longrangeiter_setstate state (GH-141317) (GH-141559) 2025-11-15 21:30:25 +02:00
README
setobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
sliceobject.c [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
structseq.c [3.14] gh-145376: Fix GC tracking in structseq.__replace__ (GH-145820) (#145922) 2026-03-16 14:38:15 +05:30
templateobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
tupleobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
typeobject.c [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
typeslots.inc Revert "gh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply to arrays (#133396)" (#133498) 2025-05-06 13:12:26 +03:00
typeslots.py gh-124153: Implement PyType_GetBaseByToken() and Py_tp_token slot (GH-124163) 2024-09-18 09:18:19 +02:00
typevarobject.c [3.14] gh-148274: properly handle result from PyObject_VisitManagedDict (GH-148275) (#148295) 2026-04-09 13:49:09 +00:00
unicodectype.c gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130118) 2025-02-14 18:16:47 +01:00
unicodeobject.c [3.14] gh-150285: Fix too long docstrings in builtins (GH-150293) (GH-150466) 2026-05-26 10:05:49 +00:00
unicodetype_db.h closes gh-124016: update Unicode to 16.0.0 (#124017) 2024-09-13 07:47:04 -07:00
unionobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00
weakrefobject.c [3.14] gh-150319: Replace all documentation which says "See PEP 585" (#150325) (#150813) 2026-06-02 22:22:46 +00:00

Source files for various builtin objects