Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5968205

Browse files
committed
Merged revisions 72314 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r72314 | georg.brandl | 2009-05-05 09:48:12 +0200 (Di, 05 Mai 2009) | 1 line #5932: fix error return in _convertPyInt_AsSsize_t() conversion function. ........
1 parent 011e842 commit 5968205

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/json/tests/test_scanstring.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ def _test_scanstring(self, scanstring):
102102
self.assertEquals(
103103
scanstring('["Bad value", truth]', 2, True),
104104
('Bad value', 12))
105+
106+
def test_overflow(self):
107+
self.assertRaises(OverflowError, json.decoder.scanstring, b"xxx", sys.maxsize+1)

Modules/_json.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ _convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr)
133133
{
134134
/* PyObject to Py_ssize_t converter */
135135
*size_ptr = PyLong_AsSsize_t(o);
136-
if (*size_ptr == -1 && PyErr_Occurred());
137-
return 1;
138-
return 0;
136+
if (*size_ptr == -1 && PyErr_Occurred())
137+
return 0;
138+
return 1;
139139
}
140140

141141
static PyObject *

0 commit comments

Comments
 (0)