[issue1242657] list(obj) can swallow KeyboardInterrupt

Karen Tracey report at bugs.python.org
Fri Jul 18 20:35:23 CEST 2008


Karen Tracey <kmtracey at gmail.com> added the comment:

This behavior has reappeared in the 2.6 beta releases:

Python 2.6b2 (r26b2:65082, Jul 18 2008, 13:36:54) 
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class F(object):
...     def __iter__(self):
...         yield 23
...     def __len__(self):
...         print 'len called, raising KeyboardInterrupt'
...         raise KeyboardInterrupt
... 
>>> f = F()
>>> list(f)
len called, raising KeyboardInterrupt
[23]

Should a new bug be opened for this?  (I can't find one but I'm not too
experienced searchign Python's bug tracker.)

----------
nosy: +kmtracey

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1242657>
_______________________________________


More information about the Python-bugs-list mailing list