summaryrefslogtreecommitdiffstats
path: root/Lib/encodings
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-10-04 20:49:05 (GMT)
committerGuido van Rossum <guido@python.org>2002-10-04 20:49:05 (GMT)
commitc8c6065231d4595a28fe54d3b8f54cb3d222e537 (patch)
tree672d02b1987b47a4952f171b0308b7d8d260eb51 /Lib/encodings
parentbfcdb8734ea13d4404958b0caf100569a5c41f3c (diff)
downloadcpython-c8c6065231d4595a28fe54d3b8f54cb3d222e537.zip
cpython-c8c6065231d4595a28fe54d3b8f54cb3d222e537.tar.gz
cpython-c8c6065231d4595a28fe54d3b8f54cb3d222e537.tar.bz2
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__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py
index b928976..b2542b8 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: