File tree 2 files changed +16
-1
lines changed
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.)
1930
1930
1931
1931
.. c :member :: PyObject* PyTypeObject.tp_subclasses
1932
1932
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.
1934
1941
1935
1942
**Inheritance: **
1936
1943
Original file line number Diff line number Diff line change @@ -413,6 +413,14 @@ Porting to Python 3.12
413
413
``Py_UNICODE* `` based format (e.g. ``u ``, ``Z ``) anymore. Please migrate
414
414
to other formats for Unicode like ``s ``, ``z ``, ``es ``, and ``U ``.
415
415
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
+
416
424
Deprecated
417
425
----------
418
426
You can’t perform that action at this time.
0 commit comments