SF [#466125] PyLong_AsLongLong works for any integer.

Generalize PyLong_AsLongLong to accept int arguments too.  The real point
is so that PyArg_ParseTuple's 'L' code does too.  That code was
undocumented (AFAICT), so documented it.
This commit is contained in:
Tim Peters 2001-09-30 05:09:37 +00:00
parent ac1af8093e
commit d38b1c74f3
5 changed files with 67 additions and 1 deletions

View file

@ -679,7 +679,13 @@ PyLong_AsLongLong(PyObject *vv)
int one = 1;
int res;
if (vv == NULL || !PyLong_Check(vv)) {
if (vv == NULL) {
PyErr_BadInternalCall();
return -1;
}
if (!PyLong_Check(vv)) {
if (PyInt_Check(vv))
return (LONG_LONG)PyInt_AsLong(vv);
PyErr_BadInternalCall();
return -1;
}