diff options
author | Raymond Hettinger <python@rcn.com> | 2004-10-07 06:46:25 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-10-07 06:46:25 (GMT) |
commit | db29e0fe8cab58c68d1263487ba5bac7b99c7612 (patch) | |
tree | 8ca6ad43fa5c3b9878ccf022f7161be0b6ba8b5e /Python | |
parent | fb09f0e85cd75ec46700562687a9da3063ff0b7c (diff) | |
download | cpython-db29e0fe8cab58c68d1263487ba5bac7b99c7612.zip cpython-db29e0fe8cab58c68d1263487ba5bac7b99c7612.tar.gz cpython-db29e0fe8cab58c68d1263487ba5bac7b99c7612.tar.bz2 |
SF patch #1035498: -m option to run a module as a script
(Contributed by Nick Coghlan.)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c index 8f81d6e..75c6d3e 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1334,6 +1334,22 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, 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 |