Skip to content

Commit

Permalink
Avoid one-time threading initialisation from interfering with refcoun…
Browse files Browse the repository at this point in the history
…ting test.
  • Loading branch information
scoder committed May 30, 2024
1 parent 7b649d2 commit 2e2c203
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lupa/tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ def get_attr(obj, name):
self._run_gc_test(make_refcycle, off_by_one=True)

def test_lupa_gc_deadlock(self):
lua = self.lupa.LuaRuntime()

def assert_no_deadlock(thread):
thread.start()
thread.join(1)
Expand All @@ -123,6 +121,14 @@ def trigger_gc(ref):
)
lua.gccollect()

# Pre-initialise threading outside of the refcount checks.
lua = self.lupa.LuaRuntime()
assert_no_deadlock(threading.Thread())
delete_table_reference_in_thread()
gc.collect()

# Run test.
lua = self.lupa.LuaRuntime()
self._run_gc_test(delete_table_reference_in_thread)


Expand Down

0 comments on commit 2e2c203

Please sign in to comment.