aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-06-23 15:40:27 +0200
committerGitHub <noreply@github.com>2021-06-23 15:40:27 +0200
commit2a396d65b8e63300ff05e217adacf0765c502ba3 (patch)
tree07f301bc8df980ca91fba7be433b285eeefbf386 /Objects
parentbpo-42064: Move `sqlite3` exceptions to global state, part 1 of 2 (GH-26745) (diff)
downloadcpython-2a396d65b8e63300ff05e217adacf0765c502ba3.tar.gz
cpython-2a396d65b8e63300ff05e217adacf0765c502ba3.tar.bz2
cpython-2a396d65b8e63300ff05e217adacf0765c502ba3.zip
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/moduleobject.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 61478a1c481..ef39bde4e42 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);