No bug. Convert explain.py to python3 (maintaining python2 compatibility).
authorSteve Fink <sfink@mozilla.com>
Fri, 28 Dec 2018 21:14:25 -0800
changeset 510711 bc9a09046f1b83752004d6a4a9b54f06386a5e63
parent 510710 1f686d42d43ebd73b045dd16d1c167a0ed3e55f7
child 510712 4f7d7a7e6d6dde9e90975e4b00e08729c6496a3a
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
No bug. Convert explain.py to python3 (maintaining python2 compatibility).
js/src/devtools/rootAnalysis/explain.py
--- a/js/src/devtools/rootAnalysis/explain.py
+++ b/js/src/devtools/rootAnalysis/explain.py
@@ -1,12 +1,14 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
+from __future__ import print_function
+
+import argparse
 import re
-import argparse
 
 from collections import defaultdict
 
 parser = argparse.ArgumentParser(description='Process some integers.')
 parser.add_argument('rootingHazards', nargs='?', default='rootingHazards.txt')
 parser.add_argument('gcFunctions', nargs='?', default='gcFunctions.txt')
 parser.add_argument('hazards', nargs='?', default='hazards.txt')
 parser.add_argument('extra', nargs='?', default='unnecessary.txt')
@@ -29,30 +31,30 @@ try:
         # List of tuples (gcFunction, index of hazard) used to maintain the
         # ordering of the hazards
         hazardOrder = []
 
         for line in rootingHazards:
             m = re.match(r'^Time: (.*)', line)
             mm = re.match(r'^Run on:', line)
             if m or mm:
-                print >>hazards, line
-                print >>extra, line
-                print >>refs, line
+                print(line, file=hazards)
+                print(line, file=extra)
+                print(line, file=refs)
                 continue
 
             m = re.match(r'^Function.*has unnecessary root', line)
             if m:
-                print >>extra, line
+                print(line, file=extra)
                 continue
 
             m = re.match(r'^Function.*takes unsafe address of unrooted', line)
             if m:
                 num_refs += 1
-                print >>refs, line
+                print(line, file=refs)
                 continue
 
             m = re.match(
                 r"^Function.*has unrooted.*of type.*live across GC call ('?)(.*?)('?) at \S+:\d+$", line)  # NOQA: E501
             if m:
                 # Function names are surrounded by single quotes. Field calls
                 # are unquoted.
                 current_gcFunction = m.group(2)
@@ -87,19 +89,19 @@ try:
                     explanation += line
             if current_func:
                 gcExplanations[current_func] = explanation
 
         for gcFunction, index in hazardOrder:
             gcHazards = hazardousGCFunctions[gcFunction]
 
             if gcFunction in gcExplanations:
-                print >>hazards, (gcHazards[index] + gcExplanations[gcFunction])
+                print(gcHazards[index] + gcExplanations[gcFunction], file=hazards)
             else:
-                print >>hazards, gcHazards[index]
+                print(gcHazards[index], file=hazards)
 
 except IOError as e:
     print('Failed: %s' % str(e))
 
 print("Wrote %s" % args.hazards)
 print("Wrote %s" % args.extra)
 print("Wrote %s" % args.refs)
 print("Found %d hazards and %d unsafe references" % (num_hazards, num_refs))