-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
bpo-41675: Modernize siginterrupt calls #22028
Conversation
Modules/signalmodule.c
Outdated
else { | ||
act.sa_flags |= SA_RESTART; | ||
} | ||
if (sigaction(signalnum, &act, NULL)<0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick:
if (sigaction(signalnum, &act, NULL)<0) { | |
if (sigaction(signalnum, &act, NULL) < 0) { |
and also below: if (siginterrupt(signalnum, flag) < 0) {
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,3 @@ | |||
The implementation of :func:`signal.siginterrupt` now uses | |||
:c:func:`sigaction` instead of the deprecated :c:func:`siginterrupt`. Patch |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
The glibc deprecated siginterrupt() function has exactly the same code!
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/posix/sigintr.c;h=dd8815a3bcfd1943b5a45933bfbe008fa3d6bee5;hb=HEAD
…lots1 * origin/master: (63 commits) bpo-41627: Distinguish 32 and 64-bit user site packages on Windows (pythonGH-22098) bpo-38585: Remove references to defusedexpat (pythonGH-22095) bpo-41721: Add xlc options (pythonGH-22096) bpo-40486: Specify what happens if directory content change diring iteration (pythonGH-22025) bpo-41638: Improve ProgrammingError message for absent parameter. (pythonGH-21999) bpo-41713: _signal doesn't use multi-phase init (pythonGH-22087) bpo-41700: Skip test if the locale is not supported (pythonGH-22081) [doc] Update documentation on logging optimization. (pythonGH-22075) Fix 'gather' rules in the python parser generator (pythonGH-22021) bpo-41697: Correctly handle KeywordOrStarred when parsing arguments in the parser (pythonGH-22077) [doc] Fix a typo in the graphlib docs (python#22030) bpo-1635741: Port _signal module to multi-phase init (PEP 489) (pythonGH-22049) bpo-39883: Use BSD0 license for code in docs (pythonGH-17635) bpo-39010: Improve test shutdown (python#22066) bpo-41696: Fix handling of debug mode in asyncio.run (python#22069) bpo-41690: Use a loop to collect args in the parser instead of recursion (pythonGH-22053) closes bpo-41689: Preserve text signature from tp_doc in C heap type creation. (pythonGH-22058) Fix invalid escape sequences in the peg_highlight Sphinx extension (pythonGH-22047) bpo-41675: Modernize siginterrupt calls (pythonGH-22028) bpo-41685: Don't pin setuptools version anymore in Doc/Makefile (pythonGH-22062) ...
siginterrupt is deprecated: ./Modules/signalmodule.c:667:5: warning: ‘siginterrupt’ is deprecated: Use sigaction with SA_RESTART instead [-Wdeprecated-declarations] 667 | if (siginterrupt(signalnum, flag)<0) {
Summary: The OSS build fails at compilation with this error: ``` /home/aniketpanse/cinder/Modules/signalmodule.c: In function ‘signal_siginterrupt_impl’: /home/aniketpanse/cinder/Modules/signalmodule.c:661:5: error: ‘siginterrupt’ is deprecated: Use sigaction with SA_RESTART instead [-Werror=deprecated-declarations] 661 | if (siginterrupt(signalnum, flag)<0) { | ^~ In file included from /home/aniketpanse/cinder/Modules/signalmodule.c:26: /usr/include/signal.h:311:12: note: declared here 311 | extern int siginterrupt (int __sig, int __interrupt) __THROW | ^~~~~~~~~~~~ cc1: all warnings being treated as errors make: *** [Makefile:2431: Modules/signalmodule.o] Error 1 make: *** Waiting for unfinished jobs.... ``` Backport upstream fix from python/cpython#22028 Reviewed By: carljm Differential Revision: D28297270 fbshipit-source-id: 6a0125b
https://bugs.python.org/issue41675