Skip to content

Conversation

@noahcgreen
Copy link

Fixes #144.
Currently if a lua coroutine calls Python code which raises an exception, a LuaError will be raised and the original exception will be lost. This isn't consistent with the behavior of non-coroutine code, which is to reraise the exception, and losing the original exception makes it very hard to debug lua coroutines.

A new unit test test_coroutine_reraises_python_error has been added.

Comment on lines +1297 to +1298
error = py_from_lua(runtime, L, 1)
if isinstance(error, BaseException):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I'm not sure it's intentional that this retrieves a Python exception object. Couldn't such an exception also end up on the Lua stack for other reasons? Meaning, could this run into false positives?

@synodriver
Copy link
Contributor

I've also meet the same problem, and I think the extra check should be at resume_lua_thread, right before raise_lua_error(thread._runtime, co, status), which only influence co.send itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants