Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The implementation of :func:`signal.siginterrupt` now uses
:c:func:`sigaction` instead of the deprecated :c:func:`siginterrupt`. Patch
Copy link
Member

Choose a reason for hiding this comment

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

You may mention that it's only used when sigaction() is available.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

by Pablo Galindo.
12 changes: 12 additions & 0 deletions Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,19 @@ signal_siginterrupt_impl(PyObject *module, int signalnum, int flag)
"signal number out of range");
return NULL;
}
#ifdef HAVE_SIGACTION
struct sigaction act;
(void) sigaction(signalnum, NULL, &act);
if (flag) {
act.sa_flags &= ~SA_RESTART;
}
else {
act.sa_flags |= SA_RESTART;
}
if (sigaction(signalnum, &act, NULL)<0) {
Copy link
Member

Choose a reason for hiding this comment

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

nitpick:

Suggested change
if (sigaction(signalnum, &act, NULL)<0) {
if (sigaction(signalnum, &act, NULL) < 0) {

and also below: if (siginterrupt(signalnum, flag) < 0) {.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

#else
if (siginterrupt(signalnum, flag)<0) {
#endif
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
Expand Down