Skip to content

Commit

Permalink
Fix error in test_decrease_memory for Lua 5.1.5
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. And the memory limiting feature doesn't
support Lua 5.1.
  • Loading branch information
xxyzz committed Apr 12, 2023
1 parent c468c4e commit 731aaf5
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, 2):
# 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 731aaf5

Please sign in to comment.