[v2,gdb/testsuite] updated analyze-racy-logs.py to python3

Message ID 20211001190255.31859-1-blarsen@redhat.com
State Superseded
Headers show
Series
  • [v2,gdb/testsuite] updated analyze-racy-logs.py to python3
Related show

Commit Message

Tom Tromey via Gdb-patches Oct. 1, 2021, 7:02 p.m.
Since python 2 is no longer supported on most distributions, updated the
script to run under python while while still being runnable under
python2.
---
 gdb/testsuite/analyze-racy-logs.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
2.27.0

Comments

Tom Tromey via Gdb-patches Oct. 1, 2021, 8:07 p.m. | #1
On 2021-10-01 15:02, Bruno Larsen via Gdb-patches wrote:
> Since python 2 is no longer supported on most distributions, updated 

> the

> script to run under python while while still being runnable under

> python2.


Please try to write your commit messages at the present tense, for 
example saying "update the script to run..." instead of "updated the 
script to run...".

I think we should update the shebang line to say "python3" instead of 
"python".  We aim for having a Python 3 script.  If it is still runnable 
as a Python 2 script with not too much effort, then it's just a bonus.

The patch LGTM other than that.

Simon

Patch

diff --git a/gdb/testsuite/analyze-racy-logs.py b/gdb/testsuite/analyze-racy-logs.py
index 604a272831c..e8b3758c38b 100755
--- a/gdb/testsuite/analyze-racy-logs.py
+++ b/gdb/testsuite/analyze-racy-logs.py
@@ -145,7 +145,7 @@  def identify_racy_tests():
     # to be ignored.  For example, tests both in the PASS and KFAIL
     # states should not be considered racy.
     ignored_tests = set()
-    for s1, s2 in ignore_relations.iteritems():
+    for s1, s2 in ignore_relations.items():
         try:
             ignored_tests |= all_tests[s1] & all_tests[s2]
         except:
@@ -159,16 +159,16 @@  def identify_racy_tests():
     racy_tests = racy_tests - ignored_tests
 
     # Print the header.
-    print "\t\t=== gdb racy tests ===\n"
+    print("\t\t=== gdb racy tests ===\n")
 
     # Print each test.
     for line in sorted(racy_tests):
-        print line
+        print(line)
 
     # Print the summary.
-    print "\n"
-    print "\t\t=== gdb Summary ===\n"
-    print "# of racy tests:\t\t%d" % len(racy_tests)
+    print("\n")
+    print("\t\t=== gdb Summary ===\n")
+    print("# of racy tests:\t\t%d" % len(racy_tests))
 
 
 if __name__ == "__main__":