]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
When looking for an alias, first look for the normalized name (which
authorGuido van Rossum <guido@python.org>
Fri, 4 Oct 2002 20:49:05 +0000 (20:49 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 4 Oct 2002 20:49:05 +0000 (20:49 +0000)
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.

Lib/encodings/__init__.py

index b928976131f88c2806038ea0905da8fca11e29a9..b2542b8bd745e207783af49ba19545bdbedb0ced 100644 (file)
@@ -69,7 +69,9 @@ def search_function(encoding):
                          globals(), locals(), _import_tail)
     except ImportError:
         import aliases
-        modname = aliases.aliases.get(modname, modname)
+        modname = (aliases.aliases.get(modname) or
+                   aliases.aliases.get(modname.replace('.', '_')) or
+                   modname)
         try:
             mod = __import__(modname, globals(), locals(), _import_tail)
         except ImportError: