summaryrefslogtreecommitdiff
path: root/Doc/c-api
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2017-09-15 16:35:20 -0600
committerGitHub <noreply@github.com>2017-09-15 16:35:20 -0600
commit3f9eee6eb4b25fe1926eaa5f00e02344b126f54d (patch)
treec749747e0b4ce492d05c34ad5578b81128be1156 /Doc/c-api
parente82c034496512139e9ea3f68ceda86c04bc7baab (diff)
downloadcpython-git-3f9eee6eb4b25fe1926eaa5f00e02344b126f54d.tar.gz
bpo-28411: Support other mappings in PyInterpreterState.modules. (#3593)
The concrete PyDict_* API is used to interact with PyInterpreterState.modules in a number of places. This isn't compatible with all dict subclasses, nor with other Mapping implementations. This patch switches the concrete API usage to the corresponding abstract API calls. We also add a PyImport_GetModule() function (and some other helpers) to reduce a bunch of code duplication.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/import.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst
index 7c16ece058..8cdc256e7c 100644
--- a/Doc/c-api/import.rst
+++ b/Doc/c-api/import.rst
@@ -204,6 +204,13 @@ Importing Modules
Return the dictionary used for the module administration (a.k.a.
``sys.modules``). Note that this is a per-interpreter variable.
+.. c:function:: PyObject* PyImport_GetModule(PyObject *name)
+
+ Return the already imported module with the given name. If the
+ module has not been imported yet then returns NULL but does not set
+ an error. Returns NULL and sets an error if the lookup failed.
+
+ .. versionadded:: 3.7
.. c:function:: PyObject* PyImport_GetImporter(PyObject *path)