mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +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
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue