[PATCH] D27405: Make sancov.py py3-compatible
NAKAMURA Takumi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 1 00:13:11 PST 2017
chapuni marked 2 inline comments as done.
chapuni added a comment.
@mgorny Thanks to review.
================
Comment at: compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py:73
size -= 8
- s = struct.unpack_from(TypeCodeForStruct(bits) * (size * 8 / bits), f.read(size))
- print >>sys.stderr, "%s: read %d %d-bit PCs from %s" % (prog_name, size * 8 / bits, bits, path)
+ w = size * 8 // bits
+ s = struct.unpack_from(TypeCodeForStruct(bits) * (w), f.read(size))
----------------
mgorny wrote:
> That's Python 2.7+ but I guess we don't have to care about 2.6 anymore.
We require Py>=2.7. http://llvm.org/docs/GettingStarted.html#id8
================
Comment at: compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py:140
with open(map_path, mode="rt") as f_map:
- print >> sys.stderr, "%s: reading map %s" % (prog_name, map_path)
+ sys.stderr.write("%s: reading map %s" % (prog_name, map_path))
bits = int(f_map.readline())
----------------
mgorny wrote:
> I think you ate a newline here.
Yes. I missed since check-asan didn't complain.
================
Comment at: compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py:223
for pc in sorted(missing):
- print "0x%x" % pc
+ print("0x%x" % pc)
----------------
mgorny wrote:
> Newline?
It ought to emit a newline.
Repository:
rL LLVM
https://reviews.llvm.org/D27405
More information about the llvm-commits
mailing list