-
-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Description
Hello,
I randomly have the following error, when a python code called from lua raise an exception.
TypeError: attribute name must be string, not 'int'
File "lupa/lua54.pyx", line 1031, in lupa.lua54._LuaObject.__getitem__
File "lupa/lua54.pyx", line 1049, in lupa.lua54._LuaObject._getitem
File "lupa/lua54.pyx", line 1944, in lupa.lua54.execute_lua_call
File "lupa/lua54.pyx", line 413, in lupa.lua54.LuaRuntime.reraise_on_exception
File "lupa/lua54.pyx", line 2254, in lupa.lua54.py_object_getindex_with_gil
File "lupa/lua54.pyx", line 2230, in lupa.lua54.getattr_for_lua
TypeError: attribute name must be string, not 'int'
I think the error comes from reraise_on_exception when indexing exception object, it tries to access to elements 0, 1 and 2.
@cython.final
cdef int reraise_on_exception(self) except -1:
if self._raised_exception is not None:
exception = self._raised_exception
self._raised_exception = None
raise exception[0], exception[1], exception[2]
return 0I am investigating a fix as follows
@cython.final
cdef int reraise_on_exception(self) except -1:
if self._raised_exception is not None:
exception = self._raised_exception
self._raised_exception = None
- raise exception[0], exception[1], exception[2]
+ raise exception
return 0and
@cython.final
cdef int store_raised_exception(self, lua_State* L, bytes lua_error_msg) except -1:
try:
- self._raised_exception = tuple(exc_info())
- py_to_lua(self, L, self._raised_exception[1])
+ self._raised_exception = exc_info()[1]
+ py_to_lua(self, L, self._raised_exception)
except:
lua.lua_pushlstring(L, lua_error_msg, len(lua_error_msg))
raise
return 0and change the typing:
- cdef tuple _raised_exception
+ cdef Exception _raised_exceptionMetadata
Metadata
Assignees
Labels
No labels