diff options
author | Petr Viktorin <encukou@gmail.com> | 2023-05-04 07:56:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 07:56:53 (GMT) |
commit | cd9a56c2b0e14f56f2e83dd4db43c5c69a74b232 (patch) | |
tree | ff971ebbdb11701bab003d743a6d5b928c35184f /Doc/whatsnew | |
parent | 35d273825abc319d0ecbd69110e847f6040d0cd7 (diff) | |
download | cpython-cd9a56c2b0e14f56f2e83dd4db43c5c69a74b232.zip cpython-cd9a56c2b0e14f56f2e83dd4db43c5c69a74b232.tar.gz cpython-cd9a56c2b0e14f56f2e83dd4db43c5c69a74b232.tar.bz2 |
gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.12.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 3dfd787..edbf921 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -1159,6 +1159,21 @@ New Features (Contributed by Petr Viktorin in :gh:`101101`.) +* :pep:`697`: Added API for extending types whose instance memory layout is + opaque: + + - :c:member:`PyType_Spec.basicsize` can be zero or negative to specify + inheriting or extending the base class size. + - :c:func:`PyObject_GetTypeData` and :c:func:`PyType_GetTypeDataSize` + added to allow access to subclass-specific instance data. + - :const:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` + added to allow safely extending certain variable-sized types, including + :c:var:`PyType_Type`. + - :c:macro:`Py_RELATIVE_OFFSET` added to allow defining + :c:type:`members <PyMemberDef>` in terms of a subclass-specific struct. + + (Contributed by Petr Viktorin in :gh:`103509`.) + * Added the new limited C API function :c:func:`PyType_FromMetaclass`, which generalizes the existing :c:func:`PyType_FromModuleAndSpec` using an additional metaclass argument. |