homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients barry, christian.heimes, eli.bendersky, giampaolo.rodola, serhiy.storchaka, vstinner, xiang.zhang
Date 2022年01月21日.09:54:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642758867.97.0.785553426968.issue23325@roundup.psfhosted.org>
In-reply-to
Content
Understood, thanks!
A trivial fix for the integer comparison bug would solve my issue:
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -527,21 +527,20 @@ signal_signal_impl(PyObject *module, int signalnum, PyObject *handler)
 "signal number out of range");
 return NULL;
 }
- if (handler == modstate->ignore_handler) {
+ if (PyCallable_Check(handler)) {
+ func = signal_handler;
+ }
+ else if (PyObject_RichCompareBool(handler, modstate->ignore_handler, Py_EQ) == 1) {
 func = SIG_IGN;
 }
- else if (handler == modstate->default_handler) {
+ else if (PyObject_RichCompareBool(handler, modstate->default_handler, Py_EQ) == 1) {
 func = SIG_DFL;
- }
- else if (!PyCallable_Check(handler)) {
+ } else {
 _PyErr_SetString(tstate, PyExc_TypeError,
 "signal handler must be signal.SIG_IGN, "
 "signal.SIG_DFL, or a callable object");
 return NULL;
 }
- else {
- func = signal_handler;
- }
 
 /* Check for pending signals before changing signal handler */
 if (_PyErr_CheckSignalsTstate(tstate)) {
History
Date User Action Args
2022年01月21日 09:54:28christian.heimessetrecipients: + christian.heimes, barry, vstinner, giampaolo.rodola, eli.bendersky, serhiy.storchaka, xiang.zhang
2022年01月21日 09:54:27christian.heimessetmessageid: <1642758867.97.0.785553426968.issue23325@roundup.psfhosted.org>
2022年01月21日 09:54:27christian.heimeslinkissue23325 messages
2022年01月21日 09:54:27christian.heimescreate

AltStyle によって変換されたページ (->オリジナル) /