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().
This commit is contained in:
Dong-hee Na 2020-03-25 07:08:51 +09:00 committed by GitHub
parent 15e5024d04
commit 37fcbb65d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 66 additions and 133 deletions

View file

@ -7993,10 +7993,6 @@ PyInit__pickle(void)
return m;
}
if (PyType_Ready(&Unpickler_Type) < 0)
return NULL;
if (PyType_Ready(&Pickler_Type) < 0)
return NULL;
if (PyType_Ready(&Pdata_Type) < 0)
return NULL;
if (PyType_Ready(&PicklerMemoProxyType) < 0)
@ -8010,16 +8006,15 @@ PyInit__pickle(void)
return NULL;
/* Add types */
Py_INCREF(&Pickler_Type);
if (PyModule_AddObject(m, "Pickler", (PyObject *)&Pickler_Type) < 0)
if (PyModule_AddType(m, &Pickler_Type) < 0) {
return NULL;
Py_INCREF(&Unpickler_Type);
if (PyModule_AddObject(m, "Unpickler", (PyObject *)&Unpickler_Type) < 0)
}
if (PyModule_AddType(m, &Unpickler_Type) < 0) {
return NULL;
Py_INCREF(&PyPickleBuffer_Type);
if (PyModule_AddObject(m, "PickleBuffer",
(PyObject *)&PyPickleBuffer_Type) < 0)
}
if (PyModule_AddType(m, &PyPickleBuffer_Type) < 0) {
return NULL;
}
st = _Pickle_GetState(m);