mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Merged revisions 74584 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r74584 | brett.cannon | 2009-08-29 20:47:36 -0700 (Sat, 29 Aug 2009) | 3 lines Have importlib raise ImportError if None is found in sys.modules. This matches current import semantics. ........
This commit is contained in:
		
							parent
							
								
									af0312af7a
								
							
						
					
					
						commit
						8a1a59f0ec
					
				
					 3 changed files with 23 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -860,7 +860,12 @@ def _gcd_import(name, package=None, level=0):
 | 
			
		|||
            name = package[:dot]
 | 
			
		||||
    with _ImportLockContext():
 | 
			
		||||
        try:
 | 
			
		||||
            return sys.modules[name]
 | 
			
		||||
            module = sys.modules[name]
 | 
			
		||||
            if module is None:
 | 
			
		||||
                message = ("import of {} halted; "
 | 
			
		||||
                            "None in sys.modules".format(name))
 | 
			
		||||
                raise ImportError(message)
 | 
			
		||||
            return module
 | 
			
		||||
        except KeyError:
 | 
			
		||||
            pass
 | 
			
		||||
        parent = name.rpartition('.')[0]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue