bpo-43770: Cleanup PyModuleDef_Init() (GH-26879)

PyModuleDef_Init() no longer tries to make PyModule_Type type: it's
already done by _PyTypes_Init() at Python startup. Replace
PyType_Ready() call with an assertion.
This commit is contained in:
Victor Stinner 2021-06-23 15:40:27 +02:00 committed by GitHub
parent a50e28377b
commit 2a396d65b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,8 +46,7 @@ _PyModule_IsExtension(PyObject *obj)
PyObject*
PyModuleDef_Init(struct PyModuleDef* def)
{
if (PyType_Ready(&PyModuleDef_Type) < 0)
return NULL;
assert(PyModuleDef_Type.tp_flags & Py_TPFLAGS_READY);
if (def->m_base.m_index == 0) {
max_module_number++;
Py_SET_REFCNT(def, 1);