This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients amaury.forgeotdarc, arigo, benjamin.peterson, pitrou
Date 2010-09-23.17:56:15
SpamBayes Score 0.00012239529
Marked as misclassified No
Message-id <1285264578.38.0.857461575797.issue9928@psf.upfronthosting.co.za>
In-reply-to
Content
Actually, it is because bz2 doesn't call PyType_Ready() but instead sets some field manually. Perhaps we could have a guard somewhere that raises a fatal error when a C extension type hasn't been properly readied?

In the meantime, this patch seems to solve the issue:

diff -r 843be379fb26 Modules/bz2module.c
--- a/Modules/bz2module.c       Thu Sep 23 18:45:17 2010 +0200
+++ b/Modules/bz2module.c       Thu Sep 23 19:55:19 2010 +0200
@@ -2155,9 +2155,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)
History
Date User Action Args
2010-09-23 17:56:18pitrousetrecipients: + pitrou, arigo, amaury.forgeotdarc, benjamin.peterson
2010-09-23 17:56:18pitrousetmessageid: <1285264578.38.0.857461575797.issue9928@psf.upfronthosting.co.za>
2010-09-23 17:56:16pitroulinkissue9928 messages
2010-09-23 17:56:16pitroucreate