summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/combinerefs.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/scripts/combinerefs.py')
-rwxr-xr-xTools/scripts/combinerefs.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/Tools/scripts/combinerefs.py b/Tools/scripts/combinerefs.py
index f04b29f..e10e49a 100755
--- a/Tools/scripts/combinerefs.py
+++ b/Tools/scripts/combinerefs.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
"""
combinerefs path
@@ -86,7 +86,8 @@ def read(fileiter, pat, whilematch):
break
def combine(fname):
- f = file(fname)
+ f = open(fname)
+
fi = iter(f)
for line in read(fi, re.compile(r'^Remaining objects:$'), False):
@@ -102,7 +103,7 @@ def combine(fname):
addr, addr2rc[addr], addr2guts[addr] = m.groups()
before += 1
else:
- print '??? skipped:', line
+ print('??? skipped:', line)
after = 0
for line in read(fi, crack, True):
@@ -111,17 +112,17 @@ def combine(fname):
assert m
addr, rc, guts = m.groups() # guts is type name here
if addr not in addr2rc:
- print '??? new object created while tearing down:', line.rstrip()
+ print('??? new object created while tearing down:', line.rstrip())
continue
- print addr,
+ print(addr, end=' ')
if rc == addr2rc[addr]:
- print '[%s]' % rc,
+ print('[%s]' % rc, end=' ')
else:
- print '[%s->%s]' % (addr2rc[addr], rc),
- print guts, addr2guts[addr]
+ print('[%s->%s]' % (addr2rc[addr], rc), end=' ')
+ print(guts, addr2guts[addr])
f.close()
- print "%d objects before, %d after" % (before, after)
+ print("%d objects before, %d after" % (before, after))
if __name__ == '__main__':
combine(sys.argv[1])