[PATCH kvm-unit-tests] pretty_print_stacks: port to Python 3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Recognize the line with a byte-based regex, then decode to Unicode
when printing the backtrace.

Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 scripts/pretty_print_stacks.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/pretty_print_stacks.py b/scripts/pretty_print_stacks.py
index 11042a7..a863c8e 100755
--- a/scripts/pretty_print_stacks.py
+++ b/scripts/pretty_print_stacks.py
@@ -37,14 +37,14 @@ def pretty_print_stack(binary, line):
         return
 
     for line in out.splitlines():
-        m = re.match('(.*) at [^ ]*/kvm-unit-tests/([^ ]*):([0-9]+)(.*)', line)
+        m = re.match(b'(.*) at [^ ]*/kvm-unit-tests/([^ ]*):([0-9]+)(.*)', line)
         if m is None:
             puts('%s\n' % line)
             return
 
         head, path, line, tail = m.groups()
         line = int(line)
-        puts('%s at %s:%d%s\n' % (head, path, line, tail))
+        puts('%s at %s:%d%s\n' % (head.decode(), path.decode(), line, tail.decode()))
         try:
             lines = open(path).readlines()
         except IOError:
-- 
2.17.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux