summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-02-08 21:07:20 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-02-08 21:07:20 (GMT)
commitee1ae7ccb76b9ae81ae2c4e9c04ce71d7b605038 (patch)
treefad412f4e8eb7f6e84423980ec2830923e43badd /Objects
parentc7055a59a6c7f39e19c0936ff9f48a5c6924fc4f (diff)
downloadcpython-ee1ae7ccb76b9ae81ae2c4e9c04ce71d7b605038.zip
cpython-ee1ae7ccb76b9ae81ae2c4e9c04ce71d7b605038.tar.gz
cpython-ee1ae7ccb76b9ae81ae2c4e9c04ce71d7b605038.tar.bz2
fix len() when __len__() returns a non number type #5137
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 47e425c..a362b84 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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())