summaryrefslogtreecommitdiffstats
path: root/Lib/xmlrpc
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2011-10-30 19:22:25 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2011-10-30 19:22:25 (GMT)
commit93dfee1dfc0bf572d4d9579fd455a72c0c81f148 (patch)
tree97e46e5042ecdc57548ada76004182f04a188c01 /Lib/xmlrpc
parentc4fec937dcb70175fb0a0e772563a35ebba2d1c6 (diff)
downloadcpython-93dfee1dfc0bf572d4d9579fd455a72c0c81f148.zip
cpython-93dfee1dfc0bf572d4d9579fd455a72c0c81f148.tar.gz
cpython-93dfee1dfc0bf572d4d9579fd455a72c0c81f148.tar.bz2
Issue #13293: Better error message when trying to marshal bytes using xmlrpc.client.
Diffstat (limited to 'Lib/xmlrpc')
-rw-r--r--Lib/xmlrpc/client.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/Lib/xmlrpc/client.py b/Lib/xmlrpc/client.py
index bd59f32..97d5aac 100644
--- a/Lib/xmlrpc/client.py
+++ b/Lib/xmlrpc/client.py
@@ -503,9 +503,7 @@ class Marshaller:
f = self.dispatch[type(value)]
except KeyError:
# check if this object can be marshalled as a structure
- try:
- value.__dict__
- except:
+ if not hasattr(value, '__dict__'):
raise TypeError("cannot marshal %s objects" % type(value))
# check if this class is a sub-class of a basic type,
# because we don't know how to marshal these types
@@ -553,12 +551,6 @@ class Marshaller:
write("</double></value>\n")
dispatch[float] = dump_double
- def dump_string(self, value, write, escape=escape):
- write("<value><string>")
- write(escape(value))
- write("</string></value>\n")
- dispatch[bytes] = dump_string
-
def dump_unicode(self, value, write, escape=escape):
write("<value><string>")
write(escape(value))