mirror of
https://github.com/python/cpython.git
synced 2024-11-24 02:15:30 +08:00
Issue #13293: Better error message when trying to marshal bytes using xmlrpc.client.
This commit is contained in:
parent
c4fec937dc
commit
93dfee1dfc
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user