From bb2437163e36b00f6408dcd8e8b65e4ca6051a38 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Thu, 5 Sep 2024 09:13:11 -0400 Subject: [PATCH] Call json.dump directly --- pyperf/_process_time.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyperf/_process_time.py b/pyperf/_process_time.py index 6e2de10..f353f75 100644 --- a/pyperf/_process_time.py +++ b/pyperf/_process_time.py @@ -115,15 +115,15 @@ def load_hooks(metadata): def write_data(dt, max_rss, metadata, out=sys.stdout): - # The data that is communicated back to the main orchestration process. + # Write the data that is communicated back to the main orchestration process. # It is three lines containing: # - The runtime (in seconds) # - max_rss (or -1, if not able to compute) # - The metadata to add to the benchmark entry, as a JSON dictionary - # Write timing in seconds into stdout print(dt, file=out) print(max_rss or -1, file=out) - print(json.dumps(metadata), file=out) + json.dump(metadata, fp=out) + print(file=out) def main():