diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index f088e5b8b5089c..64bf310d569c14 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -1084,6 +1084,23 @@ def test(x, y): assert_python_ok("-W", "always", "-X", "tlbc=0", "-c", code) assert_python_ok("-W", "always", "-c", code, PYTHON_TLBC="0") + @unittest.skipUnless(support.Py_GIL_DISABLED, + "PYTHON_TLBC and -X tlbc" + " only supported in Py_GIL_DISABLED builds") + @threading_helper.requires_working_threading() + def test_enable_thread_local_bytecode(self): + code = """if 1: + import threading + def test(x, y): + return x + y + t = threading.Thread(target=test, args=(1,2)) + t.start() + t.join()""" + # The functionality of thread-local bytecode is tested more extensively + # in test_thread_local_bytecode + assert_python_ok("-W", "always", "-X", "tlbc=1", "-c", code) + assert_python_ok("-W", "always", "-c", code, PYTHON_TLBC="1") + @unittest.skipUnless(support.Py_GIL_DISABLED, "PYTHON_TLBC and -X tlbc" " only supported in Py_GIL_DISABLED builds")