]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/dap] Fix regressions with python 3.6
authorTom de Vries <tdevries@suse.de>
Sat, 14 Dec 2024 08:36:37 +0000 (09:36 +0100)
committerTom de Vries <tdevries@suse.de>
Sat, 14 Dec 2024 08:36:37 +0000 (09:36 +0100)
With test-case gdb.dap/ada-arrays.exp, on Leap openSUSE 15.6 with python 3.6,
I run into:
...
Python Exception <class 'TypeError'>: 'type' object is not subscriptable
Error occurred in Python: 'type' object is not subscriptable
ERROR: tcl error sourcing ada-arrays.exp.
...

This is due to using a python 3.9 construct:
...
thread_ids: dict[int, int] = {}
...

Fix this by using typing.Dict instead.

Tested on x86_64-linux.

gdb/python/lib/gdb/dap/frames.py

index 12113961386313aa595f2a50749a0f1d0b120d58..5ef6cdaeaa80c5053586ca295d2b62bcd53502b7 100644 (file)
@@ -20,6 +20,7 @@ from gdb.frames import frame_iterator
 
 from .startup import in_gdb_thread
 from .state import set_thread
+from typing import Dict
 
 # A list of all the frames we've reported.  A frame's index in the
 # list is its ID.  We don't use a hash here because frames are not
@@ -31,7 +32,7 @@ _all_frames = []
 _iter_map = {}
 
 # Map from a global frame ID to a thread ID.
-thread_ids: dict[int, int] = {}
+thread_ids: Dict[int, int] = {}
 
 
 # Clear all the frame IDs.