Message256833
Somewhat unrelated nitpick: I'm not very happy that _InterruptHandler doesn't return early after calling the original handler.
It's all very well, if the original handler raises or does nothing at all, but if it's a user-installed handler that does something (e.g. print a stack trace to sys.stderr), then it might get called twice (or three times, after my patch).
AFAIU the situation would have to be pretty contrived:
- there's a user-provided SIGINT handler
- unittest installs its own on top
- one of the tests (or some test runner plugin) overrides the SIGINT handler again
- user presses Ctrl-C
- the current SIGINT handler delegates to the unittest _InterruptHandler
- _InterruptHandler notices it's not the current handler and delegates to the original one
- the original handler doesn't raise
- _InterruptHandler.__call__ doesn't return early and goes on to perform the "if called check"
- if this is a second Ctrl-C, the original handler will get called a second time for the same Ctrl-C event
- if there are no registered results, my new code will cause the original handler to get called again (a third, or a 2nd time for the same Ctrl-C event)
Is there a good reason not to add early returns after defering to the original handler? Maybe it's desired that ^C should stop the test suite even if a test overrides the SIGINT handler but delegates back to the unittest one? |
|
Date |
User |
Action |
Args |
2015-12-22 08:19:32 | mgedmin | set | recipients:
+ mgedmin, rbcollins, michael.foord |
2015-12-22 08:19:32 | mgedmin | set | messageid: <1450772372.62.0.525057983875.issue25900@psf.upfronthosting.co.za> |
2015-12-22 08:19:32 | mgedmin | link | issue25900 messages |
2015-12-22 08:19:31 | mgedmin | create | |
|