Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
073418af
Commit
073418af
authored
May 04, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #26873: xmlrpclib now raises ResponseError on unsupported type tags
instead of silently return incorrect result.
parent
7dc8e1e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
Lib/test/test_xmlrpc.py
Lib/test/test_xmlrpc.py
+14
-0
Lib/xmlrpclib.py
Lib/xmlrpclib.py
+3
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_xmlrpc.py
View file @
073418af
...
...
@@ -208,6 +208,20 @@ class XMLRPCTestCase(unittest.TestCase):
self
.
assertEqual
(
s
,
"abc
\
xc2
\
x95
"
)
self
.
assertEqual
(
items
,
[(
"def
\
xc2
\
x96
"
,
"ghi
\
xc2
\
x97
"
)])
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
)
class
HelperTestCase
(
unittest
.
TestCase
):
def
test_escape
(
self
):
...
...
Lib/xmlrpclib.py
View file @
073418af
...
...
@@ -784,6 +784,7 @@ class Unmarshaller:
self
.
_stack
=
[]
self
.
_marks
=
[]
self
.
_data
=
[]
self
.
_value
=
False
self
.
_methodname
=
None
self
.
_encoding
=
"utf-8"
self
.
append
=
self
.
_stack
.
append
...
...
@@ -814,6 +815,8 @@ class Unmarshaller:
if
tag
==
"array"
or
tag
==
"struct"
:
self
.
_marks
.
append
(
len
(
self
.
_stack
))
self
.
_data
=
[]
if
self
.
_value
and
tag
not
in
self
.
dispatch
:
raise
ResponseError
(
"unknown tag %r"
%
tag
)
self
.
_value
=
(
tag
==
"value"
)
def
data
(
self
,
text
):
...
...
Misc/NEWS
View file @
073418af
...
...
@@ -77,6 +77,9 @@ Core and Builtins
Library
-------
-
Issue
#
26873
:
xmlrpclib
now
raises
ResponseError
on
unsupported
type
tags
instead
of
silently
return
incorrect
result
.
-
Issue
#
24114
:
Fix
an
uninitialized
variable
in
`
ctypes
.
util
`.
The
bug
only
occurs
on
SunOS
when
the
ctypes
implementation
searches
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment