[compiler-rt] r294812 - sancov.py: [Py3] Use sys.stdout.buffer for bytes.
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 10 16:16:03 PST 2017
Author: chapuni
Date: Fri Feb 10 18:16:02 2017
New Revision: 294812
URL: http://llvm.org/viewvc/llvm-project?rev=294812&view=rev
Log:
sancov.py: [Py3] Use sys.stdout.buffer for bytes.
This is part of https://reviews.llvm.org/D27405
Modified:
compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py
Modified: compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py?rev=294812&r1=294811&r2=294812&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py (original)
+++ compiler-rt/trunk/lib/sanitizer_common/scripts/sancov.py Fri Feb 10 18:16:02 2017
@@ -99,9 +99,10 @@ def MergeAndPrint(files):
bits = 32
if max(s) > 0xFFFFFFFF:
bits = 64
- array.array('I', MagicForBits(bits)).tofile(sys.stdout)
+ stdout_buf = getattr(sys.stdout, 'buffer', sys.stdout)
+ array.array('I', MagicForBits(bits)).tofile(stdout_buf)
a = struct.pack(TypeCodeForStruct(bits) * len(s), *s)
- sys.stdout.write(a)
+ stdout_buf.write(a)
def UnpackOneFile(path):
More information about the llvm-commits
mailing list