Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 62a48da

Browse files
committedJul 29, 2022
Document the change.
1 parent 2fa815e commit 62a48da

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
 

‎Doc/c-api/typeobj.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,14 @@ and :c:type:`PyType_Type` effectively act as defaults.)
19301930

19311931
.. c:member:: PyObject* PyTypeObject.tp_subclasses
19321932
1933-
List of weak references to subclasses. Internal use only.
1933+
The collection of weak references to subclasses. Internal use only.
1934+
1935+
.. versionchanged:: 3.12
1936+
1937+
Internals detail: For the static builtin types this field no longer
1938+
holds the subclasses. Those are now stored on ``PyInterpreterState``.
1939+
This field is re-purposed to hold the index into the type's storage
1940+
on each interpreter state.
19341941

19351942
**Inheritance:**
19361943

‎Doc/whatsnew/3.12.rst

+8
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,14 @@ Porting to Python 3.12
413413
``Py_UNICODE*`` based format (e.g. ``u``, ``Z``) anymore. Please migrate
414414
to other formats for Unicode like ``s``, ``z``, ``es``, and ``U``.
415415

416+
* ``tp_subclasses`` is no longer used for any static builtin types.
417+
The subclasses are stored internally elsewhere. However, ``tp_subclasses``
418+
may still hold data that will cause a crash if used as an object pointer.
419+
This internal-only ``PyTypeObject`` field should not be used. Use the
420+
exist public C-API or Python API to access ``__subclasses__`` instead.
421+
We mention this in case anyone someone happens to be accessing the
422+
field directly anyway.
423+
416424
Deprecated
417425
----------
418426

0 commit comments

Comments
 (0)
Please sign in to comment.