# HG changeset patch # User Augie Fackler # Date 2018-02-18 03:39:12 # Node ID c95c8ab2e7ec13e4a35619d7f31cb2d7f9500b43 # Parent 0cacd4df6eb086c4352ce0c3d1a4d6ab832f2375 tests: fix get-with-headers.py on python3 when writing to stdout Differential Revision: https://phab.mercurial-scm.org/D2306 diff --git a/tests/get-with-headers.py b/tests/get-with-headers.py --- a/tests/get-with-headers.py +++ b/tests/get-with-headers.py @@ -76,7 +76,7 @@ def request(host, path, show): if args.bodyfile: bodyfh = open(args.bodyfile, 'wb') else: - bodyfh = sys.stdout + bodyfh = getattr(sys.stdout, 'buffer', sys.stdout) # Pretty print JSON. This also has the beneficial side-effect # of verifying emitted JSON is well-formed.