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

login
register
mail settings
Submitter phabricator
Date April 13, 2018, 10:22 p.m.
Message ID <2c86632a6d93951f231ea774cbf88e9b@localhost.localdomain>
Download mbox | patch
Permalink /patch/30945/
State Not Applicable
Headers show

Comments

phabricator - April 13, 2018, 10:22 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG483cafc3762a: py3: make sure curses.tigetstr() first argument is a str (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3325?vs=8145&id=8199

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

AFFECTED FILES
  mercurial/color.py

CHANGE DETAILS




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

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