You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PyType_GetModuleByDef can return NULL without exception set #133166
The documentation does not mention that this is possible, but if the object passed in is not a heap type it returns NULL without setting an exception:
PyObject *
PyType_GetModuleByDef(PyTypeObject *type, PyModuleDef *def)
{
assert(PyType_Check(type));
if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) {
// type_ready_mro() ensures that no heap type is
// contained in a static type MRO.
return NULL;
}
...
}
Activity
gh-133166: Fix missing error emission of PyType_GetModuleByDef (GH-13…
encukou commentedon May 1, 2025
Thanks for the catch, and thanks @neonene for the quick fix!
neonene commentedon May 1, 2025
cpython/Objects/typeobject.c
Lines 5015 to 5020 in 90c786e
3.13 has no issue. The test for 3.14 cannot be backported.
encukou commentedon May 1, 2025
Ah! My mistake
neonene commentedon May 1, 2025
Thank you for the report and the review.