From 8107216848672792e420b3254b5217e51bcd4b32 Mon Sep 17 00:00:00 2001 From: David Brooks Date: Fri, 10 Jul 2020 05:07:38 +1200 Subject: [PATCH] Allow for no original signal handler (#517). (#518) --- socketio/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/socketio/client.py b/socketio/client.py index fb3f946..e0d441d 100644 --- a/socketio/client.py +++ b/socketio/client.py @@ -23,7 +23,11 @@ def signal_handler(sig, frame): # pragma: no cover """ for client in reconnecting_clients[:]: client._reconnect_abort.set() - return original_signal_handler(sig, frame) + if callable(original_signal_handler): + return original_signal_handler(sig, frame) + else: # pragma: no cover + # Handle case where no original SIGINT handler was present. + return signal.default_int_handler(sig, frame) original_signal_handler = None