mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
When looking for an alias, first look for the normalized name (which
still may contain dots), then if that doesn't exist look for the name with dots replaced by underscores. This is a little more forgiving.
This commit is contained in:
parent
bfcdb8734e
commit
c8c6065231
1 changed files with 3 additions and 1 deletions
|
|
@ -69,7 +69,9 @@ def search_function(encoding):
|
||||||
globals(), locals(), _import_tail)
|
globals(), locals(), _import_tail)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import aliases
|
import aliases
|
||||||
modname = aliases.aliases.get(modname, modname)
|
modname = (aliases.aliases.get(modname) or
|
||||||
|
aliases.aliases.get(modname.replace('.', '_')) or
|
||||||
|
modname)
|
||||||
try:
|
try:
|
||||||
mod = __import__(modname, globals(), locals(), _import_tail)
|
mod = __import__(modname, globals(), locals(), _import_tail)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue