Issue #9928: Properly initialize the types exported by the bz2 module.
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index c44d3b9..3e55202 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -2155,9 +2155,12 @@
{
PyObject *m;
- Py_TYPE(&BZ2File_Type) = &PyType_Type;
- Py_TYPE(&BZ2Comp_Type) = &PyType_Type;
- Py_TYPE(&BZ2Decomp_Type) = &PyType_Type;
+ if (PyType_Ready(&BZ2File_Type) < 0)
+ return NULL;
+ if (PyType_Ready(&BZ2Comp_Type) < 0)
+ return NULL;
+ if (PyType_Ready(&BZ2Decomp_Type) < 0)
+ return NULL;
m = PyModule_Create(&bz2module);
if (m == NULL)