summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2008-02-15 12:14:32 (GMT)
committerEric Smith <eric@trueblade.com>2008-02-15 12:14:32 (GMT)
commit3f91437e5fa9d48522a3b9c5c7eb9f8b4ff75efb (patch)
treed9bf76b87e281a44ef21e512a57cef100cf987f0 /Objects
parent7adfad850a50722464775d57b5d16b850ecab56a (diff)
downloadcpython-3f91437e5fa9d48522a3b9c5c7eb9f8b4ff75efb.zip
cpython-3f91437e5fa9d48522a3b9c5c7eb9f8b4ff75efb.tar.gz
cpython-3f91437e5fa9d48522a3b9c5c7eb9f8b4ff75efb.tar.bz2
In PyNumber_ToBase, changed from an assert to returning an error when PyObject_Index() returns something other than an int or long. It should never be possible to trigger this, as PyObject_Index checks to make sure it returns an int or long.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 93d73bb..a377e76 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -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;
}