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:
Serhiy Storchaka 2023-07-25 14:34:49 +03:00 committed by GitHub
parent f443b54a2f
commit 329e4a1a3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 84 additions and 292 deletions

View file

@ -5986,7 +5986,7 @@ sslmodule_init_constants(PyObject *m)
#define addbool(m, key, value) \
do { \
PyObject *bool_obj = (value) ? Py_True : Py_False; \
PyModule_AddObject((m), (key), Py_NewRef(bool_obj)); \
PyModule_AddObjectRef((m), (key), bool_obj); \
} while (0)
addbool(m, "HAS_SNI", 1);