]> granicus.if.org Git - python/commitdiff
In PyNumber_ToBase, changed from an assert to returning an error when PyObject_Index...
authorEric Smith <eric@trueblade.com>
Fri, 15 Feb 2008 12:14:32 +0000 (12:14 +0000)
committerEric Smith <eric@trueblade.com>
Fri, 15 Feb 2008 12:14:32 +0000 (12:14 +0000)
Objects/abstract.c

index 93d73bb148990cba97cf4242715ed332d7d78b97..a377e765b20687c2639a8709134e259fffef7c98 100644 (file)
@@ -1275,7 +1275,11 @@ PyNumber_ToBase(PyObject *n, int base)
        else if (PyInt_Check(index))
                res = _PyInt_Format((PyIntObject*)index, base, 1);
        else
-               assert("PyNumber_ToBase: not long or int");
+               /* It should not be possible to get here, as
+                  PyNumber_Index already has a check for the same
+                  condition */
+               PyErr_SetString(PyExc_ValueError, "PyNumber_ToBase: index not "
+                               "int or long");
        Py_DECREF(index);
        return res;
 }