[Python-bugs-list] [ python-Bugs-481882 ] pickle/cPickle can raise SystemError
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 14 Nov 2001 14:46:17 -0800
Bugs item #481882, was opened at 2001-11-14 14:43
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=481882&group_id=5470
Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 6
Submitted By: Barry Warsaw (bwarsaw)
Assigned to: Barry Warsaw (bwarsaw)
Summary: pickle/cPickle can raise SystemError
Initial Comment:
pickle and cPickle can raise a SystemError when certain
things fail during unpickling. For example, when
attempting to unpickle a missing named reference (i.e.
a class in a non-importable module, or a missing
function in an existing module). See below.
SystemError clearly is not the right exception to raise
here, given the description of the error in the
exceptions module (it tells you to contact your Python
maintainer!).
pickle and cPickle should probably simply propagate the
original exception without masking it to SystemError.
-----
Python 2.2b1+ (#3, Nov 13 2001, 18:06:11)
[GCC 2.95.3 19991030 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import pickle
>>> pickle.loads('c__builtin__\noops\np0\n.')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/home/barry/projects/python/Lib/pickle.py",
line 979, in loads
return Unpickler(file).load()
File "/home/barry/projects/python/Lib/pickle.py",
line 588, in load
dispatch[key](self)
File "/home/barry/projects/python/Lib/pickle.py",
line 805, in load_global
klass = self.find_class(module, name)
File "/home/barry/projects/python/Lib/pickle.py",
line 815, in find_class
raise SystemError, \
SystemError: Failed to import class oops from module
__builtin__
>>> import cPickle
>>> cPickle.loads('c__builtin__\noops\np0\n.')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
SystemError: Failed to import class oops from module
__builtin__
----------------------------------------------------------------------
>Comment By: Barry Warsaw (bwarsaw)
Date: 2001-11-14 14:46
Message:
Logged In: YES
user_id=12800
Attaching a patch for pickle.py
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=481882&group_id=5470