summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-07-25 20:01:18 (GMT)
committerGitHub <noreply@github.com>2023-07-25 20:01:18 (GMT)
commitc3c8916dea0142736efb087ea08bf667dfcf3c50 (patch)
treed389a068732517dc3b686a62eb390b66d3e5ab92
parent11d86c5c339abd52d1ab5ce0af4d25c44898d046 (diff)
downloadcpython-c3c8916dea0142736efb087ea08bf667dfcf3c50.zip
cpython-c3c8916dea0142736efb087ea08bf667dfcf3c50.tar.gz
cpython-c3c8916dea0142736efb087ea08bf667dfcf3c50.tar.bz2
[3.12] gh-107226: PyModule_AddObjectRef() should only be in the limited API 3.10 (GH-107227) (GH-107260)
(cherry picked from commit 698b01513550798886add5e06a1c3f9a89d7dfc6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
-rw-r--r--Include/modsupport.h2
-rw-r--r--Misc/NEWS.d/next/C API/2023-07-25-13-41-09.gh-issue-107226.N919zH.rst2
2 files changed, 4 insertions, 0 deletions
diff --git a/Include/modsupport.h b/Include/modsupport.h
index 4e369bd..1592bd0 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -39,10 +39,12 @@ PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...);
PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list);
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030a0000
// Add an attribute with name 'name' and value 'obj' to the module 'mod.
// On success, return 0 on success.
// On error, raise an exception and return -1.
PyAPI_FUNC(int) PyModule_AddObjectRef(PyObject *mod, const char *name, PyObject *value);
+#endif /* Py_LIMITED_API */
// Similar to PyModule_AddObjectRef() but steal a reference to 'obj'
// (Py_DECREF(obj)) on success (if it returns 0).
diff --git a/Misc/NEWS.d/next/C API/2023-07-25-13-41-09.gh-issue-107226.N919zH.rst b/Misc/NEWS.d/next/C API/2023-07-25-13-41-09.gh-issue-107226.N919zH.rst
new file mode 100644
index 0000000..6178f18
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2023-07-25-13-41-09.gh-issue-107226.N919zH.rst
@@ -0,0 +1,2 @@
+:c:func:`PyModule_AddObjectRef` is now only available in the limited API
+version 3.10 or later.