@@ -1619,7 +1619,8 @@ def _allow_interrupt(prepare_notifier, handle_sigint):
16191619 If SIGINT was indeed caught, after exiting the on_signal() function the
16201620 interpreter reacts to the signal according to the handler function which
16211621 had been set up by a signal.signal() call; here, we arrange to call the
1622- backend-specific *handle_sigint* function. Finally, we call the old SIGINT
1622+ backend-specific *handle_sigint* function, passing the notifier object
1623+ as returned by prepare_notifier(). Finally, we call the old SIGINT
16231624 handler with the same arguments that were given to our custom handler.
16241625
16251626 We do this only if the old handler for SIGINT was not None, which means
@@ -1629,7 +1630,7 @@ def _allow_interrupt(prepare_notifier, handle_sigint):
16291630 Parameters
16301631 ----------
16311632 prepare_notifier : Callable[[socket.socket], object]
1632- handle_sigint : Callable[[], object]
1633+ handle_sigint : Callable[[object ], object]
16331634 """
16341635
16351636 old_sigint_handler = signal .getsignal (signal .SIGINT )
@@ -1645,9 +1646,10 @@ def _allow_interrupt(prepare_notifier, handle_sigint):
16451646 notifier = prepare_notifier (rsock )
16461647
16471648 def save_args_and_handle_sigint (* args ):
1648- nonlocal handler_args
1649+ nonlocal handler_args , notifier
16491650 handler_args = args
1650- handle_sigint ()
1651+ handle_sigint (notifier )
1652+ notifier = None
16511653
16521654 signal .signal (signal .SIGINT , save_args_and_handle_sigint )
16531655 try :
0 commit comments