bpo-36048: Use __index__() instead of __int__() for implicit conversion if available. (GH-11952)

Deprecate using the __int__() method in implicit conversions of Python
numbers to C integers.
This commit is contained in:
Serhiy Storchaka 2019-02-25 17:57:58 +02:00 committed by GitHub
parent d90a141bb9
commit 6a44f6eef3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 326 additions and 55 deletions

View file

@ -340,7 +340,7 @@ get_int_unless_float(PyObject *v)
"array item must be integer");
return NULL;
}
return (PyObject *)_PyLong_FromNbInt(v);
return _PyLong_FromNbIndexOrNbInt(v);
}
static int