Skip to content

Commit 35e1a2f

Browse files
[llvm][tools][opt-viewer] Remove Python2 compatability code in optrecord.py (#163744)
LLVM requires Python >= 3.8. itervalues was unused so I have removed it.
1 parent aaf7aa3 commit 35e1a2f

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

llvm/tools/opt-viewer/optrecord.py

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,14 @@
1919
from multiprocessing import Lock
2020
import os, os.path
2121
import subprocess
22-
23-
try:
24-
# The previously builtin function `intern()` was moved
25-
# to the `sys` module in Python 3.
26-
from sys import intern
27-
except:
28-
pass
29-
22+
from sys import intern
3023
import re
3124

3225
import optpmap
3326

34-
try:
35-
dict.iteritems
36-
except AttributeError:
37-
# Python 3
38-
def itervalues(d):
39-
return iter(d.values())
40-
41-
def iteritems(d):
42-
return iter(d.items())
43-
44-
else:
45-
# Python 2
46-
def itervalues(d):
47-
return d.itervalues()
48-
49-
def iteritems(d):
50-
return d.iteritems()
27+
28+
def iteritems(d):
29+
return iter(d.items())
5130

5231

5332
def html_file_name(filename):

0 commit comments

Comments
 (0)