From d11f5c97af8cf81c3b984ec948ce653148831f59 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 2 Dec 2019 17:53:26 -0800 Subject: [PATCH] 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 --- src/python/m5/util/terminal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: -- 2.30.2