[Python-checkins] python/dist/src/Lib/encodings __init__.py,1.9,1.10
loewis@users.sourceforge.net
loewis@users.sourceforge.net
Mon, 29 Jul 2002 07:05:27 -0700
Update of /cvsroot/python/python/dist/src/Lib/encodings
In directory usw-pr-cvs1:/tmp/cvs-serv8135
Modified Files:
__init__.py
Log Message:
Revert #571603 since it is ok to import codecs that are not subdirectories
of encodings. Skip modules that don't have a getregentry function.
Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** __init__.py 28 Jul 2002 11:31:33 -0000 1.9
--- __init__.py 29 Jul 2002 14:05:24 -0000 1.10
***************
*** 56,77 ****
mod = __import__('encodings.' + modname,
globals(), locals(), _import_tail)
! except ImportError,why:
import aliases
modname = aliases.aliases.get(modname, modname)
try:
! mod = __import__('encodings.' + modname, globals(), locals(), _import_tail)
! except ImportError,why:
mod = None
if mod is None:
# Cache misses
_cache[encoding] = None
! return None
!
# Now ask the module for the registry entry
! try:
! entry = tuple(mod.getregentry())
! except AttributeError:
! entry = ()
if len(entry) != 4:
raise CodecRegistryError,\
--- 56,80 ----
mod = __import__('encodings.' + modname,
globals(), locals(), _import_tail)
! except ImportError:
import aliases
modname = aliases.aliases.get(modname, modname)
try:
! mod = __import__(modname, globals(), locals(), _import_tail)
! except ImportError:
mod = None
+
+ try:
+ getregentry = mod.getregentry
+ except AttributeError:
+ # Not a codec module
+ mod = None
+
if mod is None:
# Cache misses
_cache[encoding] = None
! return None
# Now ask the module for the registry entry
! entry = tuple(getregentry())
if len(entry) != 4:
raise CodecRegistryError,\