From 9d3627e311211a1b4abcda29c36fe4afe2c46532 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Fri, 4 May 2018 13:00:50 +0200 Subject: bpo-33332: Add signal.valid_signals() (GH-6581) --- Lib/asyncio/unix_events.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Lib/asyncio/unix_events.py') diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 6cac137cacb..f64037a25c6 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -167,8 +167,8 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop): if not isinstance(sig, int): raise TypeError(f'sig must be an int, not {sig!r}') - if not (1 <= sig < signal.NSIG): - raise ValueError(f'sig {sig} out of range(1, {signal.NSIG})') + if sig not in signal.valid_signals(): + raise ValueError(f'invalid signal number {sig}') def _make_read_pipe_transport(self, pipe, protocol, waiter=None, extra=None): -- cgit v1.2.3