https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/215279
None >From 95b062db9ac3ab1e13d6fbed15334c980aee2d8e Mon Sep 17 00:00:00 2001 From: David Spickett <[email protected]> Date: Mon, 10 Aug 2026 13:25:03 +0000 Subject: [PATCH] [lldb][test][LUA] Remove Python2 workaround --- lldb/test/API/lua_api/TestLuaAPI.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lldb/test/API/lua_api/TestLuaAPI.py b/lldb/test/API/lua_api/TestLuaAPI.py index 1fb64e7fc20d0..a276521f19a60 100644 --- a/lldb/test/API/lua_api/TestLuaAPI.py +++ b/lldb/test/API/lua_api/TestLuaAPI.py @@ -95,18 +95,15 @@ def executeCommand(command, cwd=None, env=None, input=None, timeout=0): close_fds=kUseCloseFDs, ) timerObject = None - # FIXME: Because of the way nested function scopes work in Python 2.x we - # need to use a reference to a mutable object rather than a plain - # bool. In Python 3 we could use the "nonlocal" keyword but we need - # to support Python 2 as well. - hitTimeOut = [False] + hitTimeOut = False try: if timeout > 0: def killProcess(): # We may be invoking a shell so we need to kill the # process and all its children. - hitTimeOut[0] = True + nonlocal hitTimeOut + hitTimeOut = True killProcessAndChildren(p.pid) timerObject = threading.Timer(timeout, killProcess) @@ -122,7 +119,7 @@ def killProcess(): out = to_string(out) err = to_string(err) - if hitTimeOut[0]: + if hitTimeOut: raise ExecuteCommandTimeoutException( msg="Reached timeout of {} seconds".format(timeout), out=out, _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
