Improve error message from nb_int returning a non-integer, in various PyInt_As* functions:

This commit is contained in:
Mark Dickinson 2010-05-02 09:38:43 +00:00
parent 8651810df9
commit 328284adcf
1 changed files with 4 additions and 4 deletions

View File

@ -178,7 +178,7 @@ PyInt_AsLong(register PyObject *op)
{ {
Py_DECREF(io); Py_DECREF(io);
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"nb_int should return int object"); "__int__ method should return an integer");
return -1; return -1;
} }
} }
@ -236,7 +236,7 @@ PyInt_AsSsize_t(register PyObject *op)
{ {
Py_DECREF(io); Py_DECREF(io);
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"nb_int should return int object"); "__int__ method should return an integer");
return -1; return -1;
} }
} }
@ -281,7 +281,7 @@ PyInt_AsUnsignedLongMask(register PyObject *op)
{ {
Py_DECREF(io); Py_DECREF(io);
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"nb_int should return int object"); "__int__ method should return an integer");
return (unsigned long)-1; return (unsigned long)-1;
} }
} }
@ -326,7 +326,7 @@ PyInt_AsUnsignedLongLongMask(register PyObject *op)
{ {
Py_DECREF(io); Py_DECREF(io);
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"nb_int should return int object"); "__int__ method should return an integer");
return (unsigned PY_LONG_LONG)-1; return (unsigned PY_LONG_LONG)-1;
} }
} }