lupa icon indicating copy to clipboard operation
lupa copied to clipboard

lupa does not print Python error when using coroutines

Open JakobDev opened this issue 5 years ago • 0 comments

If you use coroutines, lupa will not show a Python error. Here a code to reproduce:

from lupa import LuaRuntime

def test():
    int("Hello")

lua = LuaRuntime()
func = lua.eval("function(test) test() end") 
co = func.coroutine(test)
co.send(None)

This produces the following traceback:

Traceback (most recent call last):
  File "./show_error.py", line 10, in <module>
    co.send(None)
  File "lupa/_lupa.pyx", line 876, in lupa._lupa._LuaThread.send
  File "lupa/_lupa.pyx", line 941, in lupa._lupa.resume_lua_thread
  File "lupa/_lupa.pyx", line 1268, in lupa._lupa.raise_lua_error
lupa._lupa.LuaError

As you can see, the Python error (ValueError: invalid literal for int() with base 10: 'Hello') is not shown in the traceback. This makes larger code really hard to debug.

JakobDev avatar Jul 17 '20 10:07 JakobDev