Message369669
Ok, I found the problem. The problem is that the reproduced does not correctly work the reference count of base_class because when construction get tuple of bases:
PyObject *bases = PyTuple_New(1);
result = PyTuple_SetItem(bases, 0, base_class);
if (result) return -1;
PyObject *subclass = PyType_FromModuleAndSpec(m, &subclass_spec, bases);
"PyTuple_SetItem" steals a reference to base_class but "PyModule_AddObject" also does the same, and the refcount is incorrect.
If you add a Py_INCREF before, the crash disappears. |
|
Date |
User |
Action |
Args |
2020-05-22 23:57:26 | pablogsal | set | recipients:
+ pablogsal, tim.peters, vstinner, petr.viktorin, lukasz.langa, serhiy.storchaka, corona10, shihai1991 |
2020-05-22 23:57:26 | pablogsal | set | messageid: <1590191846.94.0.41720706871.issue40217@roundup.psfhosted.org> |
2020-05-22 23:57:26 | pablogsal | link | issue40217 messages |
2020-05-22 23:57:26 | pablogsal | create | |
|