PyEval_EvalCode(...) problem

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Mar 10 16:07:53 CET 2009


En Tue, 10 Mar 2009 12:32:00 -0200, <googler.1.webmaster at spamgourmet.com>  
escribió:

> Hi!
>
> I have a problem with PyEval_EvalCode(...)
> I compile the following code and execute them with PyEval_EvalCode
> (...)
>
>
> class MyClass(mod.Upper):
>     pass
>
> register(MyClass) #just the type, not the instance
>
>
> Thats all. So register(...) is a Python C API method so i take the
> type and store
> it in a global variable.

...and increment its reference count, of course, because you store a new  
reference, ok?

> PyEval_EvalCode(...) returns not NULL and I
> do not decref
> the dictionary, just the returnvalue.

Which dictionary? The return value should be None, I presume.
You should post the code. By far, the most frequent error using the Python  
API is getting reference counts wrong.

-- 
Gabriel Genellina




More information about the Python-list mailing list