tuple creation in C extensions
Courageous
jkraska1 at san.rr.com
Sun Jun 11 17:56:17 EDT 2000
> Yes, usually when you _create_ a Python object in C you have to handle
> the references or call routines that do that for you. Trouble is, it is
> something that is not always clear on how to do it. I would say you
> need to INCREF your tuple after creation, unless you know the routine
> that creates it already does that.
I was under the impression that the creation of the tuple in C
created with a ob_refcount of 1 already. While I don't have the
time at the moment to verify this, the original poster or someone
else can confirm or deny my wild imagination. :)-
> If you return the tuple, do
> nothing. If you do not return it, you should DECREF it.
My wild imagination agrees with you on the DECREF part. :)-
C/
More information about the Python-list
mailing list