[issue42294] [C API] Add new C functions with more regular reference counting like PyTuple_GetItemRef()
STINNER Victor
report at bugs.python.org
Tue Nov 10 19:34:03 EST 2020
STINNER Victor <vstinner at python.org> added the comment:
In bpo-1635741, I added PyModule_AddObjectRef() (commit 8021875bbcf7385e651def51bc597472a569042c):
https://docs.python.org/dev/c-api/module.html#c.PyModule_AddObjectRef
"Similar to PyModule_AddObject() but don't steal a reference to the value on success."
I was tired of bugs caused by misusage of the surprising PyModule_AddObject() API.
PyModule_AddObject() *is* useful in some cases, but it is confusing in most cases...
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42294>
_______________________________________
More information about the Python-bugs-list
mailing list