]> granicus.if.org Git - python/commitdiff
Merged revisions 84980 via svnmerge from
authorAntoine Pitrou <solipsis@pitrou.net>
Thu, 23 Sep 2010 19:55:24 +0000 (19:55 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Thu, 23 Sep 2010 19:55:24 +0000 (19:55 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84980 | antoine.pitrou | 2010-09-23 21:51:39 +0200 (jeu., 23 sept. 2010) | 3 lines

  Issue #9928: Properly initialize the types exported by the bz2 module.
........

Misc/NEWS
Modules/bz2module.c

index dfa9bd6ac89503b74444666deba97a6e8cc49347..a8e6173198029d49a906ab40c9a60759d58aa40e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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.
 
index 0a367a77696196a4a32bb6ef3a39e0d5c21e8eb7..de2e20bbf7a4fcdac44b0e0c1343c28535b9df90 100644 (file)
@@ -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)