cpython/Objects
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
..
clinic gh-144774: Add critical section in BaseException.__setstate__ (#150578) 2026-05-30 21:07:27 +05:30
mimalloc gh-148461: Use arc4random_buf() in mimalloc on Cygwin (#148462) 2026-05-13 21:09:24 +02:00
stringlib GH-145247: Use _PyTuple_FromPair[Steal] in Objects (#145884) 2026-03-28 00:01:01 +00:00
abstract.c GH-143732: SEND specialization (GH-148963) 2026-05-05 15:19:16 +01:00
boolobject.c gh-111178: remove redundant casts for functions with correct signatures (#131673) 2025-04-01 17:18:11 +02:00
bytearrayobject.c gh-150285: Fix too long docstrings in builtins (GH-150293) 2026-05-24 15:03:32 +03:00
bytes_methods.c gh-150285: Fix too long docstrings in builtins (GH-150293) 2026-05-24 15:03:32 +03:00
bytesobject.c gh-150285: Fix too long docstrings in builtins (GH-150293) 2026-05-24 15:03:32 +03:00
call.c gh-145779: Improve classmethod/staticmethod scaling in free-threaded build (#145826) 2026-03-17 14:24:44 -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 gh-145779: Improve classmethod/staticmethod scaling in free-threaded build (#145826) 2026-03-17 14:24:44 -04:00
codeobject.c gh-150285: Fix too long docstrings in builtins (GH-150293) 2026-05-24 15:03:32 +03:00
complexobject.c gh-141004: soft-deprecate Py_INFINITY macro (#141033) 2025-11-12 13:44:49 +01:00
descrobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01: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 gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
enumobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
exceptions.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
fileobject.c gh-130821: Add type information to error messages for invalid return type (GH-130835) 2025-08-14 11:04:41 +03:00
floatobject.c gh-150285: Fix too long docstrings in builtins (GH-150293) 2026-05-24 15:03:32 +03:00
frameobject.c gh-150285: Fix too long docstrings in builtins (GH-150293) 2026-05-24 15:03:32 +03:00
funcobject.c gh-146261: JIT: protect against function version changes (#146300) 2026-04-13 02:23:47 +08:00
genericaliasobject.c gh-150146: Fix NULL dereference in _Py_subs_parameters (#150147) 2026-05-20 16:27:55 +03:00
genobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
interpolationobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
iterobject.c gh-130821: Add type information to error messages for invalid return type (GH-130835) 2025-08-14 11:04:41 +03:00
lazyimportobject.c PEP 810 - Update some error strings (#150126) 2026-05-20 00:47:44 +00:00
listobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
listsort.txt gh-135551: Change how sorting picks minimum run length (#135553) 2025-06-26 23:48:05 -05:00
longobject.c gh-150285: Fix too long docstrings in builtins (GH-150293) 2026-05-24 15:03:32 +03:00
memoryobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
methodobject.c gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) 2025-06-30 11:14:31 +00:00
moduleobject.c gh-150052: Resolve un-loaded lazily loaded submodules via module.__getattr__ instead of publishing lazy values (#150055) (#150744) 2026-06-02 09:58:51 +01:00
namespaceobject.c gh-143636: fix a crash when calling `__replace__ on invalid SimpleNamespace` instances (#143655) 2026-03-14 09:58:15 +00:00
object.c gh-145497: Use same size of static_types array in all builds (GH-149139) 2026-05-01 09:41:28 +02: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 gh-71648: Optimize PNG files (GH-138842) 2025-09-12 20:13:05 +00: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 gh-71648: Optimize PNG files (GH-138842) 2025-09-12 20:13:05 +00: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 gh-71648: Optimize PNG files (GH-138842) 2025-09-12 20:13:05 +00: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 gh-71648: Optimize PNG files (GH-138842) 2025-09-12 20:13:05 +00:00
obmalloc.c gh-144319: Use transparent huge pages via madvise(MADV_HUGEPAGE) in pymalloc (#144353) 2026-04-30 22:18:07 +01:00
odictobject.c gh-150285: Fix too long docstrings in builtins (GH-150293) 2026-05-24 15:03:32 +03:00
picklebufobject.c gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) 2025-06-30 11:14:31 +00:00
rangeobject.c gh-129068: Make range iterators thread-safe (gh-142886) 2025-12-18 13:11:51 -05:00
README Issue #18093: Factor out the programs that embed the runtime 2014-07-25 21:52:14 +10:00
sentinelobject.c gh-148829: Make sentinels' repr and module customizable (#149654) 2026-05-19 09:18:56 -07:00
setobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
sliceobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
structseq.c gh-148119: Refactor get_type_attr_as_size to improve error handling in structseq.c (#148120) 2026-04-06 17:41:30 +05:30
templateobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
tupleobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
typeobject.c gh-150285: Fix too long docstrings in builtins (GH-150293) 2026-05-24 15:03:32 +03:00
typevarobject.c gh-149171: Make TypeAliasType __module__ writable (#149172) 2026-05-02 17:28:08 +00:00
unicode_format.c gh-142037: Improve error messages for printf-style formatting (GH-142081) 2026-01-24 11:13:50 +00:00
unicode_formatter.c gh-139353: Rename formatter_unicode.c to unicode_formatter.c (#139723) 2025-10-08 14:56:00 +02:00
unicode_writer.c gh-146196: Fix Undefined Behavior in _PyUnicodeWriter_WriteASCIIString() (#146201) 2026-03-20 15:58:41 +00:00
unicodectype.c gh-129117: Add unicodedata.isxidstart() function (#140269) 2025-10-30 10:18:12 +00:00
unicodeobject.c gh-150285: Fix too long docstrings in builtins (GH-150293) 2026-05-24 15:03:32 +03:00
unicodetype_db.h closes gh-138706: update Unicode to 17.0.0 (#138719) 2025-09-11 09:58:39 -07:00
unionobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00
weakrefobject.c gh-150319: Replace all documentation which says "See PEP 585" (#150325) 2026-06-02 21:13:34 +01:00

Source files for various builtin objects