Issue 28069: signalmodule.c does "is" comparisons for SIG_IGN and SIG_DFL (original) (raw)
Issue28069
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.
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/72256
classification
Title: | signalmodule.c does "is" comparisons for SIG_IGN and SIG_DFL | ||
---|---|---|---|
Type: | behavior | Stage: | |
Components: | Library (Lib) | Versions: | Python 3.6, Python 3.5, Python 2.7 |
process
Status: | open | Resolution: | |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | Nosy List: | berker.peksag, mark.dickinson, serhiy.storchaka | |
Priority: | normal | Keywords: |
Created on 2016-09-10 19:49 by mark.dickinson, last changed 2022-04-11 14:58 by admin.
Messages (3) | ||
---|---|---|
msg275687 - (view) | Author: Mark Dickinson (mark.dickinson) * ![]() |
Date: 2016-09-10 19:49 |
Modules/signalmodule.c contains this code: if (handler == IgnoreHandler) func = SIG_IGN; else if (handler == DefaultHandler) func = SIG_DFL; ... Here IgnoreHandler and DefaultHandler are ints. The code above effectively does an "is" comparison with those ints, assuming that SIG_IGN and SIG_DFL are amongst the small interned ints. | ||
msg275688 - (view) | Author: Mark Dickinson (mark.dickinson) * ![]() |
Date: 2016-09-10 19:52 |
Also applies to 2.7, 3.5. | ||
msg275696 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2016-09-10 20:54 |
This was not a problem before 3.5 since IgnoreHandler and DefaultHandler were singletons exposed in the signal module as SIG_DFL and SIG_IGN. But in they were converted to enums. This involves converting between enums and ints. All works only while SIG_DFL and SIG_IGN are small integers and there is small integer cache. I proposed either revert this change (signal_no_enum_handlers.patch in ) or even make SIG_DFL and SIG_IGN non-integer singletons (). |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:36 | admin | set | github: 72256 |
2018-08-23 23:54:00 | berker.peksag | set | nosy: + berker.peksagcomponents: + Library (Lib) |
2016-09-10 20:54:08 | serhiy.storchaka | set | nosy: + serhiy.storchakamessages: + |
2016-09-10 19:52:20 | mark.dickinson | set | messages: + versions: + Python 2.7, Python 3.5 |
2016-09-10 19:49:19 | mark.dickinson | create |