mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
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:
parent
d90a141bb9
commit
6a44f6eef3
18 changed files with 326 additions and 55 deletions
|
|
@ -291,7 +291,9 @@ ssize_t_converter(PyObject *obj, void *ptr)
|
|||
PyObject *long_obj;
|
||||
Py_ssize_t val;
|
||||
|
||||
long_obj = (PyObject *)_PyLong_FromNbInt(obj);
|
||||
/* XXX Should be replaced with PyNumber_AsSsize_t after the end of the
|
||||
deprecation period. */
|
||||
long_obj = _PyLong_FromNbIndexOrNbInt(obj);
|
||||
if (long_obj == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue