summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-02-25 15:57:58 (GMT)
committerGitHub <noreply@github.com>2019-02-25 15:57:58 (GMT)
commit6a44f6eef3d0958d88882347190b3e2d1222c2e9 (patch)
treebb6474b1e094a672837c3333a081fa4d5d7638f2 /Modules
parentd90a141bb947b68601f8d1f37bc98f7b524f0e01 (diff)
downloadcpython-6a44f6eef3d0958d88882347190b3e2d1222c2e9.zip
cpython-6a44f6eef3d0958d88882347190b3e2d1222c2e9.tar.gz
cpython-6a44f6eef3d0958d88882347190b3e2d1222c2e9.tar.bz2
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.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/arraymodule.c2
-rw-r--r--Modules/zlibmodule.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index f5f461b..a5ba27c 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -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
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 00bbe21..5778dbb 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -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;
}