summaryrefslogtreecommitdiffstats
path: root/Modules/bz2module.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-23 19:51:39 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-23 19:51:39 (GMT)
commit70c60449133919af4c598d562b85fcae66d20714 (patch)
treee14c9509c773712b79725e03e5e9fedb5d79c9bd /Modules/bz2module.c
parentab58b5f90e60cb21752f5294538bc88d56cacfbe (diff)
downloadcpython-70c60449133919af4c598d562b85fcae66d20714.zip
cpython-70c60449133919af4c598d562b85fcae66d20714.tar.gz
cpython-70c60449133919af4c598d562b85fcae66d20714.tar.bz2
Issue #9928: Properly initialize the types exported by the bz2 module.
Diffstat (limited to 'Modules/bz2module.c')
-rw-r--r--Modules/bz2module.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index c44d3b9..3e55202 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -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)