Skip to content

lupa does not print Python error when using coroutines #144

Open
@JakobDev

Description

@JakobDev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions