mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
bpo-23395: Fix PyErr_SetInterrupt if the SIGINT signal is ignored or not handled (GH-7778)
``_thread.interrupt_main()`` now avoids setting the Python error status if the ``SIGINT`` signal is ignored or not handled by Python.
This commit is contained in:
parent
b82e17e626
commit
608876b6b1
6 changed files with 59 additions and 13 deletions
|
@ -1683,13 +1683,18 @@ _PyErr_CheckSignals(void)
|
|||
}
|
||||
|
||||
|
||||
/* Replacements for intrcheck.c functionality
|
||||
* Declared in pyerrors.h
|
||||
*/
|
||||
/* Simulate the effect of a signal.SIGINT signal arriving. The next time
|
||||
PyErr_CheckSignals is called, the Python SIGINT signal handler will be
|
||||
raised.
|
||||
|
||||
Missing signal handler for the SIGINT signal is silently ignored. */
|
||||
void
|
||||
PyErr_SetInterrupt(void)
|
||||
{
|
||||
trip_signal(SIGINT);
|
||||
if ((Handlers[SIGINT].func != IgnoreHandler) &&
|
||||
(Handlers[SIGINT].func != DefaultHandler)) {
|
||||
trip_signal(SIGINT);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue