[IronPython] Bug in Ipy 2.6 when pickling exceptions

Idan Zaltzberg idan at cloudshare.com
Sun Dec 20 11:56:42 CET 2009


Hi,

I'm using IronPython 2.6 final.

When deriving from Exception class, and creating a constructor with a
different signature (not 1 argument), I get an exception when pickling and
unpickling.

Seems like the pickling process "neglects" some of the information so the
unpickling fails.

This can be reproduced with:



>>> class my_exc(Exception):

...     def __init__(self, message, param):

...             super(my_exc, self).__init__(message)

...             self.param = param

...

>>> e = my_exc('message','param')

>>> import pickle

>>> pickle.loads(pickle.dumps(e))

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "C:\Systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 1374, in
loads

  File "C:\Systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 858, in
load

  File "C:\Systems\3rd_party\IronPython\2.6\Lib\pickle.py", line 1133, in
load_reduce

TypeError: __init__() takes exactly 3 arguments (2 given)





Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20091220/698995d7/attachment.html>


More information about the Ironpython-users mailing list