Why PyINCREF on _PyFalseStruct and _PyTrueStruct?
Shiyao Ma
i at introo.me
Wed Apr 8 11:07:52 EDT 2015
Hi.
While reading the rich_compare of PyLongObject, I noticed this line:
https://hg.python.org/cpython/file/a49737bd6086/Objects/longobject.c#l2785
It increments the ob_ref of the builtin True/False object.
Initializing the ob_ref of True/False to one so that they won't be
garbage collected if fair enough. Why do we increment it?
I don't see the reason behind it, since these two objects should
always stay in the memory and never participate the garbage collecting
system.
Regards.
--
吾輩は猫である。ホームーページはhttp://introo.me。
More information about the Python-list
mailing list