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

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Sun Feb 18 07:46:52 EST 2018


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

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.



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


More information about the Mercurial-devel mailing list