bpo-26423: Fix possible overflow in wrap_lenfunc() (GH-13606)

Fix possible overflow in wrap_lenfunc() when
sizeof(long) < sizeof(Py_ssize_t) (e.g., 64-bit Windows).
This commit is contained in:
Zackery Spytz 2019-05-28 06:55:29 -06:00 committed by Victor Stinner
parent 04530812e9
commit 05f16416d9
3 changed files with 7 additions and 1 deletions

View file

@ -5536,7 +5536,7 @@ wrap_lenfunc(PyObject *self, PyObject *args, void *wrapped)
res = (*func)(self);
if (res == -1 && PyErr_Occurred())
return NULL;
return PyLong_FromLong((long)res);
return PyLong_FromSsize_t(res);
}
static PyObject *