Issue 24011: Add error checks to PyInit_signal() (original ) (raw )Created on 2015-04-19 19:28 by christian.heimes , last changed 2022-04-11 14:58 by admin . This issue is now closed .
Pull Requests
URL
Status
Linked
Edit
PR 12765
merged
nanjekyejoannah,2019-04-10 17:38
Messages (6)
msg241551 - (view)
Author: Christian Heimes (christian.heimes) *
Date: 2015-04-19 19:28
The init function of the signal module fails to check for errors in a couple of places. The patch replaces PyDict_SetItemString() calls with PyModule_AddIntMacro() and error checks. An exception is unlikely so I'm OK when the patch just lands in 3.4 and 3.5. CID 1295026 (#41 of 41): Dereference null return value (NULL_RETURNS) dereference: Dereferencing a pointer that might be null x when calling PyDict_SetItemString
msg323669 - (view)
Author: Berker Peksag (berker.peksag) *
Date: 2018-08-17 20:42
All of the PyModule_AddIntMacro() changes have already been applied in https://github.com/python/cpython/commit/6782b14bcba612e4a39e41992c77306217b91e30 . The remaining parts are: - x = PyLong_FromLong((long)NSIG); - if (!x |
PyDict_SetItemString(d, "NSIG", x) < 0) + if (PyModule_AddIntMacro(m, NSIG)) goto finally; - Py_DECREF(x); --- - PyExc_IOError, NULL); - if (ItimerError != NULL) - PyDict_SetItemString(d, "ItimerError", ItimerError); + PyExc_IOError, NULL); + if (PyModule_AddObject(m, "ItimerError", ItimerError)) + goto finally;
msg339990 - (view)
Author: Joannah Nanjekye (nanjekyejoannah) *
Date: 2019-04-11 18:02
@berkerpeksag I made the requested changes on the PR. PTAL.
msg340627 - (view)
Author: Berker Peksag (berker.peksag) *
Date: 2019-04-22 01:47
New changeset 9541bd321a94f13dc41163a5d7a1a847816fac84 by Berker Peksag (Joannah Nanjekye) in branch 'master': bpo-24011 : Use PyModule_Add{Object,IntMacro} in PyInit__signal() (GH-12765 ) https://github.com/python/cpython/commit/9541bd321a94f13dc41163a5d7a1a847816fac84
msg340628 - (view)
Author: Berker Peksag (berker.peksag) *
Date: 2019-04-22 01:49
Thank you, Joannah. There's no need to backport PR 12765 to maintenance branches, so I'm closing this issue as 'fixed'.
msg351251 - (view)
Author: STINNER Victor (vstinner) *
Date: 2019-09-06 13:48
There is a regression related to reference count: see bpo-38037 .
History
Date
User
Action
Args
2022-04-11 14:58:15
admin
set
github: 68199
2019-09-06 13:48:35
vstinner
set
nosy: + vstinner messages: +
2019-04-22 01:49:13
berker.peksag
set
status: open -> closedversions: - Python 3.7messages: + resolution: fixedstage: patch review -> resolved
2019-04-22 01:47:09
berker.peksag
set
messages: +
2019-04-11 18:02:53
nanjekyejoannah
set
nosy: + nanjekyejoannah messages: +
2019-04-10 17:38:02
nanjekyejoannah
set
stage: needs patch -> patch reviewpull_requests: + <pull%5Frequest12693>
2019-04-10 13:49:42
cheryl.sabella
set
stage: patch review -> needs patchversions: + Python 3.7, Python 3.8, - Python 3.4, Python 3.5
2018-08-17 20:42:31
berker.peksag
set
nosy: + berker.peksag messages: +
2015-04-19 19:28:15
christian.heimes
create