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/mmapmodule.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/mmapmodule.c')
-rw-r--r-- | Modules/mmapmodule.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index c1cd5b0..cfbd2f4 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1579,9 +1579,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) static int mmap_exec(PyObject *module) { - Py_INCREF(PyExc_OSError); - if (PyModule_AddObject(module, "error", PyExc_OSError) < 0) { - Py_DECREF(PyExc_OSError); + if (PyModule_AddObjectRef(module, "error", PyExc_OSError) < 0) { return -1; } |