From 6084448bc236bfae17b46eb0a476fbe251e7cb51 Mon Sep 17 00:00:00 2001 From: Sebastiano Barezzi Date: Fri, 7 Jan 2022 18:53:42 +0100 Subject: [PATCH] discord: client: Ignore RuntimeError when calling add_signal_handler() (#673) * When Client.run() is called in a new thread (using threading.Thread), add_signal_handler will raise the following exception: * RuntimeError: set_wakeup_fd only works in main thread of the main interpreter * We can ignore this as well Change-Id: Id21beaff59e1450186c4410e1ead41c0f738e01e Signed-off-by: Sebastiano Barezzi --- discord/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/client.py b/discord/client.py index fdac73b4a6..62b998bc4a 100644 --- a/discord/client.py +++ b/discord/client.py @@ -639,7 +639,7 @@ def run(self, *args: Any, **kwargs: Any) -> None: try: loop.add_signal_handler(signal.SIGINT, lambda: loop.stop()) loop.add_signal_handler(signal.SIGTERM, lambda: loop.stop()) - except NotImplementedError: + except (NotImplementedError, RuntimeError): pass async def runner():