[Python-checkins] bpo-43770: Cleanup PyModuleDef_Init() (GH-26879)
vstinner
webhook-mailer at python.org
Wed Jun 23 09:40:37 EDT 2021
https://github.com/python/cpython/commit/2a396d65b8e63300ff05e217adacf0765c502ba3
commit: 2a396d65b8e63300ff05e217adacf0765c502ba3
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2021-06-23T15:40:27+02:00
summary:
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.
files:
M Objects/moduleobject.c
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 61478a1c4817c..ef39bde4e425d 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);
More information about the Python-checkins
mailing list