Mercurial > cpython-lru_cache-weakref
comparison Python/import.c @ 32156:56a4ec066621 legacy-trunk
starting to add comments to explain what's here
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Fri, 28 May 2004 20:21:36 +0000 |
| parents | adb42a711696 |
| children | 82fe6832e505 |
comparison
equal
deleted
inserted
replaced
| 32155:efb84ed7377d | 32156:56a4ec066621 |
|---|---|
| 1911 return NULL; | 1911 return NULL; |
| 1912 } | 1912 } |
| 1913 return result; | 1913 return result; |
| 1914 } | 1914 } |
| 1915 | 1915 |
| 1916 /* Return the package that an import is being performed in. If globals comes | |
| 1917 from the module foo.bar.bat (not itself a package), this returns the | |
| 1918 sys.modules entry for foo.bar. If globals is from a package's __init__.py, | |
| 1919 the package's entry in sys.modules is returned. | |
| 1920 | |
| 1921 The *name* of the returned package is returned in buf, with the length of | |
| 1922 the name in *p_buflen. | |
| 1923 | |
| 1924 If globals doesn't come from a package or a module in a package, or a | |
| 1925 corresponding entry is not found in sys.modules, Py_None is returned. | |
| 1926 */ | |
| 1916 static PyObject * | 1927 static PyObject * |
| 1917 get_parent(PyObject *globals, char *buf, int *p_buflen) | 1928 get_parent(PyObject *globals, char *buf, int *p_buflen) |
| 1918 { | 1929 { |
| 1919 static PyObject *namestr = NULL; | 1930 static PyObject *namestr = NULL; |
| 1920 static PyObject *pathstr = NULL; | 1931 static PyObject *pathstr = NULL; |
