Author: Ebuka Ezike Date: 2025-12-22T18:55:38Z New Revision: 9892870687e0af00e798474aa5cecfd4647071e1
URL: https://github.com/llvm/llvm-project/commit/9892870687e0af00e798474aa5cecfd4647071e1 DIFF: https://github.com/llvm/llvm-project/commit/9892870687e0af00e798474aa5cecfd4647071e1.diff LOG: [lldb-dap][test] Add Python 3.8 compatibility for test suite (#173264) Python 3.8 does not support subscriptable built-in types (dict[int], list[str], etc.) without importing annotations from __future__. This change adds `annotations` imports and handles missing API functions. Added: Modified: lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py Removed: ################################################################################ diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 333153597b13d..afa3dbde6dc5f 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 +# FIXME: remove when LLDB_MINIMUM_PYTHON_VERSION > 3.8 +from __future__ import annotations + import argparse import binascii import dataclasses @@ -1707,8 +1710,12 @@ def launch( ) ) + # FIXME: use `str.removeprefix` when LLDB_MINIMUM_PYTHON_VERSION > 3.8 + if out.startswith(expected_prefix): + out = out[len(expected_prefix) :] + # If the listener expanded into multiple addresses, use the first. - connection = out.removeprefix(expected_prefix).rstrip("\r\n").split(",", 1)[0] + connection = out.rstrip("\r\n").split(",", 1)[0] return (process, connection) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index fa8b1b7ab6426..73cc7fbc32715 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -1,3 +1,6 @@ +# FIXME: remove when LLDB_MINIMUM_PYTHON_VERSION > 3.8 +from __future__ import annotations + import os import time from typing import Optional, Callable, Any, List, Union, Final _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
