[New-bugs-announce] [issue1553] An errornous __length_hint__ can make list() raise a SystemError
Alexandre Vassalotti
report at bugs.python.org
Tue Dec 4 06:43:57 CET 2007
New submission from Alexandre Vassalotti:
If an iterator with a __length_hint__ method that returns a negative
integer is passed to list(), a SystemError is raised.
>>> class A:
... def __iter__(self):
... return self
... def __length_hint__(self):
... return -1
...
>>> list(A())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: NULL result without error in PyObject_Call
----------
messages: 58176
nosy: alexandre.vassalotti
priority: normal
severity: normal
status: open
title: An errornous __length_hint__ can make list() raise a SystemError
type: behavior
versions: Python 2.5, Python 2.6, Python 3.0
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1553>
__________________________________
More information about the New-bugs-announce
mailing list