gh-105927: finalize_modules_clear_weaklist() uses _PyWeakref_GET_REF() (#105971)

finalize_modules_clear_weaklist() now holds a strong reference to the
module longer than before: replace PyWeakref_GET_OBJECT() with
_PyWeakref_GET_REF().
This commit is contained in:
Victor Stinner 2023-06-21 21:50:20 +02:00 committed by GitHub
parent fc32522b08
commit 4328dc6465
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View file

@ -33,7 +33,7 @@ static inline PyObject* _PyModule_GetDict(PyObject *mod) {
PyObject *dict = ((PyModuleObject *)mod) -> md_dict;
// _PyModule_GetDict(mod) must not be used after calling module_clear(mod)
assert(dict != NULL);
return dict;
return dict; // borrowed reference
}
PyObject* _Py_module_getattro_impl(PyModuleObject *m, PyObject *name, int suppress);