py3: encode json output to bytes and use write()
Differential Revision: https://phab.mercurial-scm.org/D5007
--- a/mercurial/statprof.py Fri Oct 12 17:48:40 2018 +0000
+++ b/mercurial/statprof.py Fri Oct 12 17:25:02 2018 +0200
@@ -763,7 +763,11 @@
samples.append((sample.time, stack))
- print(json.dumps(samples), file=fp)
+ data = json.dumps(samples)
+ if not isinstance(data, bytes):
+ data = data.encode('utf-8')
+
+ fp.write(data)
def write_to_chrome(data, fp, minthreshold=0.005, maxthreshold=0.999):
samples = []