Message117211
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) |
|
Date |
User |
Action |
Args |
2010-09-23 17:56:18 | pitrou | set | recipients:
+ pitrou, arigo, amaury.forgeotdarc, benjamin.peterson |
2010-09-23 17:56:18 | pitrou | set | messageid: <1285264578.38.0.857461575797.issue9928@psf.upfronthosting.co.za> |
2010-09-23 17:56:16 | pitrou | link | issue9928 messages |
2010-09-23 17:56:16 | pitrou | create | |
|