]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-130824: Clean up test wrappers for PyLong_*AndOverflow functions (GH-130871)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 5 Mar 2025 10:50:53 +0000 (12:50 +0200)
committerGitHub <noreply@github.com>
Wed, 5 Mar 2025 10:50:53 +0000 (11:50 +0100)
Modules/_testlimitedcapi/long.c

index d896435c99a169c5cb1d8b721db40fd47e0e3f85..34bc7331da92477146f83b5a9a427879657bab91 100644 (file)
@@ -625,8 +625,7 @@ pylong_aslongandoverflow(PyObject *module, PyObject *arg)
     int overflow = UNINITIALIZED_INT;
     long value = PyLong_AsLongAndOverflow(arg, &overflow);
     if (value == -1 && PyErr_Occurred()) {
-        // overflow can be 0 if a separate exception occurred
-        assert(overflow == -1 || overflow == 0);
+        assert(overflow == 0);
         return NULL;
     }
     return Py_BuildValue("li", value, overflow);
@@ -672,8 +671,7 @@ pylong_aslonglongandoverflow(PyObject *module, PyObject *arg)
     int overflow = UNINITIALIZED_INT;
     long long value = PyLong_AsLongLongAndOverflow(arg, &overflow);
     if (value == -1 && PyErr_Occurred()) {
-        // overflow can be 0 if a separate exception occurred
-        assert(overflow == -1 || overflow == 0);
+        assert(overflow == 0);
         return NULL;
     }
     return Py_BuildValue("Li", value, overflow);