[Python-bugs-list] [ python-Bugs-469972 ] xmlrpclib won't marshal new types
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 19 Oct 2001 07:16: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
----------------------------------------------------------------------
Comment By: paul rubin (phr)
Date: 2001-10-19 07:16
Message:
Logged In: YES
user_id=72053
1) anything but the base types aren't part of the
xmlrpc spec
2) be very very careful about unmarshalling any but basic
objects, because of possible security attacks. See
item 471893 for some more info.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=469972&group_id=5470