[Python-checkins] CVS: python/dist/src/Lib/encodings __init__.py,1.5,1.6
M.-A. Lemburg
lemburg@users.sourceforge.net
Wed, 19 Sep 2001 04:52:09 -0700
Update of /cvsroot/python/python/dist/src/Lib/encodings
In directory usw-pr-cvs1:/tmp/cvs-serv31000/Lib/encodings
Modified Files:
__init__.py
Log Message:
Fixed search function error reporting in the encodings package
__init__.py module to raise errors which can be catched as LookupErrors
as well as SystemErrors.
Modified the error messages to include more information about the
failing module.
Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** __init__.py 2000/12/12 14:45:35 1.5
--- __init__.py 2001/09/19 11:52:07 1.6
***************
*** 29,37 ****
"""#"
! import codecs,aliases
_cache = {}
_unknown = '--unknown--'
def search_function(encoding):
--- 29,41 ----
"""#"
! import codecs,aliases,exceptions
_cache = {}
_unknown = '--unknown--'
+ class CodecRegistryError(exceptions.LookupError,
+ exceptions.SystemError):
+ pass
+
def search_function(encoding):
***************
*** 57,68 ****
entry = ()
if len(entry) != 4:
! raise SystemError,\
! 'module "%s.%s" failed to register' % \
! (__name__,modname)
for obj in entry:
if not callable(obj):
! raise SystemError,\
! 'incompatible codecs in module "%s.%s"' % \
! (__name__,modname)
# Cache the codec registry entry
--- 61,72 ----
entry = ()
if len(entry) != 4:
! raise CodecRegistryError,\
! 'module "%s" (%s) failed to register' % \
! (mod.__name__, mod.__file__)
for obj in entry:
if not callable(obj):
! raise CodecRegistryError,\
! 'incompatible codecs in module "%s" (%s)' % \
! (mod.__name__, mod.__file__)
# Cache the codec registry entry