Fix thread wait Ctrl-C interrupt did not exit process

This commit is contained in:
allegroai 2020-09-01 17:58:42 +03:00
parent 134fabb7a2
commit 4f06ab1c59

View File

@ -2592,7 +2592,7 @@ class Task(_Task):
if self._signal_recursion_protection_flag: if self._signal_recursion_protection_flag:
# call original # call original
os.kill(os.getpid(), sig) os.kill(os.getpid(), sig)
return org_handler if not callable(org_handler) else signal.SIG_DFL return org_handler if not callable(org_handler) else org_handler(sig, frame)
self._signal_recursion_protection_flag = True self._signal_recursion_protection_flag = True
@ -2616,7 +2616,7 @@ class Task(_Task):
self._signal_recursion_protection_flag = False self._signal_recursion_protection_flag = False
# return handler result # return handler result
return org_handler if not callable(org_handler) else signal.SIG_DFL return org_handler if not callable(org_handler) else org_handler(sig, frame)
# we only remove the signals since this will hang subprocesses # we only remove the signals since this will hang subprocesses
if only_remove_signal_and_exception_hooks: if only_remove_signal_and_exception_hooks: