diff options
author | Guido van Rossum <guido@python.org> | 2002-10-04 20:49:05 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-10-04 20:49:05 +0000 |
commit | c8c6065231d4595a28fe54d3b8f54cb3d222e537 (patch) | |
tree | 672d02b1987b47a4952f171b0308b7d8d260eb51 /Lib/encodings | |
parent | .iterkeys() is not needed. (diff) | |
download | cpython-c8c6065231d4595a28fe54d3b8f54cb3d222e537.tar.gz cpython-c8c6065231d4595a28fe54d3b8f54cb3d222e537.tar.bz2 cpython-c8c6065231d4595a28fe54d3b8f54cb3d222e537.zip |
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.
Diffstat (limited to 'Lib/encodings')
-rw-r--r-- | Lib/encodings/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py index b928976131f..b2542b8bd74 100644 --- a/Lib/encodings/__init__.py +++ b/Lib/encodings/__init__.py @@ -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: |