py3: make sure curses.tigetstr() first argument is a str
authorPulkit Goyal <7895pulkit@gmail.com>
Sat, 14 Apr 2018 02:00:43 +0530
changeset 37664 483cafc3762a
parent 37663 fc114a16a484
child 37665 83250442dc81
py3: make sure curses.tigetstr() first argument is a str Differential Revision: https://phab.mercurial-scm.org/D3325
mercurial/color.py
--- a/mercurial/color.py	Sat Apr 14 01:59:55 2018 +0530
+++ b/mercurial/color.py	Sat Apr 14 02:00:43 2018 +0530
@@ -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