From 37fcbb65d4589fbb5a72153e9338cf8e6495f64f Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Wed, 25 Mar 2020 07:08:51 +0900 Subject: 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(). --- Modules/_bz2module.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'Modules/_bz2module.c') diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c index fe58809898..008aef0555 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; } -- cgit v1.2.1