[llvm] Make lldbDataFormatters.py compatible with Python 3.8 (PR #82518)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 10:24:07 PST 2024


https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/82518

I just tried to load this into LLDB built against Python 3.8.5 and got the following error: `TypeError: 'type' object is not subscriptable`. I could fix this by wrapping the annotations in quotes but since Python 3.7 this syntax can be enabled with `from __future__ import annotations`.

>From edde71953177e76da97133194f1ef4ff51b9c6a3 Mon Sep 17 00:00:00 2001
From: Alex Richardson <alexrichardson at google.com>
Date: Wed, 21 Feb 2024 10:22:06 -0800
Subject: [PATCH] Make lldbDataFormatters.py compatible with Python 3.8

I just tried to load this into LLDB built against Python 3.8.5 and got
the following error: `TypeError: 'type' object is not subscriptable`.
I could fix this by wrapping the annotations in quotes but since Python
3.7 this syntax can be enabled with `from __future__ import annotations`.
---
 llvm/utils/lldbDataFormatters.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/utils/lldbDataFormatters.py b/llvm/utils/lldbDataFormatters.py
index de101abdabc8ec..4a34ad2a87c331 100644
--- a/llvm/utils/lldbDataFormatters.py
+++ b/llvm/utils/lldbDataFormatters.py
@@ -3,6 +3,7 @@
 
 Load into LLDB with 'command script import /path/to/lldbDataFormatters.py'
 """
+from __future__ import annotations
 
 import collections
 import lldb



More information about the llvm-commits mailing list