Re: [Python.NET] Decref in RunString

Tony Roberts <[email protected]>
Newsgroups gmane.comp.python.dotnet
Message-ID <CA+XbcsZ+CaxhbbzpOiawkZWGK_Ssam5DV+OD2uRB=651-Vupfw@mail.gmail.com>
Looks like a copy and paste error from RunString(string code) to me.

If you want to send a pull request to fix it (with a unit test if you have
one - I don't think RunString is currently covered by the tests) I'll merge
it.

thanks!
Tony


On Mon, Jun 8, 2015 at 7:52 AM Nils Becker <[email protected]> wrote:

> Hello there,
>
> I have a quick question concerning the "RunString(string code, IntPtr
> globals, IntPtr locals)" routine. In it the parameter "locals" is
> decref'ed. Maybe I am missing something (could be, I do not know much about
> reference counting), but should something which the user passes be
> decref'ed?
>
> My use case is the following: I embed python into C# and have a stateful
> wrapper around PythonEngine which manages a global and local dictionary.
> Therefore, I need the local dictionary I pass to RunString to be accessable
> (and sane) after the call.
> I noticed that locals contained random content after I called RunString
> and created new variables in the code.
> After I removed the Decref call in RunString, it seems to work as I would
> expect it to.
>
> Cheers
> Nils
> _________________________________________________
> Python.NET mailing list - [email protected]
> https://mail.python.org/mailman/listinfo/pythondotnet

_________________________________________________
Python.NET mailing list - [email protected]
https://mail.python.org/mailman/listinfo/pythondotnet
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.