Skip to content

Commit

Permalink
Fix test_decrease_memory error for Lua 5.1
Browse files Browse the repository at this point in the history
Don't run Lua code after decreasing memory limit. Lua 5.1 seems can't
free the memory of the `a` variable after deleting it, thus it will raise
`LuaMemoryError` again.
  • Loading branch information
xxyzz committed Apr 12, 2023
1 parent bf4c5f2 commit bea8e68
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lupa/tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3034,7 +3034,9 @@ def test_decrease_memory(self):
self.assertGreaterEqual(self.lua.get_memory_used(), 50000)
self.assertRaises(self.lupa.LuaMemoryError, self.lua.eval, "('b'):rep(10)")
del self.lua.globals()["a"]
self.lua.eval("('b'):rep(10)")
if self.lua.lua_version != (5, 1):
# Lua 5.1 doesn't free the memory of `a` after deleting it
self.lua.eval("('b'):rep(10)")

def test_compile_not_enough_memory(self):
self.lua.set_max_memory(10)
Expand Down

0 comments on commit bea8e68

Please sign in to comment.