-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
First of all this is an excellent library and very useful, thanks for this.
While calling a function in a python module from a lua module, if the called python function throws an exception, the exception gets printed on STDERR, however it will be better if the same is printed along with luaL_error
I tried modifying code pythoninlua.c in the function py_object_call it works OK
Please consider making changes to this effect.
PyObject *exc_type, *exc_value, *exc_traceback;
PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
PyObject *exc_str = PyObject_Str(exc_value);
const char *exc_cstr = PyUnicode_AsUTF8(exc_str);
exc_cstr = (!exc_cstr)? "ERROR": exc_cstr;
luaL_error(L, "error calling python function [%s]", exc_cstr);
Note: Cleaning up memory with DECREF etc. is not taken care in the example
Metadata
Metadata
Assignees
Labels
No labels