Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/23265 )

Change subject: python: Convert terminal escape sequences to strings.
......................................................................

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 <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/python/m5/util/terminal.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/python/m5/util/terminal.py b/src/python/m5/util/terminal.py
index fd4392e..bb4ac80 100644
--- a/src/python/m5/util/terminal.py
+++ b/src/python/m5/util/terminal.py
@@ -75,7 +75,7 @@
     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:

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/23265
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ifc5d788e1c62751090a350d3a064e89f434559e8
Gerrit-Change-Number: 23265
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to