mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-86493: Modernize modules initialization code (GH-106858)
Use PyModule_Add() or PyModule_AddObjectRef() instead of soft deprecated PyModule_AddObject().
This commit is contained in:
parent
f443b54a2f
commit
329e4a1a3f
29 changed files with 84 additions and 292 deletions
|
@ -356,13 +356,7 @@ md5_exec(PyObject *m)
|
|||
st->md5_type = (PyTypeObject *)PyType_FromModuleAndSpec(
|
||||
m, &md5_type_spec, NULL);
|
||||
|
||||
if (st->md5_type == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Py_INCREF((PyObject *)st->md5_type);
|
||||
if (PyModule_AddObject(m, "MD5Type", (PyObject *)st->md5_type) < 0) {
|
||||
Py_DECREF(st->md5_type);
|
||||
if (PyModule_AddObjectRef(m, "MD5Type", (PyObject *)st->md5_type) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue