linux installer: fix python3 re.sub with mismatched str/bytes

This does not seem to have been a very commonly hit case, since it's
been broken for python3 since before 2014, but a user has just hit it
for the first time.

Fixes #1851873
This commit is contained in:
Eli Schwartz 2019-11-08 14:10:34 -05:00
parent d47c332723
commit 0163b537dc
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
2 changed files with 2 additions and 2 deletions

View File

@ -163,7 +163,7 @@ class TerminalController: # {{{
if isinstance(cap_name, bytes): if isinstance(cap_name, bytes):
cap_name = cap_name.decode('utf-8') cap_name = cap_name.decode('utf-8')
cap = self._escape_code(curses.tigetstr(cap_name)) cap = self._escape_code(curses.tigetstr(cap_name))
return re.sub(r'\$<\d+>[/*]?', b'', cap) return re.sub(r'\$<\d+>[/*]?', '', cap)
def render(self, template): def render(self, template):
return re.sub(r'\$\$|\${\w+}', self._render_sub, template) return re.sub(r'\$\$|\${\w+}', self._render_sub, template)

View File

@ -212,7 +212,7 @@ class TerminalController: # {{{
if isinstance(cap_name, bytes): if isinstance(cap_name, bytes):
cap_name = cap_name.decode('utf-8') cap_name = cap_name.decode('utf-8')
cap = self._escape_code(curses.tigetstr(cap_name)) cap = self._escape_code(curses.tigetstr(cap_name))
return re.sub(r'\$<\d+>[/*]?', b'', cap) return re.sub(r'\$<\d+>[/*]?', '', cap)
def render(self, template): def render(self, template):
return re.sub(r'\$\$|\${\w+}', self._render_sub, template) return re.sub(r'\$\$|\${\w+}', self._render_sub, template)