@@ -1616,7 +1616,8 @@ def _allow_interrupt(prepare_notifier, handle_sigint):
16161616 If SIGINT was indeed caught, after exiting the on_signal() function the
16171617 interpreter reacts to the signal according to the handler function which
16181618 had been set up by a signal.signal() call; here, we arrange to call the
1619- backend-specific *handle_sigint* function. Finally, we call the old SIGINT
1619+ backend-specific *handle_sigint* function, passing the notifier object
1620+ as returned by prepare_notifier(). Finally, we call the old SIGINT
16201621 handler with the same arguments that were given to our custom handler.
16211622
16221623 We do this only if the old handler for SIGINT was not None, which means
@@ -1626,7 +1627,7 @@ def _allow_interrupt(prepare_notifier, handle_sigint):
16261627 Parameters
16271628 ----------
16281629 prepare_notifier : Callable[[socket.socket], object]
1629- handle_sigint : Callable[[], object]
1630+ handle_sigint : Callable[[object ], object]
16301631 """
16311632
16321633 old_sigint_handler = signal .getsignal (signal .SIGINT )
@@ -1642,9 +1643,10 @@ def _allow_interrupt(prepare_notifier, handle_sigint):
16421643 notifier = prepare_notifier (rsock )
16431644
16441645 def save_args_and_handle_sigint (* args ):
1645- nonlocal handler_args
1646+ nonlocal handler_args , notifier
16461647 handler_args = args
1647- handle_sigint ()
1648+ handle_sigint (notifier )
1649+ notifier = None
16481650
16491651 signal .signal (signal .SIGINT , save_args_and_handle_sigint )
16501652 try :
0 commit comments