I'm trying to port an extension module from 2.7 to 3.5. The extension module uses PyEval_EvalCode. It does this with some code similar to the following:
struct _node *compiled_node = PyParser_SimpleParseString (in_string, Py_file_input);
if (compiled_node)
{
PyCodeObject *compiled_code = PyNode_Compile (compiled_node, "temp.py");
if (compiled_code)
{
return_value.Reset(PyEval_EvalCode (compiled_code, globals.get(), locals.get()));
}
}
In Python 2.7 this works fine. In Python 3.5 I get a compilation failure, because PyNode_Compile returns a PyCodeObject, but in Python 3.5 PyEval_EvalCode accepts a PyObject*. What do I need to do to convert this into a PyObject that I can pass to PyEval_EvalCode?