From: Ben Darnell Date: Sun, 19 Jan 2020 16:00:06 +0000 (-0500) Subject: test: Add hasattr check for SIGCHLD X-Git-Tag: v6.1.0b1~40^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7330e65a92b60dd405eb36e1f424e0553a1ae87;p=thirdparty%2Ftornado.git test: Add hasattr check for SIGCHLD This name is not present on all platforms --- diff --git a/tornado/test/twisted_test.py b/tornado/test/twisted_test.py index 0e03cec9f..2fc3f8e30 100644 --- a/tornado/test/twisted_test.py +++ b/tornado/test/twisted_test.py @@ -51,7 +51,10 @@ skipIfNoTwisted = unittest.skipUnless(have_twisted, "twisted module not present" def save_signal_handlers(): saved = {} - for sig in [signal.SIGINT, signal.SIGTERM, signal.SIGCHLD]: + signals = [signal.SIGINT, signal.SIGTERM] + if hasattr(signal, "SIGCHLD"): + signals.append(signal.SIGCHLD) + for sig in signals: saved[sig] = signal.getsignal(sig) if "twisted" in repr(saved): # This indicates we're not cleaning up after ourselves properly.