diff options
-rw-r--r-- | Misc/NEWS | 2 | ||||
-rw-r--r-- | Modules/bz2module.c | 9 |
2 files changed, 8 insertions, 3 deletions
@@ -43,6 +43,8 @@ Core and Builtins 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 0a367a7769..de2e20bbf7 100644 --- a/Modules/bz2module.c +++ b/Modules/bz2module.c @@ -2320,9 +2320,12 @@ initbz2(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; + if (PyType_Ready(&BZ2Comp_Type) < 0) + return; + if (PyType_Ready(&BZ2Decomp_Type) < 0) + return; m = Py_InitModule3("bz2", bz2_methods, bz2__doc__); if (m == NULL) |