From: Victor Stinner Date: Wed, 23 Jun 2021 13:40:27 +0000 (+0200) Subject: bpo-43770: Cleanup PyModuleDef_Init() (GH-26879) X-Git-Tag: v3.11.0a1~798 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a396d65b8e63300ff05e217adacf0765c502ba3;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 61478a1c4817..ef39bde4e425 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -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);