diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-07-15 00:53:55 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-07-15 00:53:55 (GMT) |
commit | 7d8a2e41a053b82b1d11dbf84734be99107b8322 (patch) | |
tree | e836a0dfea048ac4ee33824955a8ed3660dd6802 /Objects | |
parent | f526297d1384ebb5a1c154986e7fd882f586cacb (diff) | |
download | cpython-7d8a2e41a053b82b1d11dbf84734be99107b8322.zip cpython-7d8a2e41a053b82b1d11dbf84734be99107b8322.tar.gz cpython-7d8a2e41a053b82b1d11dbf84734be99107b8322.tar.bz2 |
allow any number to be returned from __length_hint__ (closes #15354)
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 81c19e1..3c88711 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -126,7 +126,7 @@ _PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue) PyErr_Clear(); return defaultvalue; } - rv = PyLong_Check(ro) ? PyLong_AsSsize_t(ro) : defaultvalue; + rv = PyNumber_Check(ro) ? PyInt_AsSsize_t(ro) : defaultvalue; Py_DECREF(ro); return rv; } |