]> granicus.if.org Git - python/commitdiff
Merged revisions 72314 via svnmerge from
authorGeorg Brandl <georg@python.org>
Tue, 5 May 2009 07:52:05 +0000 (07:52 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 5 May 2009 07:52:05 +0000 (07:52 +0000)
svn+ssh://pythondev@svn.python.org/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.
........

Lib/json/tests/test_scanstring.py
Modules/_json.c

index 2d55672b7ad1b5acae48f66397400cf5c3adbf1d..2e9136b08f9c6e715d3c4838edfb3524b9eb0cf1 100644 (file)
@@ -102,3 +102,6 @@ class TestScanString(TestCase):
         self.assertEquals(
             scanstring('["Bad value", truth]', 2, True),
             ('Bad value', 12))
+
+    def test_overflow(self):
+        self.assertRaises(OverflowError, json.decoder.scanstring, b"xxx", sys.maxsize+1)
index 45f4b58e41db372dcd6bae8990090acf2d3aeebf..c44dbac1f132390faff7d615bc8697a9e635fbba 100644 (file)
@@ -133,9 +133,9 @@ _convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr)
 {
     /* PyObject to Py_ssize_t converter */
     *size_ptr = PyLong_AsSsize_t(o);
-    if (*size_ptr == -1 && PyErr_Occurred());
-        return 1;
-    return 0;
+    if (*size_ptr == -1 && PyErr_Occurred())
+        return 0;
+    return 1;
 }
 
 static PyObject *