A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-November/018618.html below:

[Python-Dev] pickle/cPickle raises SystemError

[Python-Dev] pickle/cPickle raises SystemErrorBarry A. Warsaw barry@zope.com
Wed, 14 Nov 2001 17:55:08 -0500
Did anybody else know that pickle and cPickle can raise a SystemError?
I'm working on a rewrite of the pickle documentation and was playing
around with some of the undefined corners when I stumbled across
this.

SystemError is clearly the wrong exception to raise, given the way the
exception is documented in the exceptions module!  I've submitted SF
bug #481882 which describes the problem and contains candidate patches
(currently only for pickle.py).

I've no idea why pickle.py's find_class() is masking KeyError,
AttributeError, and ImportError and transforming them into
SystemError.  I think the exceptions should just be allowed to
percolate up.  Alternatively (although less correct, IMO) would be to
transform them into UnpicklingErrors.

The Python test suite seems to not cover this point, and it's not
documented anywhere that I can tell, so I feel justified in fixing
this for Python 2.2.  I'm concerned about losing backwards
compatibility with commonly held lore though, so I'm wondering if
anybody out there counts on exactly a SystemError being raised in this
situation?

-Barry


-------------------- snip snip --------------------
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__




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4