mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #26873: xmlrpc now raises ResponseError on unsupported type tags
instead of silently return incorrect result.
This commit is contained in:
parent
a3fd0b26ba
commit
290fed43d9
3 changed files with 20 additions and 0 deletions
|
@ -224,6 +224,20 @@ class XMLRPCTestCase(unittest.TestCase):
|
||||||
self.assertIs(type(newvalue), xmlrpclib.Binary)
|
self.assertIs(type(newvalue), xmlrpclib.Binary)
|
||||||
self.assertIsNone(m)
|
self.assertIsNone(m)
|
||||||
|
|
||||||
|
def test_loads_unsupported(self):
|
||||||
|
ResponseError = xmlrpclib.ResponseError
|
||||||
|
data = '<params><param><value><spam/></value></param></params>'
|
||||||
|
self.assertRaises(ResponseError, xmlrpclib.loads, data)
|
||||||
|
data = ('<params><param><value><array>'
|
||||||
|
'<value><spam/></value>'
|
||||||
|
'</array></value></param></params>')
|
||||||
|
self.assertRaises(ResponseError, xmlrpclib.loads, data)
|
||||||
|
data = ('<params><param><value><struct>'
|
||||||
|
'<member><name>a</name><value><spam/></value></member>'
|
||||||
|
'<member><name>b</name><value><spam/></value></member>'
|
||||||
|
'</struct></value></param></params>')
|
||||||
|
self.assertRaises(ResponseError, xmlrpclib.loads, data)
|
||||||
|
|
||||||
def test_get_host_info(self):
|
def test_get_host_info(self):
|
||||||
# see bug #3613, this raised a TypeError
|
# see bug #3613, this raised a TypeError
|
||||||
transp = xmlrpc.client.Transport()
|
transp = xmlrpc.client.Transport()
|
||||||
|
|
|
@ -640,6 +640,7 @@ class Unmarshaller:
|
||||||
self._stack = []
|
self._stack = []
|
||||||
self._marks = []
|
self._marks = []
|
||||||
self._data = []
|
self._data = []
|
||||||
|
self._value = False
|
||||||
self._methodname = None
|
self._methodname = None
|
||||||
self._encoding = "utf-8"
|
self._encoding = "utf-8"
|
||||||
self.append = self._stack.append
|
self.append = self._stack.append
|
||||||
|
@ -669,6 +670,8 @@ class Unmarshaller:
|
||||||
if tag == "array" or tag == "struct":
|
if tag == "array" or tag == "struct":
|
||||||
self._marks.append(len(self._stack))
|
self._marks.append(len(self._stack))
|
||||||
self._data = []
|
self._data = []
|
||||||
|
if self._value and tag not in self.dispatch:
|
||||||
|
raise ResponseError("unknown tag %r" % tag)
|
||||||
self._value = (tag == "value")
|
self._value = (tag == "value")
|
||||||
|
|
||||||
def data(self, text):
|
def data(self, text):
|
||||||
|
|
|
@ -107,6 +107,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #26873: xmlrpc now raises ResponseError on unsupported type tags
|
||||||
|
instead of silently return incorrect result.
|
||||||
|
|
||||||
- Issue #26711: Fixed the comparison of plistlib.Data with other types.
|
- Issue #26711: Fixed the comparison of plistlib.Data with other types.
|
||||||
|
|
||||||
- Issue #24114: Fix an uninitialized variable in `ctypes.util`.
|
- Issue #24114: Fix an uninitialized variable in `ctypes.util`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue