mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
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:
parent
15e5024d04
commit
37fcbb65d4
12 changed files with 66 additions and 133 deletions
|
|
@ -1771,19 +1771,17 @@ PyInit__operator(void)
|
|||
if (m == NULL)
|
||||
return NULL;
|
||||
|
||||
if (PyType_Ready(&itemgetter_type) < 0)
|
||||
return NULL;
|
||||
Py_INCREF(&itemgetter_type);
|
||||
PyModule_AddObject(m, "itemgetter", (PyObject *)&itemgetter_type);
|
||||
PyTypeObject *types[] = {
|
||||
&itemgetter_type,
|
||||
&attrgetter_type,
|
||||
&methodcaller_type
|
||||
};
|
||||
|
||||
if (PyType_Ready(&attrgetter_type) < 0)
|
||||
return NULL;
|
||||
Py_INCREF(&attrgetter_type);
|
||||
PyModule_AddObject(m, "attrgetter", (PyObject *)&attrgetter_type);
|
||||
for (size_t i = 0; i < Py_ARRAY_LENGTH(types); i++) {
|
||||
if (PyModule_AddType(m, types[i]) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (PyType_Ready(&methodcaller_type) < 0)
|
||||
return NULL;
|
||||
Py_INCREF(&methodcaller_type);
|
||||
PyModule_AddObject(m, "methodcaller", (PyObject *)&methodcaller_type);
|
||||
return m;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue