Skip to content

Commit 698b015

Browse files
gh-107226: PyModule_AddObjectRef() should only be in the limited API 3.10 (GH-107227)
1 parent b5ae7c4 commit 698b015

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Include/modsupport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize
2222
PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...);
2323
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
2424

25+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030a0000
2526
// Add an attribute with name 'name' and value 'obj' to the module 'mod.
2627
// On success, return 0.
2728
// On error, raise an exception and return -1.
2829
PyAPI_FUNC(int) PyModule_AddObjectRef(PyObject *mod, const char *name, PyObject *value);
30+
#endif /* Py_LIMITED_API */
2931

3032
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
3133
// Similar to PyModule_AddObjectRef() but steal a reference to 'value'.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:c:func:`PyModule_AddObjectRef` is now only available in the limited API
2+
version 3.10 or later.

0 commit comments

Comments
 (0)