[issue1242657] list(obj) can swallow KeyboardInterrupt
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thanks for the review. Fixed in r69227. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- priority: normal - high ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Anyone else want to pick this up from here? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: In _PyObject_LengthHint() code, at the line: if (ro == NULL PyErr_Occurred()) { It seems that PyErr_Occurred() is not useful and is always true when the previous PyObject_CallMethodObjArgs() returned NULL. Otherwise the patch is fine to me. -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Nick Coghlan ncogh...@gmail.com added the comment: Reassigning to Raymond (as per the thread at http://mail.python.org/pipermail/python-dev/2009-January/085030.html) -- assignee: georg.brandl - rhettinger nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Here's a patch that fixes-up length_hint and it's internal callers. I think there are plenty of other places that also swallow exceptions but will leave those for someone who wants to look at every instance of PyErr_Clear() to see if it has been restricted to some small group of exceptions. -- assignee: rhettinger - keywords: +patch versions: +Python 2.7, Python 3.0 Added file: http://bugs.python.org/file12749/lenhint.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Benjamin Peterson [EMAIL PROTECTED] added the comment: Raymond, can you comment? -- nosy: +benjamin.peterson ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Raymond Hettinger [EMAIL PROTECTED] added the comment: Georg's suggestion seems reasonable. Alternatively, you can just catch AttributeError or TypeError. Lowering the priority to normal and marking as unresolved. At some point, it would be nice to review the whole code base to see if other calls to PyErr_Clear() are too aggressive. In that review, perhaps a more clean and general solution with present itself. -- assignee: rhettinger - georg.brandl priority: critical - normal resolution: fixed - versions: +Python 2.6, Python 3.1 ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Georg Brandl [EMAIL PROTECTED] added the comment: The problem is in _PyObject_LengthHint which calls len(o) and masks all exceptions from it. Its comments says This function never fails. Accordingly, it will mask exceptions raised in either method. Would it be better to at least not mask BaseExceptions? ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Karen Tracey [EMAIL PROTECTED] 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 [EMAIL PROTECTED] http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Georg Brandl [EMAIL PROTECTED] added the comment: Reopening. For reference, the revision in which Raymond supposedly fixed this is r39305. -- nosy: +georg.brandl priority: normal - critical status: closed - open ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Karen Tracey [EMAIL PROTECTED] added the comment: Thanks for responding. It had been fixed. 2.4/2.5 behave like so: Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) [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 Traceback (most recent call last): File stdin, line 1, in module File stdin, line 6, in __len__ KeyboardInterrupt It just seems to have regressed in 2.6. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1242657] list(obj) can swallow KeyboardInterrupt
Georg Brandl [EMAIL PROTECTED] added the comment: I'm sorry, my use of supposedly was wrong here. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue1242657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com