[Lldb-commits] [lldb] [llvm] [lldb/Interpreter] Surface Python exceptions from scripted extensions (PR #198153)

via lldb-commits lldb-commits at lists.llvm.org
Sun May 17 00:41:24 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r origin/main...HEAD lldb/test/API/functionalities/scripted_extensions/TestScriptedExtensionsDiagnostics.py lldb/test/API/functionalities/scripted_extensions/malformed_scripted_extensions.py test_scripted_exception.py
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- lldb/test/API/functionalities/scripted_extensions/TestScriptedExtensionsDiagnostics.py	2026-05-17 07:36:27.000000 +0000
+++ lldb/test/API/functionalities/scripted_extensions/TestScriptedExtensionsDiagnostics.py	2026-05-17 07:40:54.297481 +0000
@@ -111,11 +111,13 @@
     # ------------------------------------------------------------------
     # The remaining entry points need a live inferior process to trigger
     # their creation paths, or have no plugin implementation yet.
     # ------------------------------------------------------------------
 
-    @expectedFailureAll(bugnumber="OperatingSystemPython needs a live process to load the OS plugin")
+    @expectedFailureAll(
+        bugnumber="OperatingSystemPython needs a live process to load the OS plugin"
+    )
     def test_operating_system_missing_methods(self):
         self.assert_diagnostic("get_thread_info")
 
     @expectedFailureAll(bugnumber="ScriptedPlatform has no plugin implementation yet")
     def test_scripted_platform_missing_methods(self):
--- test_scripted_exception.py	2026-05-17 07:36:27.000000 +0000
+++ test_scripted_exception.py	2026-05-17 07:40:54.339516 +0000
@@ -1,10 +1,11 @@
 #!/usr/bin/env python3
 """
 Test script to verify Python exceptions in scripted processes are surfaced to users.
 This script defines a ScriptedProcess that intentionally raises exceptions.
 """
+
 
 class TestScriptedProcess:
     """A scripted process that raises exceptions to test error surfacing."""
 
     def __init__(self, exe_ctx, args):
@@ -14,11 +15,13 @@
         print("TestScriptedProcess initialized")
 
     def get_capabilities(self):
         """Return process capabilities - this will raise an exception."""
         # Intentionally raise an exception with a clear traceback
-        raise RuntimeError("TEST: This exception should be surfaced to the user with full backtrace!")
+        raise RuntimeError(
+            "TEST: This exception should be surfaced to the user with full backtrace!"
+        )
 
     def launch(self):
         """Launch the process - also raises an exception."""
         raise ValueError("TEST: Launch failed with a custom exception!")
 
@@ -30,9 +33,11 @@
         """Check if process is alive."""
         return True
 
     def get_threads_info(self):
         """Return thread information - will raise exception."""
+
         # Use nested function to create deeper traceback
         def nested_function():
             raise TypeError("TEST: Exception from nested function in get_threads_info!")
+
         nested_function()

``````````

</details>


https://github.com/llvm/llvm-project/pull/198153


More information about the lldb-commits mailing list