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 christian.heimes
Date 2022-01-17.09:01:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642410088.81.0.615313504178.issue46408@roundup.psfhosted.org>
In-reply-to
Content
The signal.signal() function directly compares PyObject *handler with PyObject *modstate->ignore_handler. This works on most platforms because they are both small ints and Python uses singletons for cached small ints.

The assumption breaks when Python is built without small int cache or a platform has SIG_IGN / SIG_DFL that is outside the range of small int cache. The wasm32-emscripten platform uses "((void (*)(int))-2)" (4294967294) for SIG_IGN. The wrong comparison breaks several tests on WASM32. The function should use PyObject_RichCompareBool(handler, modstate->ignore_handler, Py_EQ) instead.

    if (handler == modstate->ignore_handler) {
        func = SIG_IGN;
    }
    else if (handler == modstate->default_handler) {
        func = SIG_DFL;
    }

https://github.com/python/cpython/blob/7f4b69b9076bdbcea31f6ad16eb125ee99cf0175/Modules/signalmodule.c#L530-L534
History
Date User Action Args
2022-01-17 09:01:28christian.heimessetrecipients: + christian.heimes
2022-01-17 09:01:28christian.heimessetmessageid: <1642410088.81.0.615313504178.issue46408@roundup.psfhosted.org>
2022-01-17 09:01:28christian.heimeslinkissue46408 messages
2022-01-17 09:01:28christian.heimescreate