changeset 36276:c95c8ab2e7ec

tests: fix get-with-headers.py on python3 when writing to stdout Differential Revision: https://phab.mercurial-scm.org/D2306
author Augie Fackler <augie@google.com>
date Sat, 17 Feb 2018 22:39:12 -0500
parents 0cacd4df6eb0
children 18106c3bc94a
files tests/get-with-headers.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/get-with-headers.py	Sat Feb 17 22:38:53 2018 -0500
+++ b/tests/get-with-headers.py	Sat Feb 17 22:39:12 2018 -0500
@@ -76,7 +76,7 @@
         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.