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 Uri Okrent
Recipients Uri Okrent
Date 2016-06-09.15:09:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1465484956.65.0.651270200726.issue27281@psf.upfronthosting.co.za>
In-reply-to
Content
Attempting to unpickle an xmlrpc.client.Fault will raise a TypeError:

>>> import xmlrpc.client as xmlrpclib
>>> f = xmlrpclib.Fault(42, 'Test Fault')
>>> import pickle
>>> s = pickle.dumps(f)
>>> pickle.loads(s)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() missing 2 required positional arguments: 'faultCode' and 'faultString'

Apparently unpickle relies on BaseException's args attribute when reconstructing an Exception class that inherits from BaseException (Fault inherits from Exception).  Unfortunately, Fault implements __init__() and does call the base class constructor, but does not pass its arguments, so Fault.args is always an empty tuple.

Simply passing Fault's arguments to the base class constructor allows it to be unpickled.

I've included a patch for 3.x but the issue is present in 2.x as well (the code and fix are exactly the same except in xmlrpclib.py).
History
Date User Action Args
2016-06-09 15:09:16Uri Okrentsetrecipients: + Uri Okrent
2016-06-09 15:09:16Uri Okrentsetmessageid: <1465484956.65.0.651270200726.issue27281@psf.upfronthosting.co.za>
2016-06-09 15:09:16Uri Okrentlinkissue27281 messages
2016-06-09 15:09:16Uri Okrentcreate