summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-06-20 06:48:14 (GMT)
committerGitHub <noreply@github.com>2023-06-20 06:48:14 (GMT)
commit03f1a132eeb34c738812161947ef171b21d58c25 (patch)
treeefb632b4c885e58425bfd563c92137ef60f7d72d /Include
parent7f97c8e367869e2aebe9f28bc5f8d4ce36448878 (diff)
downloadcpython-03f1a132eeb34c738812161947ef171b21d58c25.zip
cpython-03f1a132eeb34c738812161947ef171b21d58c25.tar.gz
cpython-03f1a132eeb34c738812161947ef171b21d58c25.tar.bz2
gh-105922: Add PyImport_AddModuleRef() function (#105923)
* Add tests on PyImport_AddModuleRef(), PyImport_AddModule() and PyImport_AddModuleObject(). * pythonrun.c: Replace Py_XNewRef(PyImport_AddModule(name)) with PyImport_AddModuleRef(name).
Diffstat (limited to 'Include')
-rw-r--r--Include/import.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Include/import.h b/Include/import.h
index 6c63744..24b23b9 100644
--- a/Include/import.h
+++ b/Include/import.h
@@ -43,6 +43,11 @@ PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
PyAPI_FUNC(PyObject *) PyImport_AddModule(
const char *name /* UTF-8 encoded string */
);
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
+PyAPI_FUNC(PyObject *) PyImport_AddModuleRef(
+ const char *name /* UTF-8 encoded string */
+ );
+#endif
PyAPI_FUNC(PyObject *) PyImport_ImportModule(
const char *name /* UTF-8 encoded string */
);