summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2004-05-28 20:21:36 (GMT)
committerFred Drake <fdrake@acm.org>2004-05-28 20:21:36 (GMT)
commit8759090562103c5f592e987f2864116af99466c5 (patch)
treebeae92ae9482b9e66b7aa29b0079fb78b6db95dd /Python/import.c
parent80ce6dd5642025f5cdf0ba5556f08df0803f5636 (diff)
downloadcpython-8759090562103c5f592e987f2864116af99466c5.zip
cpython-8759090562103c5f592e987f2864116af99466c5.tar.gz
cpython-8759090562103c5f592e987f2864116af99466c5.tar.bz2
starting to add comments to explain what's here
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index 5143a60..030142a 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1913,6 +1913,17 @@ PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals,
return result;
}
+/* Return the package that an import is being performed in. If globals comes
+ from the module foo.bar.bat (not itself a package), this returns the
+ sys.modules entry for foo.bar. If globals is from a package's __init__.py,
+ the package's entry in sys.modules is returned.
+
+ The *name* of the returned package is returned in buf, with the length of
+ the name in *p_buflen.
+
+ If globals doesn't come from a package or a module in a package, or a
+ corresponding entry is not found in sys.modules, Py_None is returned.
+*/
static PyObject *
get_parent(PyObject *globals, char *buf, int *p_buflen)
{