[Python.NET] PyTuple IDisposable implementation

Steven Burns royalstream at hotmail.com
Thu Mar 31 16:30:35 EDT 2016

That makes perfect sense.
I'm creating many PyTuple instances on the fly so I needed to make sure 
calling Dispose() was enough.


------ Original Message ------
From: "Tony Roberts" <tony at pyxll.com>
To: "A list for users and developers of Python for .NET" 
<pythondotnet at python.org>
Sent: 3/31/2016 8:47:44 AM
Subject: Re: [Python.NET] PyTuple IDisposable implementation

>When the tuple is destroyed each of the members will have their 
>reference count decremented. The tuple 'steals' the references of the 
>members when it's constructed, hence why there's the call to Incref and 
>no need for a corresponding decref. This happens in the Python C API 
>and so there's no need to do anything in the C# code when the tuple is 
>On Wed, Mar 30, 2016 at 8:38 PM Steven Burns <royalstream at hotmail.com> 
>>I'm creating PyTuple instances using the constructor.
>>I noticed the constructor calls Runtime.Incref for each of the tuple 
>>But PyTuple doesn't override PyObject's implementation of IDisposable.
>>It's not clear to me when this references will be cleared.
>>Python.NET mailing list - PythonDotNet at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20160331/b3ab4ec8/attachment.html>

More information about the PythonDotNet mailing list