<HTML><HEAD>
<STYLE id=eMClientCss>blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc }
blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; }
.plain pre, .plain tt { font-family: monospace; font-size: 100%; font-weight: normal; font-style: normal;}
a img { border: 0px; }body {font-family: Tahoma;font-size: 12pt;}
.plain pre, .plain tt {font-family: Tahoma;font-size: 12pt;}
</STYLE>

<STYLE></STYLE>
</HEAD>
<BODY scroll=auto class>
<DIV>That makes perfect sense.</DIV>
<DIV>I'm creating many PyTuple instances on the fly so I needed to make sure calling Dispose() was enough.</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV> </DIV>
<DIV>------ Original Message ------</DIV>
<DIV>From: "Tony Roberts" <<A href="mailto:tony@pyxll.com">tony@pyxll.com</A>></DIV>
<DIV>To: "A list for users and developers of Python for .NET" <<A href="mailto:pythondotnet@python.org">pythondotnet@python.org</A>></DIV>
<DIV>Sent: 3/31/2016 8:47:44 AM</DIV>
<DIV>Subject: Re: [Python.NET] PyTuple IDisposable implementation</DIV>
<DIV> </DIV>
<DIV id=x2ee955129ea34449ba3de5e29bfebe42>
<BLOCKQUOTE class=cite2 cite=CA+Xbcsapt8R2gXkfAXyxJTto4PzDh2=K5iy9KM0L0kjnj=COYw@mail.gmail.com type="cite">
<DIV dir=ltr>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 destroyed.</DIV><BR>
<DIV class=gmail_quote>
<DIV dir=ltr>On Wed, Mar 30, 2016 at 8:38 PM Steven Burns <<A href="mailto:royalstream@hotmail.com">royalstream@hotmail.com</A>> wrote:<BR></DIV>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex">
<DIV>
<DIV>I'm creating <FONT face=Consolas>PyTuple</FONT> instances using the constructor.</DIV>
<DIV> </DIV>
<DIV>I noticed the constructor calls <FONT size=3><SPAN style="WHITE-SPACE: pre-wrap; WORD-SPACING: 0px; TEXT-TRANSFORM: none; FLOAT: none; COLOR: rgb(51,51,51); FONT: 12px/16px Consolas,'Liberation Mono',Menlo,Courier,monospace; DISPLAY: inline !important; LETTER-SPACING: normal; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px">Runtime.Incref</SPAN> for each of the tuple elements.</FONT></DIV>
<DIV> </DIV>
<DIV>But <FONT face=Consolas>PyTuple</FONT> doesn't override <FONT face=Consolas>PyObject</FONT>'s implementation of <FONT face=Consolas>IDisposable.</FONT></DIV>
<DIV> </DIV>
<DIV>It's not clear to me when this references will be cleared.</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV> </DIV>
<DIV>Steven</DIV>
<DIV> </DIV>
<DIV> </DIV></DIV>_________________________________________________<BR>Python.NET mailing list - <A href="mailto:PythonDotNet@python.org">PythonDotNet@python.org</A><BR><A href="https://mail.python.org/mailman/listinfo/pythondotnet" rel=noreferrer>https://mail.python.org/mailman/listinfo/pythondotnet</A></BLOCKQUOTE></DIV></BLOCKQUOTE></DIV></BODY></HTML>