gh-116936: Add PyType_GetModuleByDef() to the limited C API (#116937)

This commit is contained in:
Victor Stinner 2024-03-25 17:32:20 +01:00 committed by GitHub
parent 0c1a42cf9c
commit 507896d97d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 14 additions and 1 deletions

View File

@ -679,6 +679,7 @@ function,PyType_GenericNew,3.2,,
function,PyType_GetFlags,3.2,,
function,PyType_GetFullyQualifiedName,3.13,,
function,PyType_GetModule,3.10,,
function,PyType_GetModuleByDef,3.13,,
function,PyType_GetModuleName,3.13,,
function,PyType_GetModuleState,3.10,,
function,PyType_GetName,3.11,,

View File

@ -1742,6 +1742,9 @@ New Features
:term:`strong reference` to the constant zero.
(Contributed by Victor Stinner in :gh:`115754`.)
* Add :c:func:`PyType_GetModuleByDef` to the limited C API
(Contributed by Victor Stinner in :gh:`116936`.)
Porting to Python 3.13
----------------------

View File

@ -275,7 +275,6 @@ typedef struct _heaptypeobject {
PyAPI_FUNC(const char *) _PyType_Name(PyTypeObject *);
PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyType_GetModuleByDef(PyTypeObject *, PyModuleDef *);
PyAPI_FUNC(PyObject *) PyType_GetDict(PyTypeObject *);
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);

View File

@ -1247,6 +1247,10 @@ static inline int PyType_CheckExact(PyObject *op) {
# define PyType_CheckExact(op) PyType_CheckExact(_PyObject_CAST(op))
#endif
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
PyAPI_FUNC(PyObject *) PyType_GetModuleByDef(PyTypeObject *, PyModuleDef *);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -708,6 +708,7 @@ SYMBOL_NAMES = (
"PyType_GetFlags",
"PyType_GetFullyQualifiedName",
"PyType_GetModule",
"PyType_GetModuleByDef",
"PyType_GetModuleName",
"PyType_GetModuleState",
"PyType_GetName",

View File

@ -0,0 +1,2 @@
Add :c:func:`PyType_GetModuleByDef` to the limited C API. Patch by Victor
Stinner.

View File

@ -2504,3 +2504,5 @@
added = '3.13'
[function.Py_GetConstantBorrowed]
added = '3.13'
[function.PyType_GetModuleByDef]
added = '3.13'

1
PC/python3dll.c generated
View File

@ -641,6 +641,7 @@ EXPORT_FUNC(PyType_GenericNew)
EXPORT_FUNC(PyType_GetFlags)
EXPORT_FUNC(PyType_GetFullyQualifiedName)
EXPORT_FUNC(PyType_GetModule)
EXPORT_FUNC(PyType_GetModuleByDef)
EXPORT_FUNC(PyType_GetModuleName)
EXPORT_FUNC(PyType_GetModuleState)
EXPORT_FUNC(PyType_GetName)