[ python-Bugs-1242657 ] list(obj) can swallow KeyboardInterrupt
SourceForge.net
noreply at sourceforge.net
Fri Jul 22 03:50:53 CEST 2005
Bugs item #1242657, was opened at 2005-07-21 17:22
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1242657&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Steve Alexander (stevea_zope)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: list(obj) can swallow KeyboardInterrupt
Initial Comment:
The example below shows that list(f) swallows the
KeyboardInterrupt.
It swallows any other exception too, such as
MemoryError or application-specific ConflictErrors.
I think the "get the length of the object" optimisation
should catch only AttributeError and TypeError.
>>> class F(object):
... def __iter__(self):
... yield 23
... def __len__(self):
... print "len called. raising Keyboard
Interrupt."
... raise KeyboardInterrupt
...
>>> f = F()
>>> list(f)
len called. raising Keyboard Interrupt.
[23]
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1242657&group_id=5470
More information about the Python-bugs-list
mailing list