]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-107226: PyModule_AddObjectRef() should only be in the limited API 3.10 (GH-107227)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 25 Jul 2023 19:01:45 +0000 (22:01 +0300)
committerGitHub <noreply@github.com>
Tue, 25 Jul 2023 19:01:45 +0000 (22:01 +0300)
Include/modsupport.h
Misc/NEWS.d/next/C API/2023-07-25-13-41-09.gh-issue-107226.N919zH.rst [new file with mode: 0644]

index 51061c5bc8090a6a4e4770bdbf198a5b49cdcda6..88577e027b5275d0627e85959c367a7522f6e52c 100644 (file)
@@ -22,10 +22,12 @@ PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize
 PyAPI_FUNC(PyObject *) Py_BuildValue(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 error, raise an exception and return -1.
 PyAPI_FUNC(int) PyModule_AddObjectRef(PyObject *mod, const char *name, PyObject *value);
+#endif   /* Py_LIMITED_API */
 
 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
 // Similar to PyModule_AddObjectRef() but steal a reference to 'value'.
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 (file)
index 0000000..6178f18
--- /dev/null
@@ -0,0 +1,2 @@
+:c:func:`PyModule_AddObjectRef` is now only available in the limited API
+version 3.10 or later.