[issue1739842] xmlrpclib can no longer marshal Fault objects

Amaury Forgeot d'Arc report at bugs.python.org
Mon Feb 18 17:05:09 CET 2008


Amaury Forgeot d'Arc added the comment:

Trying to understand the real problem:
Exceptions are not correctly marshalled by xmlrpclib, even with 2.6.

Take a standard exception, and process it:
    e = KeyError("message")
    ((d,), _) = xmlrpclib.loads(xmlrpclib.dumps((e,)))
With python2.4: you get
    {'args': ['message']}
With python2.6: you get
    {}
because 'args' is no more in the Exception's __dict__ anymore (another
regression??)

So to be compatible with 2.4, the correction would be to marshal
BaseException (and subclasses) by dumping its __dict__ augmented with
the "args" member:
    d = value.__dict__.copy()
    d['args'] = value.args
    self.dump_struct(d, write)
Since this code would only concern exception objects which always raise
an error in 2.5, it would not break existing code.

_____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1739842>
_____________________________________


More information about the Python-bugs-list mailing list