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/termios.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/termios.c')
-rw-r--r-- | Modules/termios.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/Modules/termios.c b/Modules/termios.c index 6dc8200..6b25410 100644 --- a/Modules/termios.c +++ b/Modules/termios.c @@ -1232,12 +1232,7 @@ termios_exec(PyObject *mod) struct constant *constant = termios_constants; termiosmodulestate *state = get_termios_state(mod); state->TermiosError = PyErr_NewException("termios.error", NULL, NULL); - if (state->TermiosError == NULL) { - return -1; - } - Py_INCREF(state->TermiosError); - if (PyModule_AddObject(mod, "error", state->TermiosError) < 0) { - Py_DECREF(state->TermiosError); + if (PyModule_AddObjectRef(mod, "error", state->TermiosError) < 0) { return -1; } |