Repository navigation
Conversation
The Py_InitializeEx() initsigs parameter allows the user to control whether python registers its own signal handler. However this parameter was being silently ignored, meaning it was not possible to stop python from registering its signal handler. This patch fixes the issue by updating how _PyMainInterpreterConfig struct is populated, mapping the initsigs parameter to the install_signal_handlers field on that struct.
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. You can check yourself to see if the CLA has been received. Thanks again for your contribution, we look forward to reviewing it! |
| void | ||
| _PyMainInterpreterConfig_Clear(_PyMainInterpreterConfig *config) | ||
| { | ||
| config->install_signal_handlers = -1; |
There was a problem hiding this comment.
I don't think that it's needed, this function is only used to release memory, not to reset a config to the default config.
If you really need to reset to the default config, I would prefer to use _PyMainInterpreterConfig_INIT to reduce maintenance (avoid duplication of code).
| { | ||
| _PyMainInterpreterConfig_Clear(config); | ||
|
|
||
| config->install_signal_handlers = config2->install_signal_handlers; |
There was a problem hiding this comment.
I would prefer to use a COPY_ATTR() macro here:
#define COPY_ATTR(ATTR) config->ATTR = config2->ATTR
Rename the existing macro to COPY_OBJ_ATTR(): see _PyCoreConfig_Copy().
|
I created https://bugs.python.org/issue35233 to track the bug and I wrote a different fix #10519 My fix includes unit tests and also update test.pythoninfo. Thanks @hartcw for spotting the bug! |
|
Thanks @hartcw, I fixed https://bugs.python.org/issue35233 in the 3.7 and master branches. I found other bugs when I wrote more unit tests :-) |
|
OK great, thanks for responding so quickly! |
I found this bug, and fixed it in my local build.
Please consider for upstreaming.