https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/176463
This decorator is trying to reference the file that is already deleted by the time the `nm` call is made. Moving the delete to `__del__` instead should fix this. >From fe4d9aac81d9dbc770faeb568951b06b35f2d0f1 Mon Sep 17 00:00:00 2001 From: John Harrison <[email protected]> Date: Fri, 16 Jan 2026 11:25:28 -0800 Subject: [PATCH] [lldb] Fix the 'skipUnlessUndefinedBehaviorSanitizer' decorator. This decorator is trying to reference the file that is already deleted by the time the `nm` call is made. Moving the delete to `__del__` instead should fix this. --- .../packages/Python/lldbsuite/support/temp_file.py | 14 +++++++++++--- lldb/packages/Python/lldbsuite/test/decorators.py | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/support/temp_file.py b/lldb/packages/Python/lldbsuite/support/temp_file.py index a21e212d279d6..e28eaaef1379c 100644 --- a/lldb/packages/Python/lldbsuite/support/temp_file.py +++ b/lldb/packages/Python/lldbsuite/support/temp_file.py @@ -12,12 +12,20 @@ class OnDiskTempFile: def __init__(self, delete=True): self.path = None - def __enter__(self): + def __del__(self): + if self.path and os.path.exists(self.path): + os.remove(self.path) + + def _set_path(self): + if self.path: + return fd, path = tempfile.mkstemp() os.close(fd) self.path = path + + def __enter__(self): + self._set_path() return self def __exit__(self, exc_type, exc_val, exc_tb): - if os.path.exists(self.path): - os.remove(self.path) + pass diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index a7df9fe63badc..b1516bf214a87 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -1114,6 +1114,7 @@ def is_compiler_with_bounds_safety(): return skipTestIfFn(is_compiler_with_bounds_safety)(func) + def skipIfAsan(func): """Skip this test if the environment is set up to run LLDB *itself* under ASAN.""" return skipTestIfFn(is_running_under_asan)(func) _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
