mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-86493: Use PyModule_Add() instead of PyModule_AddObjectRef() (GH-106860)
This commit is contained in:
parent
40f3f11a77
commit
a293fa5915
14 changed files with 26 additions and 116 deletions
|
@ -2189,7 +2189,6 @@ hashlib_init_constructors(PyObject *module)
|
|||
*/
|
||||
PyModuleDef *mdef;
|
||||
PyMethodDef *fdef;
|
||||
PyObject *proxy;
|
||||
PyObject *func, *name_obj;
|
||||
_hashlibstate *state = get_hashlib_state(module);
|
||||
|
||||
|
@ -2224,17 +2223,8 @@ hashlib_init_constructors(PyObject *module)
|
|||
}
|
||||
}
|
||||
|
||||
proxy = PyDictProxy_New(state->constructs);
|
||||
if (proxy == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rc = PyModule_AddObjectRef(module, "_constructors", proxy);
|
||||
Py_DECREF(proxy);
|
||||
if (rc < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
return PyModule_Add(module, "_constructors",
|
||||
PyDictProxy_New(state->constructs));
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue