summaryrefslogtreecommitdiff
path: root/src/python/m5/util/terminal.py
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2019-12-02 17:53:26 -0800
committerGabe Black <gabeblack@google.com>2019-12-12 03:29:53 +0000
commitd11f5c97af8cf81c3b984ec948ce653148831f59 (patch)
tree3460a5e8f71c1ba2c8a98357a2d649a37ba6ea45 /src/python/m5/util/terminal.py
parent8e5217123d1d9375e04a25b7ce9a0073ca48622c (diff)
downloadgem5-d11f5c97af8cf81c3b984ec948ce653148831f59.tar.xz
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 <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/python/m5/util/terminal.py')
-rw-r--r--src/python/m5/util/terminal.py2
1 files changed, 1 insertions, 1 deletions
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: