Kaydet (Commit) f71ba95e authored tarafından Georg Brandl's avatar Georg Brandl

#5932: fix error return in _convertPyInt_AsSsize_t() conversion function.

üst ab538fc2
...@@ -107,3 +107,6 @@ class TestScanString(TestCase): ...@@ -107,3 +107,6 @@ class TestScanString(TestCase):
"xxx") "xxx")
self.assertRaises(UnicodeDecodeError, self.assertRaises(UnicodeDecodeError,
json.encoder.encode_basestring_ascii, b"xx\xff") json.encoder.encode_basestring_ascii, b"xx\xff")
def test_overflow(self):
self.assertRaises(OverflowError, json.decoder.scanstring, b"xxx", sys.maxsize+1)
...@@ -143,9 +143,9 @@ _convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr) ...@@ -143,9 +143,9 @@ _convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr)
{ {
/* PyObject to Py_ssize_t converter */ /* PyObject to Py_ssize_t converter */
*size_ptr = PyInt_AsSsize_t(o); *size_ptr = PyInt_AsSsize_t(o);
if (*size_ptr == -1 && PyErr_Occurred()); if (*size_ptr == -1 && PyErr_Occurred())
return 1; return 0;
return 0; return 1;
} }
static PyObject * static PyObject *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment