Skip to content

Commit 2ce8e13

Browse files
[3.11] gh-107226: PyModule_AddObjectRef() should only be in the limited API 3.10 (GH-107227) (GH-107261)
(cherry picked from commit 698b015) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 41756e3 commit 2ce8e13

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

4242
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
4343

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

4951
// Similar to PyModule_AddObjectRef() but steal a reference to 'obj'
5052
// (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)