homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients fmitha, sbt
Date 2012年01月09日.21:27:57
SpamBayes Score 4.3896935e-09
Marked as misclassified No
Message-id <1326144478.74.0.962463624744.issue13751@psf.upfronthosting.co.za>
In-reply-to
Content
This is not specific to multiprocessing. It is really an issue with the pickling of exceptions:
 >>> import cPickle
 >>> class BadExc(Exception):
 ... def __init__(self, a):
 ... '''Non-optional param in the constructor.'''
 ... self.a = a
 ...
 >>> a = cPickle.dumps(BadExc(1))
 >>> cPickle.loads(a)
 Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 TypeError: ('__init__() takes exactly 2 arguments (1 given)', <class '__main__.BadExc'>, ())
I think that when you create a new exception class with an __init__() method, you need to make sure that self.args is set properly by calling the __init__() method of the parent class using the same arguments. So you can instead do
 class BadExc(Exception):
 def __init__(self, a):
 '''Non-optional param in the constructor.'''
 Exception.__init__(self, a)
 self.a = a
History
Date User Action Args
2012年01月09日 21:27:58sbtsetrecipients: + sbt, fmitha
2012年01月09日 21:27:58sbtsetmessageid: <1326144478.74.0.962463624744.issue13751@psf.upfronthosting.co.za>
2012年01月09日 21:27:58sbtlinkissue13751 messages
2012年01月09日 21:27:58sbtcreate

AltStyle によって変換されたページ (->オリジナル) /