Skip to content

Commit

Permalink
Merge branch 'pythongh-117683-test_free_different_thread' into nogil-…
Browse files Browse the repository at this point in the history
…integration
  • Loading branch information
colesbury committed Apr 12, 2024
2 parents db97e64 + b775561 commit 66e9790
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Lib/test/test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
ctypes = None
from test.support import (cpython_only,
check_impl_detail, requires_debug_ranges,
gc_collect)
gc_collect, Py_GIL_DISABLED)
from test.support.script_helper import assert_python_ok
from test.support import threading_helper, import_helper
from test.support.bytecode_helper import instructions_with_positions
Expand Down Expand Up @@ -866,7 +866,11 @@ def __init__(self, f, test):
def run(self):
del self.f
gc_collect()
self.test.assertEqual(LAST_FREED, 500)
# gh-117683: In the free-threaded build, the code object's
# destructor may still be running concurrently in the main
# thread.
if not Py_GIL_DISABLED:
self.test.assertEqual(LAST_FREED, 500)

SetExtra(f.__code__, FREE_INDEX, ctypes.c_voidp(500))
tt = ThreadTest(f, self)
Expand Down

0 comments on commit 66e9790

Please sign in to comment.