Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 33680:bcafb68ad985 legacy-trunk
SF patch #1035498: -m option to run a module as a script
(Contributed by Nick Coghlan.)
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Thu, 07 Oct 2004 06:46:25 +0000 |
| parents | d74ddcff0724 |
| children | 25378bdb1b3a 4a33c58c319c |
line wrap: on
line diff
--- a/Python/import.c Thu Oct 07 03:58:07 2004 +0000 +++ b/Python/import.c Thu Oct 07 06:46:25 2004 +0000 @@ -1334,6 +1334,22 @@ return fdp; } +/* Helpers for main.c + * Find the source file corresponding to a named module + */ +struct filedescr * +_PyImport_FindModule(const char *name, PyObject *path, char *buf, + size_t buflen, FILE **p_fp, PyObject **p_loader) +{ + return find_module((char *) name, (char *) name, path, + buf, buflen, p_fp, p_loader); +} + +PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr * fd) +{ + return fd->type == PY_SOURCE || fd->type == PY_COMPILED; +} + /* case_ok(char* buf, int len, int namelen, char* name) * The arguments here are tricky, best shown by example: * /a/b/c/d/e/f/g/h/i/j/k/some_long_module_name.py\0
