mirror of
https://github.com/python/cpython
synced 2026-09-28 03:33:18 +03: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
|
|
@ -787,11 +787,7 @@ _gdbm_exec(PyObject *module)
|
|||
defined(GDBM_VERSION_PATCH)
|
||||
PyObject *obj = Py_BuildValue("iii", GDBM_VERSION_MAJOR,
|
||||
GDBM_VERSION_MINOR, GDBM_VERSION_PATCH);
|
||||
if (obj == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if (PyModule_AddObject(module, "_GDBM_VERSION", obj) < 0) {
|
||||
Py_DECREF(obj);
|
||||
if (PyModule_Add(module, "_GDBM_VERSION", obj) < 0) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue