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 <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1553>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to