Message351249
This issue is a Python 3.8 regression.
Joannah: Would you mind to have a look?
x = DefaultHandler = PyLong_FromVoidPtr((void *)SIG_DFL);
if (PyModule_AddObject(m, "SIG_DFL", x))
goto finally;
This change is not easy to read.
DefaultHandler must be a strong reference: finisignal() calls Py_CLEAR(DefaultHandler);
Previously, the code uses PyDict_SetItemString(d, "SIG_DFL", x): PyDict_SetItemString increases the reference counter, whereas PyModule_AddObject leaves the reference counter unchanged (yeah, it's a strange/bad C API).
I guess than an INCREF() is needed somewhere.
Compare it to:
int
PyModule_AddIntConstant(PyObject *m, const char *name, long value)
{
PyObject *o = PyLong_FromLong(value);
if (!o)
return -1;
if (PyModule_AddObject(m, name, o) == 0)
return 0;
Py_DECREF(o);
return -1;
} |
|
Date |
User |
Action |
Args |
2019-09-06 13:44:40 | vstinner | set | recipients:
+ vstinner, lukasz.langa, berker.peksag, malin, nanjekyejoannah |
2019-09-06 13:44:39 | vstinner | set | messageid: <1567777479.99.0.123525724661.issue38037@roundup.psfhosted.org> |
2019-09-06 13:44:39 | vstinner | link | issue38037 messages |
2019-09-06 13:44:39 | vstinner | create | |
|