From: Gabe Black Date: Tue, 3 Dec 2019 01:53:26 +0000 (-0800) Subject: python: Convert terminal escape sequences to strings. X-Git-Tag: v19.0.0.0~193 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d11f5c97af8cf81c3b984ec948ce653148831f59;p=gem5.git python: Convert terminal escape sequences to strings. In python 3, the curses escape sequences are bytes objects and not strings, making them unsuitable to concatenate to strings which are being print()-ed. This uses the decode() method to turn them from bytes objects into string objects, assuming they represent UTF-8. In python 2, bytes objects and strings are treated interchangeably, and so this isn't necessary. Change-Id: Ifc5d788e1c62751090a350d3a064e89f434559e8 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23265 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- diff --git a/src/python/m5/util/terminal.py b/src/python/m5/util/terminal.py index fd4392e95..bb4ac80fe 100644 --- a/src/python/m5/util/terminal.py +++ b/src/python/m5/util/terminal.py @@ -75,7 +75,7 @@ try: def cap_string(s, *args): cap = curses.tigetstr(s) if cap: - return curses.tparm(cap, *args) + return curses.tparm(cap, *args).decode('utf-8') else: return '' except: