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
83236f7a
Commit
83236f7a
authored
Jul 26, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #24683: Fixed crashes in _json functions called with arguments of
inappropriate type.
parent
5a294d82
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
Lib/test/test_json/test_separators.py
Lib/test/test_json/test_separators.py
+6
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_json.c
Modules/_json.c
+10
-2
No files found.
Lib/test/test_json/test_separators.py
View file @
83236f7a
...
@@ -39,6 +39,12 @@ class TestSeparators:
...
@@ -39,6 +39,12 @@ class TestSeparators:
self
.
assertEqual
(
h2
,
h
)
self
.
assertEqual
(
h2
,
h
)
self
.
assertEqual
(
d2
,
expect
)
self
.
assertEqual
(
d2
,
expect
)
def
test_illegal_separators
(
self
):
h
=
{
1
:
2
,
3
:
4
}
self
.
assertRaises
(
TypeError
,
self
.
dumps
,
h
,
separators
=
(
b', '
,
': '
))
self
.
assertRaises
(
TypeError
,
self
.
dumps
,
h
,
separators
=
(
', '
,
b': '
))
self
.
assertRaises
(
TypeError
,
self
.
dumps
,
h
,
separators
=
(
b', '
,
b': '
))
class
TestPySeparators
(
TestSeparators
,
PyTest
):
pass
class
TestPySeparators
(
TestSeparators
,
PyTest
):
pass
class
TestCSeparators
(
TestSeparators
,
CTest
):
pass
class
TestCSeparators
(
TestSeparators
,
CTest
):
pass
Misc/NEWS
View file @
83236f7a
...
@@ -66,6 +66,9 @@ Core and Builtins
...
@@ -66,6 +66,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
24683
:
Fixed
crashes
in
_json
functions
called
with
arguments
of
inappropriate
type
.
-
Issue
#
21697
:
shutil
.
copytree
()
now
correctly
handles
symbolic
links
that
-
Issue
#
21697
:
shutil
.
copytree
()
now
correctly
handles
symbolic
links
that
point
to
directories
.
Patch
by
Eduardo
Seabra
and
Thomas
Kluyver
.
point
to
directories
.
Patch
by
Eduardo
Seabra
and
Thomas
Kluyver
.
...
...
Modules/_json.c
View file @
83236f7a
...
@@ -1223,11 +1223,19 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -1223,11 +1223,19 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
assert
(
PyEncoder_Check
(
self
));
assert
(
PyEncoder_Check
(
self
));
s
=
(
PyEncoderObject
*
)
self
;
s
=
(
PyEncoderObject
*
)
self
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"OOOOOOOOp:make_encoder"
,
kwlist
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"OOOOUUOOp:make_encoder"
,
kwlist
,
&
markers
,
&
defaultfn
,
&
encoder
,
&
indent
,
&
key_separator
,
&
item_separator
,
&
markers
,
&
defaultfn
,
&
encoder
,
&
indent
,
&
key_separator
,
&
item_separator
,
&
sort_keys
,
&
skipkeys
,
&
allow_nan
))
&
sort_keys
,
&
skipkeys
,
&
allow_nan
))
return
-
1
;
return
-
1
;
if
(
markers
!=
Py_None
&&
!
PyDict_Check
(
markers
))
{
PyErr_Format
(
PyExc_TypeError
,
"make_encoder() argument 1 must be dict or None, "
"not %.200s"
,
Py_TYPE
(
markers
)
->
tp_name
);
return
-
1
;
}
s
->
markers
=
markers
;
s
->
markers
=
markers
;
s
->
defaultfn
=
defaultfn
;
s
->
defaultfn
=
defaultfn
;
s
->
encoder
=
encoder
;
s
->
encoder
=
encoder
;
...
...
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