cpython/Misc/NEWS.d/next/Core and Builtins/2022-05-20-13-32-24.gh-issue-93012.e9B-pv.rst
Wenzel Jakob 5e34b494a0
gh-60074: add new stable API function PyType_FromMetaclass (GH-93012)
Added a new stable API function ``PyType_FromMetaclass``, which mirrors
the behavior of ``PyType_FromModuleAndSpec`` except that it takes an
additional metaclass argument. This is, e.g., useful for language
binding tools that need to store additional information in the type
object.
2022-05-27 10:27:39 +02:00

8 lines
509 B
ReStructuredText

Added the new function :c:func:`PyType_FromMetaclass`, which generalizes the
existing :c:func:`PyType_FromModuleAndSpec` using an additional metaclass
argument. This is useful for language binding tools, where it can be used to
intercept type-related operations like subclassing or static attribute access
by specifying a metaclass with custom slots.
Importantly, :c:func:`PyType_FromMetaclass` is available in the Limited API,
which provides a path towards migrating more binding tools onto the Stable ABI.