Pickling exception object works in 2.4 but not 2.5

Brett Elliott brettelliott at gmail.com
Thu Jun 5 20:13:16 EDT 2008


In 2.5, this is what I get:

Python 2.5.2 (r252:60911, May  7 2008, 15:19:09)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(Exception):
...   member = None
...   def __init__(self,member):
...     self.member=member
...
>>> import cPickle
>>> str = cPickle.dumps(Foo('testmember'))
>>> f2 = cPickle.loads(str)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: ('__init__() takes exactly 2 arguments (1 given)', <class
'__main__.Foo'>, ())


In 2.4 I don't get an error. Is there something I am doing wrong?

Thanks.



More information about the Python-list mailing list