[Python-checkins] python/dist/src/Python import.c,2.239,2.240

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Thu Oct 7 08:46:28 CEST 2004


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27294/Python

Modified Files:
	import.c 
Log Message:
SF patch #1035498:  -m option to run a module as a script
(Contributed by Nick Coghlan.)



Index: import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.239
retrieving revision 2.240
diff -u -d -r2.239 -r2.240
--- import.c	23 Sep 2004 04:37:36 -0000	2.239
+++ import.c	7 Oct 2004 06:46:25 -0000	2.240
@@ -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



More information about the Python-checkins mailing list