diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-07-25 11:34:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-25 11:34:49 (GMT) |
commit | 329e4a1a3f8c53d9d120d2eed93b95a04b826f2f (patch) | |
tree | 8bbe3eb47cf37493fcd3289d98643605e0217c78 /Modules/sha1module.c | |
parent | f443b54a2f14e386a91fe4b09f41a265445008b8 (diff) | |
download | cpython-329e4a1a3f8c53d9d120d2eed93b95a04b826f2f.zip cpython-329e4a1a3f8c53d9d120d2eed93b95a04b826f2f.tar.gz cpython-329e4a1a3f8c53d9d120d2eed93b95a04b826f2f.tar.bz2 |
gh-86493: Modernize modules initialization code (GH-106858)
Use PyModule_Add() or PyModule_AddObjectRef() instead of soft deprecated
PyModule_AddObject().
Diffstat (limited to 'Modules/sha1module.c')
-rw-r--r-- | Modules/sha1module.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/Modules/sha1module.c b/Modules/sha1module.c index ef8e067..3fd5312 100644 --- a/Modules/sha1module.c +++ b/Modules/sha1module.c @@ -357,16 +357,9 @@ _sha1_exec(PyObject *module) st->sha1_type = (PyTypeObject *)PyType_FromModuleAndSpec( module, &sha1_type_spec, NULL); - - if (st->sha1_type == NULL) { - return -1; - } - - Py_INCREF(st->sha1_type); - if (PyModule_AddObject(module, + if (PyModule_AddObjectRef(module, "SHA1Type", (PyObject *)st->sha1_type) < 0) { - Py_DECREF(st->sha1_type); return -1; } |