On Nov 9, 5:36 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 06 Nov 2007 23:25:17 -0300, <[EMAIL PROTECTED]> escribió: > > > 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); > > What's `res`?
duh! it should be execcontext: int st= PyDict_SetItemString(execcontext, "interp", ih); then i'd PyEval_EvalCode(somecallable, execcontext, g_maindict); where g_maindict is a dictionary from __main__ module ... later as part of PyEval_EvalCode a method in a module extending python is executed by python runtime and i want to get "interp" assuming it would be in the global context: PyObject *dict = PyEval_GetGlobals(); PyObject *co = PyDict_GetItemString(dict, "interp"); but apparently PyEval_GetGlobals(); returns the dictionary that has nothing to do with the execcontext passed into PyEval_EvalCode higher up on the call stack and i do not know how to get to the execcontext dictionary that i passed in PyEval_EvalCode. If each module has its own globals what the point of passing global and local namespace into PyEval_EvalCode? > One should make a lot of assumptions about your code because it's not > complete. Please post a minimal complete example showing your problem. > It's a rather large program. My assumption was that just posting the snippet around the call site and the callee pathetic attempt to extract interp would be sufficient :(
-- http://mail.python.org/mailman/listinfo/python-list