diff options
author | Raymond Hettinger <python@rcn.com> | 2009-02-03 02:23:19 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-02-03 02:23:19 (GMT) |
commit | d6fc2623c5e765df20f2072aa6575b0c5c272692 (patch) | |
tree | fed146296b4c1866efd720382e34507c672fd751 /Objects | |
parent | b516370bcbeef7391edc28fa6bfcc8da6d98beea (diff) | |
download | cpython-d6fc2623c5e765df20f2072aa6575b0c5c272692.zip cpython-d6fc2623c5e765df20f2072aa6575b0c5c272692.tar.gz cpython-d6fc2623c5e765df20f2072aa6575b0c5c272692.tar.bz2 |
Validate that __length_hint__ returns a usable result.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 1ac4ac9..d601288 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; } |