This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients amaury.forgeotdarc, pitrou, sbt
Date 2011-12-29.22:08:54
SpamBayes Score 1.5726309e-13
Marked as misclassified No
Message-id <1325196535.65.0.933073355806.issue13673@psf.upfronthosting.co.za>
In-reply-to
Content
> I think calling PyErr_WriteUnraisable would be more appropriate than 
> PyErr_Clear.

You mean just adding

    PyErr_CheckSignals();
    if (PyErr_Occurred())
        PyErr_WriteUnraisable(NULL);

before the call to PyFile_WriteString()?  That seems to work:

  >>> from testsigint import *; wait()
  ^CException KeyboardInterrupt ignored
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  RuntimeError

> I also wonder whether it's ok to ignore the exception. Pressing e.g. 
> Ctrl-C generally shouldn't fail to stop the program, even if another 
> exception is being processed at that moment.

The ignoring and clearing of exceptions also happens higher (lower?) in the call stack in print_exception() and print_exception_recursive().  For example, print_exception() ends with

      /* If an error happened here, don't show it.
         XXX This is wrong, but too many callers rely on this behavior. */
      if (err != 0)
          PyErr_Clear();
  }
History
Date User Action Args
2011-12-29 22:08:55sbtsetrecipients: + sbt, amaury.forgeotdarc, pitrou
2011-12-29 22:08:55sbtsetmessageid: <1325196535.65.0.933073355806.issue13673@psf.upfronthosting.co.za>
2011-12-29 22:08:55sbtlinkissue13673 messages
2011-12-29 22:08:54sbtcreate