* [PATCH] tests/vm: avoid invalid escape in Python string
@ 2023-10-16 9:40 Paolo Bonzini
0 siblings, 0 replies; only message in thread
From: Paolo Bonzini @ 2023-10-16 9:40 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable
This is an error in Python 3.12; fix it by using a raw string literal
or by double-escaping the backslash.
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/vm/basevm.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index a97e23b0ce0..6e31698906b 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -331,8 +331,8 @@ def console_init(self, timeout = None):
def console_log(self, text):
for line in re.split("[\r\n]", text):
# filter out terminal escape sequences
- line = re.sub("\x1b\[[0-9;?]*[a-zA-Z]", "", line)
- line = re.sub("\x1b\([0-9;?]*[a-zA-Z]", "", line)
+ line = re.sub("\x1b\\[[0-9;?]*[a-zA-Z]", "", line)
+ line = re.sub("\x1b\\([0-9;?]*[a-zA-Z]", "", line)
# replace unprintable chars
line = re.sub("\x1b", "<esc>", line)
line = re.sub("[\x00-\x1f]", ".", line)
@@ -530,7 +530,7 @@ def get_qemu_version(qemu_path):
and return the major number."""
output = subprocess.check_output([qemu_path, '--version'])
version_line = output.decode("utf-8")
- version_num = re.split(' |\(', version_line)[3].split('.')[0]
+ version_num = re.split(r' |\(', version_line)[3].split('.')[0]
return int(version_num)
def parse_config(config, args):
--
2.41.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-16 9:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-16 9:40 [PATCH] tests/vm: avoid invalid escape in Python string Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).