private data stashed in local/global execution context of PyEval_EvalCode disappears down the execution stack

sndive at gmail.com sndive at gmail.com
Wed Nov 7 03:25:17 CET 2007


i naively created execution context:
    PyObject *execcontext = PyDict_New();
stuffed a handle in it:
    PyObject *ih = PyCObject_FromVoidPtr(handle, NULL);
    int st= PyDict_SetItemString(res, "interp", ih);

and later on in a function for a module that i defined
expected to extract that handle:
        PyObject *dict = PyEval_GetGlobals(); // or GetLocals
depending on where
// execcontext ended up in PyEval_EvalCode
        PyObject *co = PyDict_GetItemString(dict, "interp");
        assert(PyCObject_Check(co));
but i get null co either way and the dict does not match execcontext
that is passed into PyEval_EvalCode.

any ideas how to fix this?




More information about the Python-list mailing list