From: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>, kvm@vger.kernel.org
Cc: Andrew Jones <andrew.jones@linux.dev>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [kvm-unit-tests PATCH] scripts/pretty_print_stacks.py: Silence warning from Python 3.12
Date: Tue, 19 Dec 2023 15:52:59 +0100 [thread overview]
Message-ID: <36675f5872ce8343b9909f3e3445e34339cb5e60.camel@linux.ibm.com> (raw)
In-Reply-To: <20231219132313.31107-1-thuth@redhat.com>
On Tue, 2023-12-19 at 14:23 +0100, Thomas Huth wrote:
> Python 3.12 complains:
>
> ./scripts/pretty_print_stacks.py:41: SyntaxWarning:
> invalid escape sequence '\?'
> m = re.match(b'(.*) at (.*):(([0-9]+)|\?)([^:]*)', line)
>
> Switch to a raw string to silence the problem.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> scripts/pretty_print_stacks.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/pretty_print_stacks.py b/scripts/pretty_print_stacks.py
> index d990d300..5bce84fc 100755
> --- a/scripts/pretty_print_stacks.py
> +++ b/scripts/pretty_print_stacks.py
> @@ -38,7 +38,7 @@ def pretty_print_stack(binary, line):
> return
>
> for line in out.splitlines():
> - m = re.match(b'(.*) at (.*):(([0-9]+)|\?)([^:]*)', line)
> + m = re.match(r'(.*) at (.*):(([0-9]+)|\?)([^:]*)', line)
Did you test this? Should this not be rb'<regex>'?
I get
TypeError: cannot use a string pattern on a bytes-like object
When imitating this in a REPL.
We don't open the process in text mode, so its output should
be bytes and after splitting, "line" should be too.
> if m is None:
> puts('%s\n' % line)
> return
next prev parent reply other threads:[~2023-12-19 14:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-19 13:23 [kvm-unit-tests PATCH] scripts/pretty_print_stacks.py: Silence warning from Python 3.12 Thomas Huth
2023-12-19 14:52 ` Nina Schoetterl-Glausch [this message]
2023-12-19 15:29 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36675f5872ce8343b9909f3e3445e34339cb5e60.camel@linux.ibm.com \
--to=nsg@linux.ibm.com \
--cc=andrew.jones@linux.dev \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox