summaryrefslogtreecommitdiffstats
path: root/Lib/signal.py
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2018-05-04 11:00:50 (GMT)
committerGitHub <noreply@github.com>2018-05-04 11:00:50 (GMT)
commit9d3627e311211a1b4abcda29c36fe4afe2c46532 (patch)
tree26f76c94bb55ee8b242f044efa26cfd8b08e9d26 /Lib/signal.py
parent491bbedc209fea314a04cb3015da68fb0aa63238 (diff)
downloadcpython-9d3627e311211a1b4abcda29c36fe4afe2c46532.zip
cpython-9d3627e311211a1b4abcda29c36fe4afe2c46532.tar.gz
cpython-9d3627e311211a1b4abcda29c36fe4afe2c46532.tar.bz2
bpo-33332: Add signal.valid_signals() (GH-6581)
Diffstat (limited to 'Lib/signal.py')
-rw-r--r--Lib/signal.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/signal.py b/Lib/signal.py
index 9f05c91..826b62c 100644
--- a/Lib/signal.py
+++ b/Lib/signal.py
@@ -65,8 +65,7 @@ if 'pthread_sigmask' in _globals:
if 'sigpending' in _globals:
@_wraps(_signal.sigpending)
def sigpending():
- sigs = _signal.sigpending()
- return set(_int_to_enum(x, Signals) for x in sigs)
+ return {_int_to_enum(x, Signals) for x in _signal.sigpending()}
if 'sigwait' in _globals:
@@ -76,4 +75,11 @@ if 'sigwait' in _globals:
return _int_to_enum(retsig, Signals)
sigwait.__doc__ = _signal.sigwait
+
+if 'valid_signals' in _globals:
+ @_wraps(_signal.valid_signals)
+ def valid_signals():
+ return {_int_to_enum(x, Signals) for x in _signal.valid_signals()}
+
+
del _globals, _wraps