Message32369
xmlrpclib attempts to marshal class instances by registering the dump_instance() method as the marshaller for the <type 'instance'> type. This is how marshalling of Fault objects contained in a tuple (for example, one result in a multicall) is handled. This worked for Fault objects in python2.4 and earlier because they were old-style classes, and their type was always <type 'instance'>.
In python2.5, Exception (and thus Fault, which inherits from it) moved from an old-style class to a new-style class (inheriting from object). This means that rather than type(faultinstance) returning <type 'instance'>, it returns <class 'xmlrpclib.Fault'>. This results in xmlrpclib.Marshaller.__dump() throwing TypeError when it encounters a Fault (or any other new-style class). This is a regression from python2.4 and earlier, and is particularly problematic for applications that expect to be able to marshal Fault instances.
I've attached a simple patch which allows Fault objects (and all other new-style classes) to be marshalled as structs, the same way Fault objects and old-style classes were in python2.4 and earlier. This fixes the regression caused by the change in the Exception inheritance hierarchy.
|
|
Date |
User |
Action |
Args |
2007-08-23 14:55:41 | admin | link | issue1739842 messages |
2007-08-23 14:55:41 | admin | create | |
|