mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	SF patch #1035498: -m option to run a module as a script
(Contributed by Nick Coghlan.)
This commit is contained in:
		
							parent
							
								
									fb09f0e85c
								
							
						
					
					
						commit
						db29e0fe8c
					
				
					 5 changed files with 109 additions and 11 deletions
				
			
		|  | @ -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 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Raymond Hettinger
						Raymond Hettinger