https://github.com/da-viper created https://github.com/llvm/llvm-project/pull/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. >From 49b353bf13d66e7503e46def8d8a1c9f6b707309 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike <[email protected]> Date: Mon, 22 Dec 2025 14:31:09 +0000 Subject: [PATCH] [lldb-dap][test] Add Python 3.8 compatibility for test suite 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. --- .../Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 9 ++++++++- .../lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) 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
