Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Safer handling of the Lua stack (GH-188)
Some places don't lock the LuaRuntime before fiddling with the Lua stack, and many places don't ensure extra slots either. This PR also involves other changes: * Add preconditions and postconditions to important functions/methods * Change behaviour _LuaObject.__str__ * If __tostring doesn't exist, use _LuaObject.__repr__ * If __tostring returns non-string value, raise a TypeError * If __tostring raises an error, raise a LuaError * lua_pushglobaltable instead of pushing _G, which may not point to the global table. * Make lock_runtime return boolean and not raise error directly * Use LUA_NOREF and LUA_REFNIL constants for effective handling of Lua references * Add important assertions (checks if LuaRuntime._state is not NULL, and if _LuaObject._runtime is None, etc...)
- Loading branch information