summaryrefslogtreecommitdiffstats
path: root/Modules/_bz2module.c
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2020-03-24 22:08:51 (GMT)
committerGitHub <noreply@github.com>2020-03-24 22:08:51 (GMT)
commit37fcbb65d4589fbb5a72153e9338cf8e6495f64f (patch)
treee0c1e2f0b9d5673779ec74b71fef3fc158158ae1 /Modules/_bz2module.c
parent15e5024d04fc89d948ae761d88048bc58a56b650 (diff)
downloadcpython-37fcbb65d4589fbb5a72153e9338cf8e6495f64f.zip
cpython-37fcbb65d4589fbb5a72153e9338cf8e6495f64f.tar.gz
cpython-37fcbb65d4589fbb5a72153e9338cf8e6495f64f.tar.bz2
bpo-40024: Update C extension modules to use PyModule_AddType() (GH-19119)
Update _asyncio, _bz2, _csv, _curses, _datetime, _io, _operator, _pickle, _queue, blake2, multibytecodec and overlapped C extension modules to use PyModule_AddType().
Diffstat (limited to 'Modules/_bz2module.c')
-rw-r--r--Modules/_bz2module.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
index fe58809..008aef0 100644
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -731,24 +731,11 @@ static PyTypeObject BZ2Decompressor_Type = {
static int
_bz2_exec(PyObject *module)
{
- if (PyType_Ready(&BZ2Compressor_Type) < 0) {
- return -1;
- }
- if (PyType_Ready(&BZ2Decompressor_Type) < 0) {
- return -1;
- }
-
- Py_INCREF(&BZ2Compressor_Type);
- if (PyModule_AddObject(module, "BZ2Compressor",
- (PyObject *)&BZ2Compressor_Type) < 0) {
- Py_DECREF(&BZ2Compressor_Type);
+ if (PyModule_AddType(module, &BZ2Compressor_Type) < 0) {
return -1;
}
- Py_INCREF(&BZ2Decompressor_Type);
- if (PyModule_AddObject(module, "BZ2Decompressor",
- (PyObject *)&BZ2Decompressor_Type) < 0) {
- Py_INCREF(&BZ2Decompressor_Type);
+ if (PyModule_AddType(module, &BZ2Decompressor_Type) < 0) {
return -1;
}