Patchwork D3325: py3: make sure curses.tigetstr() first argument is a str

login
register
mail settings
Submitter phabricator
Date April 13, 2018, 8:48 p.m.
Message ID <differential-rev-PHID-DREV-matg2k5p23ns2egvmykr-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30887/
State Superseded
Headers show

Comments

phabricator - April 13, 2018, 8:48 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/color.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel, spectral

Patch

diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -171,12 +171,12 @@ 
     for key, (b, e, c) in ui._terminfoparams.copy().items():
         if not b:
             continue
-        if not c and not curses.tigetstr(e):
+        if not c and not curses.tigetstr(pycompat.sysstr(e)):
             # Most terminals don't support dim, invis, etc, so don't be
             # noisy and use ui.debug().
             ui.debug("no terminfo entry for %s\n" % e)
             del ui._terminfoparams[key]
-    if not curses.tigetstr('setaf') or not curses.tigetstr('setab'):
+    if not curses.tigetstr(r'setaf') or not curses.tigetstr(r'setab'):
         # Only warn about missing terminfo entries if we explicitly asked for
         # terminfo mode and we're in a formatted terminal.
         if mode == "terminfo" and formatted:
@@ -325,11 +325,11 @@ 
         if termcode:
             return termcode
         else:
-            return curses.tigetstr(val)
+            return curses.tigetstr(pycompat.sysstr(val))
     elif bg:
-        return curses.tparm(curses.tigetstr('setab'), val)
+        return curses.tparm(curses.tigetstr(r'setab'), val)
     else:
-        return curses.tparm(curses.tigetstr('setaf'), val)
+        return curses.tparm(curses.tigetstr(r'setaf'), val)
 
 def _mergeeffects(text, start, stop):
     """Insert start sequence at every occurrence of stop sequence