File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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+
416424Deprecated
417425----------
418426
You can’t perform that action at this time.
0 commit comments