Skip to content

bpo-45643: Add signal.SIGSTKFLT on platforms where this is defined. #29266

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

Merged
merged 1 commit into from
Dec 13, 2021

Conversation

gareth-rees
Copy link
Contributor

@gareth-rees gareth-rees commented Oct 28, 2021

Background

On Linux, man 7 signal includes SIGSTKFLT in its table of "various other signals":

Signal     Value   Action  Comment
───────────────────────────────────────────────────────────────
SIGSTKFLT  -,16,-   Term   Stack fault on coprocessor (unused)

Here -,16,- means that the signal is defined with the value 16 on x86 and ARM but not on Alpha, SPARC or MIPS. I believe that the intention was to use SIGSTKFLT for stack faults on the x87 math coprocessor, but this was either removed or never implemented, so that the signal is defined in /usr/include/signal.h but not used by the Linux kernel.

Use case

SIGSTKFLT is one of a handful of signals that are not used by the kernel, so that user-space programs are free to use it for their own purposes, for example for inter-thread or inter-process pre-emptive communication.

Accordingly, it would be nice if the name SIGSTKFLT were available in the Python signal module on the platforms where the signal is available, for use and reporting in these cases.

Note

I didn't add any test coverage because there isn't any behaviour to cover -- the generic behaviour will be covered by GenericTests.test_enums() in Lib/test/test_signal.py. I did check by hand that the signal was defined with the correct value:

Python 3.11.0a1+ (heads/main-dirty:b1302abcc8, Oct 28 2021, 10:51:05) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import signal
>>> int(signal.SIGSTKFLT)
16

https://bugs.python.org/issue45643

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add it to the doc please: https://docs.python.org/dev/library/signal.html#signal.SIGABRT

File: Doc/library/signal.rst.

@gareth-rees gareth-rees force-pushed the signalmodule-sigstkflt branch from 0a17f91 to a22b66b Compare December 1, 2021 10:18
@gareth-rees
Copy link
Contributor Author

@vstinner Thanks for the review.

Add it to the doc please

Done. I used the same wording as man 7 signal.

@gareth-rees gareth-rees force-pushed the signalmodule-sigstkflt branch from a22b66b to fd38ace Compare December 5, 2021 17:50
@gareth-rees gareth-rees force-pushed the signalmodule-sigstkflt branch from fd38ace to 8e5325b Compare December 11, 2021 19:43
@vstinner vstinner merged commit a62be77 into python:main Dec 13, 2021
@gareth-rees
Copy link
Contributor Author

@vstinner Thanks for your help with this pull request.

@vstinner
Copy link
Member

Thanks for the better documentation! ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants