-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
signal.signal, et al, doesn't support [SIGRTMIN,SIGRTMAX] on FreeBSD (not included in NSIG) #91145
Comments
As noted in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262487, cpython relies on the definition of NSIG when building signal handlers to determine what signals are and aren't invalid. Unfortunately on FreeBSD, NSIG doesn't include [SIGRTMIN,SIGRTMAX], as shown below: $ python2
Python 2.7.18 (default, Dec 3 2020, 01:19:40)
[GCC 4.2.1 Compatible FreeBSD Clang 8.0.1 (tags/RELEASE_801/final 366581)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import signal
>>> signal.signal(signal.SIGRTMIN, signal.SIG_DFL)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: signal number out of range
>>> exit()
$ python3
Python 3.8.12 (default, Jan 4 2022, 01:10:15)
[Clang 10.0.1 ([email protected]:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611a on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import signal
>>> signal.signal(signal.SIGRTMIN, signal.SIG_IGN)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal number out of range
>>> exit()
$ python3.11
Python 3.11.0a3 (main, Feb 4 2022, 02:34:52) [Clang 10.0.1 ([email protected]:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import signal
>>> signal.signal(signal.SIGRTMIN, signal.SIG_IGN)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.11/signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: signal number out of range
>>> exit()
$ This results in a cpython interface which doesn't match the OS's signal(3) interface:
Linux includes [SIGRTMIN,SIGRTMAX] in NSIG, which means it allows these values in signal.signal without issue (confirmed on Ubuntu 18.04.6 LTS). While one can definitely argue that this is an OS portability defect and this should be resolved in FreeBSD (and thus, not fixed in cpython), it doesn't address existing behavior on older versions of FreeBSD where this hasn't been resolved yet. FreeBSD bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262487 |
This issue is a duplicate of #64783. |
The test is incorrect and breaks Emscripten because it also checks the value of |
It seems like it has been fixed by #92350 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: