mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Fixed a modulefinder crash on certain relative imports.
This commit is contained in:
parent
9f616f48ca
commit
1fac5a4505
3 changed files with 22 additions and 1 deletions
|
|
@ -309,7 +309,10 @@ class ModuleFinder:
|
|||
def _add_badmodule(self, name, caller):
|
||||
if name not in self.badmodules:
|
||||
self.badmodules[name] = {}
|
||||
self.badmodules[name][caller.__name__] = 1
|
||||
if caller:
|
||||
self.badmodules[name][caller.__name__] = 1
|
||||
else:
|
||||
self.badmodules[name]["-"] = 1
|
||||
|
||||
def _safe_import_hook(self, name, caller, fromlist, level=-1):
|
||||
# wrapper for self.import_hook() that won't raise ImportError
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue