[Lldb-commits] [lldb] c6e4a63 - [lldb][examples] Remove Python 2 compatibility code in lldbtk.py

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 13 06:13:36 PDT 2025


Author: David Spickett
Date: 2025-10-13T13:13:07Z
New Revision: c6e4a6329525c714dbc603c2bb38de03450a68a0

URL: https://github.com/llvm/llvm-project/commit/c6e4a6329525c714dbc603c2bb38de03450a68a0
DIFF: https://github.com/llvm/llvm-project/commit/c6e4a6329525c714dbc603c2bb38de03450a68a0.diff

LOG: [lldb][examples] Remove Python 2 compatibility code in lldbtk.py

The Tkinter module was renamed to tkinter in Python 3.0.

https://docs.python.org/2/library/tkinter.html
https://docs.python.org/3/library/tkinter.html

Rest of it appears to work when imported inside of LLDB:
```
$ ./bin/lldb /tmp/test.o
(lldb) target create "/tmp/test.o"
Current executable set to '/tmp/test.o' (x86_64).
(lldb) b main
Breakpoint 1: where = test.o`main + 8 at test.c:1:18, address = 0x0000000000001131
(lldb) run
Process 121572 launched: '/tmp/test.o' (x86_64)
Process 121572 stopped
* thread #1, name = 'test.o', stop reason = breakpoint 1.1
    frame #0: 0x0000555555555131 test.o`main at test.c:1:18
-> 1   	int main() { int a = 1; char b = '?'; return 0; }
(lldb) command script import <...>/llvm-project/lldb/examples/python/lldbtk.py
(lldb) tk-
Available completions:
        tk-process   -- For more information run 'help tk-process'
        tk-target    -- For more information run 'help tk-target'
        tk-variables -- For more information run 'help tk-variables'
(lldb) tk-process
(lldb) tk-target
(lldb) tk-variables
```

Added: 
    

Modified: 
    lldb/examples/python/lldbtk.py

Removed: 
    


################################################################################
diff  --git a/lldb/examples/python/lldbtk.py b/lldb/examples/python/lldbtk.py
index f1685c04313a0..72fe91e4e932e 100644
--- a/lldb/examples/python/lldbtk.py
+++ b/lldb/examples/python/lldbtk.py
@@ -4,12 +4,8 @@
 import shlex
 import sys
 
-try:
-    from tkinter import *
-    import tkinter.ttk as ttk
-except ImportError:
-    from Tkinter import *
-    import ttk
+from tkinter import *
+import tkinter.ttk as ttk
 
 
 class ValueTreeItemDelegate(object):


        


More information about the lldb-commits mailing list