i'm currently facing a problem when trying to retrieve the value returned by my python code.
A draft of my code is :
# I call a function that returns a PyObject
PyObject* pyObj_val = call_binding(...);
# This PyObject seems to be a PyInt as PyInt_Check returns 1
assert(PyInt_Check(pyObj_val) == 1);
# Now the only way i found to convert this PyInt to a [C] int is:
int my_val = (int) PyInt_AsLong(pyObj_val);
I suppose there is a way to perform this without going through a long convertion and int cast. Does anyone know about it ?
Thanks for considering my request.