[Python-checkins] r84980 - in python/branches/py3k: Misc/NEWS Modules/bz2module.c

antoine.pitrou python-checkins at python.org
Thu Sep 23 21:51:39 CEST 2010


Author: antoine.pitrou
Date: Thu Sep 23 21:51:39 2010
New Revision: 84980

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



Modified:
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Modules/bz2module.c

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Thu Sep 23 21:51:39 2010
@@ -62,6 +62,8 @@
 Library
 -------
 
+- Issue #9928: Properly initialize the types exported by the bz2 module.
+
 - Issue #1675951: Allow GzipFile to work with unseekable file objects.
   Patch by Florian Festi.
 

Modified: python/branches/py3k/Modules/bz2module.c
==============================================================================
--- python/branches/py3k/Modules/bz2module.c	(original)
+++ python/branches/py3k/Modules/bz2module.c	Thu Sep 23 21:51:39 2010
@@ -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)


More information about the Python-checkins mailing list