summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-06-14 04:15:26 (GMT)
committerGitHub <noreply@github.com>2022-06-14 04:15:26 (GMT)
commit6fd4c8ec7740523bb81191c013118d9d6959bc9d (patch)
treedf4df3a66a89cb1acff0d7721adb62d5553512e3 /Include/cpython
parent7b2064b4b942e1d3c7fd74b5c463250319bc20fb (diff)
downloadcpython-6fd4c8ec7740523bb81191c013118d9d6959bc9d.zip
cpython-6fd4c8ec7740523bb81191c013118d9d6959bc9d.tar.gz
cpython-6fd4c8ec7740523bb81191c013118d9d6959bc9d.tar.bz2
gh-93741: Add private C API _PyImport_GetModuleAttrString() (GH-93742)
It combines PyImport_ImportModule() and PyObject_GetAttrString() and saves 4-6 lines of code on every use. Add also _PyImport_GetModuleAttr() which takes Python strings as arguments.
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/import.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/cpython/import.h b/Include/cpython/import.h
index ef6be68..a69b4f3 100644
--- a/Include/cpython/import.h
+++ b/Include/cpython/import.h
@@ -40,3 +40,6 @@ struct _frozen {
collection of frozen modules: */
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
+
+PyAPI_DATA(PyObject *) _PyImport_GetModuleAttr(PyObject *, PyObject *);
+PyAPI_DATA(PyObject *) _PyImport_GetModuleAttrString(const char *, const char *);