Skip to content

Commit

Permalink
tracetool: avoid invalid escape in Python string
Browse files Browse the repository at this point in the history
This is an error in Python 3.12; fix it by using a raw string literal.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed Oct 17, 2023
1 parent 86a8989 commit e6d8e5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions scripts/tracetool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ class Event(object):
"""

_CRE = re.compile("((?P<props>[\w\s]+)\s+)?"
"(?P<name>\w+)"
"\((?P<args>[^)]*)\)"
"\s*"
"(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?"
"\s*")
_CRE = re.compile(r"((?P<props>[\w\s]+)\s+)?"
r"(?P<name>\w+)"
r"\((?P<args>[^)]*)\)"
r"\s*"
r"(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?"
r"\s*")

_VALID_PROPS = set(["disable", "vcpu"])

Expand Down Expand Up @@ -326,7 +326,7 @@ def __repr__(self):
fmt)
# Star matching on PRI is dangerous as one might have multiple
# arguments with that format, hence the non-greedy version of it.
_FMT = re.compile("(%[\d\.]*\w+|%.*?PRI\S+)")
_FMT = re.compile(r"(%[\d\.]*\w+|%.*?PRI\S+)")

def formats(self):
"""List conversion specifiers in the argument print format string."""
Expand Down
2 changes: 1 addition & 1 deletion scripts/tracetool/format/log_stap.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def c_fmt_to_stap(fmt):
# and "%ll" is not valid at all. Similarly the size_t
# based "%z" size qualifier is not valid. We just
# strip all size qualifiers for sanity.
fmt = re.sub("%(\d*)(l+|z)(x|u|d)", "%\\1\\3", "".join(bits))
fmt = re.sub(r"%(\d*)(l+|z)(x|u|d)", r"%\1\3", "".join(bits))
return fmt

def generate(events, backend, group):
Expand Down

0 comments on commit e6d8e5e

Please sign in to comment.