mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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:
parent
ac1af8093e
commit
d38b1c74f3
5 changed files with 67 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue