summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/bz2module.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index a437351..d46f6b1 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -117,6 +117,8 @@ C-API
Library
-------
+- Issue #9928: Properly initialize the types exported by the bz2 module.
+
- Issue #9854: The default read() implementation in io.RawIOBase now
handles non-blocking readinto() returning None correctly.
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index 215fa4b..f418969 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -2158,9 +2158,12 @@ PyInit_bz2(void)
{
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)