summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-02-03 02:28:00 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-02-03 02:28:00 (GMT)
commit2d036025766bab417bb1d946f52918048e0f6589 (patch)
tree86ecafed332e5cf2e5d5fd41cddd6be3622d2f08 /Objects
parent24e2872f0d04c0d7c1745f677aef1a335433b556 (diff)
downloadcpython-2d036025766bab417bb1d946f52918048e0f6589.zip
cpython-2d036025766bab417bb1d946f52918048e0f6589.tar.gz
cpython-2d036025766bab417bb1d946f52918048e0f6589.tar.bz2
Validate that __length_hint__ returns a usable result.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index c10f4ca..b47b1c9 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -123,7 +123,7 @@ _PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
PyErr_Clear();
return defaultvalue;
}
- rv = PyInt_AsLong(ro);
+ rv = rv = PyLong_Check(ro) ? PyLong_AsSsize_t(ro) : defaultvalue;
Py_DECREF(ro);
return rv;
}