Patchwork [3,of,4] run-tests: pass unicode to Pygments

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 24, 2017, 3:20 p.m.
Message ID <a9b6c464c13b6a6d7dce.1503588042@mimosa>
Download mbox | patch
Permalink /patch/23304/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 24, 2017, 3:20 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1503580802 -32400
#      Thu Aug 24 22:20:02 2017 +0900
# Node ID a9b6c464c13b6a6d7dce4e8adf88d0e80dc96003
# Parent  7b0eeb08d182eec00c79fe4617c09c1ec12bcbc5
run-tests: pass unicode to Pygments

This is required on Python 3, and is more correct on Python 2 because
Pygments is a unicode library.
Augie Fackler - Aug. 25, 2017, 3:58 p.m.
On Fri, Aug 25, 2017 at 12:20:42AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1503580802 -32400
> #      Thu Aug 24 22:20:02 2017 +0900
> # Node ID a9b6c464c13b6a6d7dce4e8adf88d0e80dc96003
> # Parent  7b0eeb08d182eec00c79fe4617c09c1ec12bcbc5
> run-tests: pass unicode to Pygments

queued, thanks (first 3 only per your mail)

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -615,7 +615,8 @@  def highlightdiff(line, color):
     if not color:
         return line
     assert pygmentspresent
-    return pygments.highlight(line, difflexer, terminal256formatter)
+    return pygments.highlight(line.decode('latin1'), difflexer,
+                              terminal256formatter).encode('latin1')
 
 def highlightmsg(msg, color):
     if not color: