Patchwork D2306: tests: fix get-with-headers.py on python3 when writing to stdout

login
register
mail settings
Submitter phabricator
Date Feb. 18, 2018, 12:46 p.m.
Message ID <fce9595b623ddf843486a5e21db572c5@localhost.localdomain>
Download mbox | patch
Permalink /patch/28064/
State Not Applicable
Headers show

Comments

phabricator - Feb. 18, 2018, 12:46 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc95c8ab2e7ec: tests: fix get-with-headers.py on python3 when writing to stdout (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2306?vs=5824&id=5843

REVISION DETAIL
  https://phab.mercurial-scm.org/D2306

AFFECTED FILES
  tests/get-with-headers.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

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 @@ 
         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.