Skip to content

Commit 2a396d6

Browse files
authored
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.
1 parent a50e283 commit 2a396d6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Objects/moduleobject.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ _PyModule_IsExtension(PyObject *obj)
4646
PyObject*
4747
PyModuleDef_Init(struct PyModuleDef* def)
4848
{
49-
if (PyType_Ready(&PyModuleDef_Type) < 0)
50-
return NULL;
49+
assert(PyModuleDef_Type.tp_flags & Py_TPFLAGS_READY);
5150
if (def->m_base.m_index == 0) {
5251
max_module_number++;
5352
Py_SET_REFCNT(def, 1);

0 commit comments

Comments
 (0)