[Python-checkins] python/dist/src/Lib/encodings __init__.py,1.6.12.1,1.6.12.2

loewis@users.sourceforge.net loewis@users.sourceforge.net
2002年7月29日 07:04:40 -0700


Update of /cvsroot/python/python/dist/src/Lib/encodings
In directory usw-pr-cvs1:/tmp/cvs-serv7431
Modified Files:
 Tag: release22-maint
	__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.6.12.1
retrieving revision 1.6.12.2
diff -C2 -d -r1.6.12.1 -r1.6.12.2
*** __init__.py	28 Jul 2002 11:33:18 -0000	1.6.12.1
--- __init__.py	29 Jul 2002 14:04:36 -0000	1.6.12.2
***************
*** 49,61 ****
 modname = aliases.aliases.get(modname,modname)
 try:
! mod = __import__('encodings.'+modname,globals(),locals(),'*')
 except ImportError,why:
 # cache misses
 _cache[encoding] = None
 return None
 
 # Now ask the module for the registry entry
 try:
! entry = tuple(mod.getregentry())
 except AttributeError:
 entry = ()
--- 49,68 ----
 modname = aliases.aliases.get(modname,modname)
 try:
! mod = __import__(modname,globals(),locals(),'*')
 except ImportError,why:
 # cache misses
 _cache[encoding] = None
 return None
+ 
+ try:
+ getregentry = mod.getregentry
+ except AttributeError:
+ # Not a codec module
+ _cache[encoding] = None
+ return None
 
 # Now ask the module for the registry entry
 try:
! entry = tuple(getregentry())
 except AttributeError:
 entry = ()

AltStyle によって変換されたページ (->オリジナル) /