classification
Title: Expose valid signal set (sigfillset()): add signal.valid_signals()
Type: enhancement Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cheryl.sabella, njs, pitrou, vstinner
Priority: normal Keywords: patch

Created on 2018-04-22 11:03 by pitrou, last changed 2018-05-04 13:29 by pitrou. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6581 merged pitrou, 2018-04-23 19:43
Messages (7)
msg315606 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2018-04-22 11:03
See issue33329: it would be nice to expose a signal module function to get the set of user-actionable signals.  Hopefully sigfillset() does that.
msg316165 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2018-05-04 11:01
New changeset 9d3627e311211a1b4abcda29c36fe4afe2c46532 by Antoine Pitrou in branch 'master':
bpo-33332: Add signal.valid_signals() (GH-6581)
https://github.com/python/cpython/commit/9d3627e311211a1b4abcda29c36fe4afe2c46532
msg316166 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-04 11:03
FYI on Fedora 27, I get:

>>> signal.NSIG
65
>>> set(range(0, signal.NSIG)) - signal.valid_signals()
{0, 33, 32}
>>> len(signal.valid_signals())
62
>>> min(signal.valid_signals())
<Signals.SIGHUP: 1>
>>> max(signal.valid_signals())
<Signals.SIGRTMAX: 64>

So signals 0, 32 and 33 are invalid, the first valid signal is 1 and the last is 64.
msg316171 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-05-04 13:21
On Ubuntu 14.04, I get the same results as Victor.
msg316172 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2018-05-04 13:22
This is expected, see issue33329.
msg316173 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-04 13:23
+    if (sigemptyset(&mask) || sigfillset(&mask)) {

I'm not sure that sigemptyset() is needed.

sigfillset() manual page:

       sigfillset() initializes set to full, including all signals.

The function is used to *initialize* a set.
msg316174 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2018-05-04 13:29
Yes, but we're not losing anything by being overly cautious.
History
Date User Action Args
2018-05-04 13:29:30pitrousetmessages: + msg316174
2018-05-04 13:23:43vstinnersetmessages: + msg316173
2018-05-04 13:22:14pitrousetmessages: + msg316172
2018-05-04 13:21:41cheryl.sabellasetnosy: + cheryl.sabella
messages: + msg316171
2018-05-04 11:03:38vstinnersetnosy: + vstinner
messages: + msg316166
2018-05-04 11:01:34pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-05-04 11:01:01pitrousetmessages: + msg316165
2018-05-03 12:37:24vstinnersettitle: Expose valid signal set (sigfillset()) -> Expose valid signal set (sigfillset()): add signal.valid_signals()
2018-04-23 19:43:50pitrousetnosy: + njs
2018-04-23 19:43:27pitrousetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request6281
2018-04-22 11:03:27pitroucreate