M
Mateusz Loskot
Hi,
I'm trying to dig out details about what exactly is the return
value the of PyEval_EvalCodeEx function in Python 3.x
The documentation is sparse, unfortunately.
Perhaps I'm looking at wrong function.
My aim is simple, I need to execute Python code using Python interpreter
embedded in my C++ application.
The Python code is a simple script that always returns single value.
For example:
#! /usr/bin/env python
def foo(a, b):
return a + b
f = foo(2, 3)
But, f can be of different type for different script: one returns
numeric value, another returns a sequence, so the type is not
possible to be determined in advance.
I know how to capture Python stdout/stderr.
I also know how to access the "f" attribute using
PyObject_GetAttrString and then I can convert "f" value to C++ type
depending on PyObject type.
However, I guess there shall be a way to access "f" value
directly from PyEval_EvalCode return object:
PyObject* evalRet = :yEval_EvalCode(...);
But, I can't find any details what the "evalRet" actually is.
Any pointers would be helpful.
Best regards,
I'm trying to dig out details about what exactly is the return
value the of PyEval_EvalCodeEx function in Python 3.x
The documentation is sparse, unfortunately.
Perhaps I'm looking at wrong function.
My aim is simple, I need to execute Python code using Python interpreter
embedded in my C++ application.
The Python code is a simple script that always returns single value.
For example:
#! /usr/bin/env python
def foo(a, b):
return a + b
f = foo(2, 3)
But, f can be of different type for different script: one returns
numeric value, another returns a sequence, so the type is not
possible to be determined in advance.
I know how to capture Python stdout/stderr.
I also know how to access the "f" attribute using
PyObject_GetAttrString and then I can convert "f" value to C++ type
depending on PyObject type.
However, I guess there shall be a way to access "f" value
directly from PyEval_EvalCode return object:
PyObject* evalRet = :yEval_EvalCode(...);
But, I can't find any details what the "evalRet" actually is.
Any pointers would be helpful.
Best regards,