qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracetool: avoid invalid escape in Python string
@ 2023-10-16  9:40 Paolo Bonzini
  0 siblings, 0 replies; 4+ messages 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.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/tracetool/__init__.py        | 14 +++++++-------
 scripts/tracetool/format/log_stap.py |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 33cf85e2b04..b29594d75e0 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -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"])
 
@@ -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."""
diff --git a/scripts/tracetool/format/log_stap.py b/scripts/tracetool/format/log_stap.py
index 0b6549d534a..b49afababd6 100644
--- a/scripts/tracetool/format/log_stap.py
+++ b/scripts/tracetool/format/log_stap.py
@@ -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):
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] tracetool: avoid invalid escape in Python string
@ 2023-11-08 10:56 marcandre.lureau
  2023-11-08 13:14 ` Philippe Mathieu-Daudé
  2023-11-09  7:22 ` Stefan Hajnoczi
  0 siblings, 2 replies; 4+ messages in thread
From: marcandre.lureau @ 2023-11-08 10:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: pbonzini, Marc-André Lureau, qemu-stable, Stefan Hajnoczi,
	Mads Ynddal

From: Marc-André Lureau <marcandre.lureau@redhat.com>

This is an error in Python 3.12; fix it by using a raw string literal.

Cc: qemu-stable@nongnu.org
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 scripts/tracetool/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index b29594d75e..b887540a55 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -91,7 +91,7 @@ def out(*lines, **kwargs):
 def validate_type(name):
     bits = name.split(" ")
     for bit in bits:
-        bit = re.sub("\*", "", bit)
+        bit = re.sub(r"\*", "", bit)
         if bit == "":
             continue
         if bit == "const":
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tracetool: avoid invalid escape in Python string
  2023-11-08 10:56 [PATCH] tracetool: avoid invalid escape in Python string marcandre.lureau
@ 2023-11-08 13:14 ` Philippe Mathieu-Daudé
  2023-11-09  7:22 ` Stefan Hajnoczi
  1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-08 13:14 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel
  Cc: pbonzini, qemu-stable, Stefan Hajnoczi, Mads Ynddal

On 8/11/23 11:56, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> This is an error in Python 3.12; fix it by using a raw string literal.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   scripts/tracetool/__init__.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tracetool: avoid invalid escape in Python string
  2023-11-08 10:56 [PATCH] tracetool: avoid invalid escape in Python string marcandre.lureau
  2023-11-08 13:14 ` Philippe Mathieu-Daudé
@ 2023-11-09  7:22 ` Stefan Hajnoczi
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2023-11-09  7:22 UTC (permalink / raw)
  To: marcandre.lureau; +Cc: qemu-devel, pbonzini, qemu-stable, Mads Ynddal

[-- Attachment #1: Type: text/plain, Size: 510 bytes --]

On Wed, Nov 08, 2023 at 02:56:49PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> This is an error in Python 3.12; fix it by using a raw string literal.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  scripts/tracetool/__init__.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied to my tracing tree:
https://gitlab.com/stefanha/qemu/commits/tracing

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-09  7:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-08 10:56 [PATCH] tracetool: avoid invalid escape in Python string marcandre.lureau
2023-11-08 13:14 ` Philippe Mathieu-Daudé
2023-11-09  7:22 ` Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2023-10-16  9:40 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).