PyEval_EvalCode(...) problem

googler.1.webmaster at googler.1.webmaster at
Tue Mar 10 15:32:00 CET 2009


I have a problem with PyEval_EvalCode(...)
I compile the following code and execute them with PyEval_EvalCode

class MyClass(mod.Upper):

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. PyEval_EvalCode(...) returns not NULL and I
do not decref
the dictionary, just the returnvalue.

After PyEval_EvalCode(..) is executed I would like to create an
instance of MyClass
which crashes because information of the inherited types are corrupt.
If I call

PyObject_CallObject(obj, NULL) in register(..) where PyEval_EvalCode
(..) is still active
everything works fine but when I call it after PyEval_EvalCode, even I
did not decref anything)
its not working. Can anyone of you help me? The refcounts of the
MyClass type are > 0.


More information about the Python-list mailing list