The main hint is in the docs, if it says 'Steals a reference' than the function basically takes ownership, if it says 'New Reference' than it did an INCREF for you, if nothing is said it probably does an INCREF and DECREF pair as needed.
[url]http://stackoverflow.com/questions/10863669/lost-on-py-decref-incref-when-handling-pylist-append-in-python-c-extension[/url]
[url]http://stackoverflow.com/questions/10863669/lost-on-py-decref-incref-when-handling-pylist-append-in-python-c-extension[/url]

本文探讨了Python C扩展中涉及的引用计数机制,解释了Steal Reference、New Reference的概念,并讨论了 INCREF 和DECREF 的使用场景。

被折叠的 条评论
为什么被折叠?



