From: Thomas Huth <thuth@redhat.com>
To: Nina Schoetterl-Glausch <nsg@linux.ibm.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 16:29:26 +0100 [thread overview]
Message-ID: <1d6ab266-ae6f-4f48-a6b0-ac05e53c3768@redhat.com> (raw)
In-Reply-To: <36675f5872ce8343b9909f3e3445e34339cb5e60.camel@linux.ibm.com>
On 19/12/2023 15.52, Nina Schoetterl-Glausch wrote:
> 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
Drat, of course I only tested it in the sense that I made sure that the
python warning goes away when running the run_test.sh script, but I did not
trigger a backtrace ...
You're right of course, it has to be rb'...' here instead. I'll send a v2.
Thomas
prev parent reply other threads:[~2023-12-19 15:29 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
2023-12-19 15:29 ` Thomas Huth [this message]
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=1d6ab266-ae6f-4f48-a6b0-ac05e53c3768@redhat.com \
--to=thuth@redhat.com \
--cc=andrew.jones@linux.dev \
--cc=kvm@vger.kernel.org \
--cc=nsg@linux.ibm.com \
--cc=pbonzini@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