Skip to content

Commit c3c8916

Browse files
[3.12] gh-107226: PyModule_AddObjectRef() should only be in the limited API 3.10 (GH-107227) (GH-107260)
(cherry picked from commit 698b015) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 11d86c5 commit c3c8916

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
@@ -39,10 +39,12 @@ PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
3939

4040
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
4141

42+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030a0000
4243
// Add an attribute with name 'name' and value 'obj' to the module 'mod.
4344
// On success, return 0 on success.
4445
// On error, raise an exception and return -1.
4546
PyAPI_FUNC(int) PyModule_AddObjectRef(PyObject *mod, const char *name, PyObject *value);
47+
#endif /* Py_LIMITED_API */
4648

4749
// Similar to PyModule_AddObjectRef() but steal a reference to 'obj'
4850
// (Py_DECREF(obj)) on success (if it returns 0).
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)