mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
fix len() when __len__() returns a non number type #5137
This commit is contained in:
parent
c7055a59a6
commit
ee1ae7ccb7
3 changed files with 16 additions and 1 deletions
|
@ -4618,7 +4618,7 @@ slot_sq_length(PyObject *self)
|
|||
|
||||
if (res == NULL)
|
||||
return -1;
|
||||
len = PyLong_AsSsize_t(res);
|
||||
len = PyNumber_AsSsize_t(res, PyExc_OverflowError);
|
||||
Py_DECREF(res);
|
||||
if (len < 0) {
|
||||
if (!PyErr_Occurred())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue