[Python-bugs-list] [ python-Bugs-469972 ] xmlrpclib won't marshal new types
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 10 Oct 2001 12:36:48 -0700
Bugs item #469972, was opened at 2001-10-10 12:36
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=469972&group_id=5470
Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Nobody/Anonymous (nobody)
Summary: xmlrpclib won't marshal new types
Initial Comment:
Maybe xmlrpclib should be modified to allow it to marshal subclasses of builtin types (ints, strings, etc). Here's a simple example that demonstrates that it currently won't work with a subclass of str:
>>> import xmlrpclib
>>> class MyString(str):
... pass
...
>>> s = MyString("sdfsdfsdf")
>>> s
'sdfsdfsdf'
>>> s.__class__
<class '__main__.MyString'>
>>> xmlrpclib.dumps((s,))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.2/xmlrpclib.py", line 752, in dumps
data = m.dumps(params)
File "/usr/local/lib/python2.2/xmlrpclib.py", line 448, in dumps
self.__dump(v)
File "/usr/local/lib/python2.2/xmlrpclib.py", line 459, in __dump
raise TypeError, "cannot marshal %s objects" % type(value)
TypeError: cannot marshal <class '__main__.MyString'> objects
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=469972&group_id=5470