Hi,
I have a problem with the reference count after an error occurs
in a script which I execute as follows..
PyObject* lDict = PyDict_New();
PyDict_SetItemS tring(lDict, "item", (PyObject*)iIte m->mPyObject);
PyObject* lResult = PyEval_EvalCode (mCode, ScnGlobal::sDic tionary,
lDict);
if (! lResult)
{
PyErr_Print();
}
else
{
Py_DECREF(lResu lt);
}
Py_DECREF(lDict );
The script within the mCode object only contains the following line,
which generates an error.
print aasas
The problem is that after PyEval_EvalCode returns the reference count
for lDict is one larger than before. Py_DECREF(lDict ) does
therefore not delete the Dictionary, which causes me problems. Is
Python keeping an exception around. I assume that I have to do some
more cleanup ??
Cheers
Jochen
I have a problem with the reference count after an error occurs
in a script which I execute as follows..
PyObject* lDict = PyDict_New();
PyDict_SetItemS tring(lDict, "item", (PyObject*)iIte m->mPyObject);
PyObject* lResult = PyEval_EvalCode (mCode, ScnGlobal::sDic tionary,
lDict);
if (! lResult)
{
PyErr_Print();
}
else
{
Py_DECREF(lResu lt);
}
Py_DECREF(lDict );
The script within the mCode object only contains the following line,
which generates an error.
print aasas
The problem is that after PyEval_EvalCode returns the reference count
for lDict is one larger than before. Py_DECREF(lDict ) does
therefore not delete the Dictionary, which causes me problems. Is
Python keeping an exception around. I assume that I have to do some
more cleanup ??
Cheers
Jochen
Comment