mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	Fix a curious bug: statements like "import sys.time" would succeed,
because the path through the code would notice that sys.__path__ did not exist and it would fall back to the default path (builtins + sys.path) instead of failing). No longer.
This commit is contained in:
		
							parent
							
								
									edde150127
								
							
						
					
					
						commit
						9c0afe5dc7
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		|  | @ -1664,9 +1664,16 @@ import_submodule(mod, subname, fullname) | |||
| 		struct filedescr *fdp; | ||||
| 		FILE *fp = NULL; | ||||
| 
 | ||||
| 		if (mod == Py_None) | ||||
| 			path = NULL; | ||||
| 		else { | ||||
| 			path = PyObject_GetAttrString(mod, "__path__"); | ||||
| 		if (path == NULL) | ||||
| 			if (path == NULL) { | ||||
| 				PyErr_Clear(); | ||||
| 				Py_INCREF(Py_None); | ||||
| 				return Py_None; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		buf[0] = '\0'; | ||||
| 		fdp = find_module(subname, path, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum