diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2012-10-06 12:03:24 (GMT) |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2012-10-06 12:03:24 (GMT) |
commit | aa9a79d27958ae5afb6c8769a2b342d98677c091 (patch) | |
tree | 24d49f530111a345c57f053a7f40652fa51d27a3 /Objects/iterobject.c | |
parent | ef08fb1f040cb51e752c6b1322008714262fbf3e (diff) | |
download | cpython-aa9a79d27958ae5afb6c8769a2b342d98677c091.zip cpython-aa9a79d27958ae5afb6c8769a2b342d98677c091.tar.gz cpython-aa9a79d27958ae5afb6c8769a2b342d98677c091.tar.bz2 |
Issue #16148: implemented PEP 424
Diffstat (limited to 'Objects/iterobject.c')
-rw-r--r-- | Objects/iterobject.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 3cfbeaf..cf4af5b 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -76,9 +76,14 @@ iter_len(seqiterobject *it) Py_ssize_t seqsize, len; if (it->it_seq) { - seqsize = PySequence_Size(it->it_seq); - if (seqsize == -1) - return NULL; + if (_PyObject_HasLen(it->it_seq)) { + seqsize = PySequence_Size(it->it_seq); + if (seqsize == -1) + return NULL; + } + else { + return Py_NotImplemented; + } len = seqsize - it->it_index; if (len >= 0) return PyLong_FromSsize_t(len); |