mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +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
|
|
@ -1996,12 +1996,7 @@ static PyMethodDef overlapped_functions[] = {
|
|||
|
||||
#define WINAPI_CONSTANT(fmt, con) \
|
||||
do { \
|
||||
PyObject *value = Py_BuildValue(fmt, con); \
|
||||
if (value == NULL) { \
|
||||
return -1; \
|
||||
} \
|
||||
if (PyModule_AddObject(module, #con, value) < 0 ) { \
|
||||
Py_DECREF(value); \
|
||||
if (PyModule_Add(module, #con, Py_BuildValue(fmt, con)) < 0 ) { \
|
||||
return -1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue