* Re: [PATCH 1/1] selftests/bpf: clear out Python syntax warnings
[not found] ` <26180f2e-1ef7-45de-8e9e-f08a4e6a6d36@qmon.net>
@ 2024-12-20 16:28 ` Ariel Otilibili-Anieli
2025-01-11 0:23 ` Andrii Nakryiko
0 siblings, 1 reply; 3+ messages in thread
From: Ariel Otilibili-Anieli @ 2024-12-20 16:28 UTC (permalink / raw)
To: Quentin Monnet
Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Shuah Khan, linux-kernel
On Friday, December 20, 2024 17:24 CET, Quentin Monnet <qmo@qmon.net> wrote:
> 2024-12-11 22:57 UTC+0100 ~ Ariel Otilibili
> <ariel.otilibili-anieli@eurecom.fr>
> > Invalid escape sequences are used, and produced syntax warnings:
> >
> > ```
> > $ test_bpftool_synctypes.py
> > test_bpftool_synctypes.py:69: SyntaxWarning: invalid escape sequence '\['
> > self.start_marker = re.compile(f'(static )?const bool {self.array_name}\[.*\] = {{\n')
> > test_bpftool_synctypes.py:83: SyntaxWarning: invalid escape sequence '\['
> > pattern = re.compile('\[(BPF_\w*)\]\s*= (true|false),?$')
> > test_bpftool_synctypes.py:181: SyntaxWarning: invalid escape sequence '\s'
> > pattern = re.compile('^\s*(BPF_\w+),?(\s+/\*.*\*/)?$')
> > test_bpftool_synctypes.py:229: SyntaxWarning: invalid escape sequence '\*'
> > start_marker = re.compile(f'\*{block_name}\* := {{')
> > test_bpftool_synctypes.py:229: SyntaxWarning: invalid escape sequence '\*'
> > start_marker = re.compile(f'\*{block_name}\* := {{')
> > test_bpftool_synctypes.py:230: SyntaxWarning: invalid escape sequence '\*'
> > pattern = re.compile('\*\*([\w/-]+)\*\*')
> > test_bpftool_synctypes.py:248: SyntaxWarning: invalid escape sequence '\s'
> > start_marker = re.compile(f'"\s*{block_name} := {{')
> > test_bpftool_synctypes.py:249: SyntaxWarning: invalid escape sequence '\w'
> > pattern = re.compile('([\w/]+) [|}]')
> > test_bpftool_synctypes.py:267: SyntaxWarning: invalid escape sequence '\s'
> > start_marker = re.compile(f'"\s*{macro}\s*" [|}}]')
> > test_bpftool_synctypes.py:267: SyntaxWarning: invalid escape sequence '\s'
> > start_marker = re.compile(f'"\s*{macro}\s*" [|}}]')
> > test_bpftool_synctypes.py:268: SyntaxWarning: invalid escape sequence '\w'
> > pattern = re.compile('([\w-]+) ?(?:\||}[ }\]])')
> > test_bpftool_synctypes.py:287: SyntaxWarning: invalid escape sequence '\w'
> > pattern = re.compile('(?:.*=\')?([\w/]+)')
> > test_bpftool_synctypes.py:319: SyntaxWarning: invalid escape sequence '\w'
> > pattern = re.compile('([\w-]+) ?(?:\||}[ }\]"])')
> > test_bpftool_synctypes.py:341: SyntaxWarning: invalid escape sequence '\|'
> > start_marker = re.compile('\|COMMON_OPTIONS\| replace:: {')
> > test_bpftool_synctypes.py:342: SyntaxWarning: invalid escape sequence '\*'
> > pattern = re.compile('\*\*([\w/-]+)\*\*')
> > ```
> >
> > Escaping them clears out the warnings.
> >
> > ```
> > $ tools/testing/selftests/bpf/test_bpftool_synctypes.py; echo $?
> > 0
> > ```
> >
> > Link: https://docs.python.org/fr/3/library/re.html
>
>
> En version anglaise : https://docs.python.org/3/library/re.html
Merci!
>
>
> > CC: Alexei Starovoitov <ast@kernel.org>
> > CC: Daniel Borkmann <daniel@iogearbox.net>
> > CC: Andrii Nakryiko <andrii@kernel.org>
> > CC: Shuah Khan <shuah@kernel.org>
> > Signed-off-by: Ariel Otilibili <ariel.otilibili-anieli@eurecom.fr>
>
> Right, this seems to be a change in Python 3.12 [0][1]:
>
> 'A backslash-character pair that is not a valid escape sequence now
> generates a SyntaxWarning, instead of DeprecationWarning. For example,
> re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid
> escape sequence, use raw strings for regular expression:
> re.compile(r"\d+\.\d+")).'
>
> although I can't remember seeing any DeprecationWarning before.
>
> Anyway, the fix makes sense, and does address the warnings. Thank you
> for this!
>
> Tested-by: Quentin Monnet <qmo@kernel.org>
> Reviewed-by: Quentin Monnet <qmo@kernel.org>
Awesome, Quentin! Thanks for the feedback!
>
>
> [0] https://docs.python.org/3.12/whatsnew/3.12.html#other-language-changes
> [1] https://github.com/python/cpython/issues/98401
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] selftests/bpf: clear out Python syntax warnings
2024-12-20 16:28 ` [PATCH 1/1] selftests/bpf: clear out Python syntax warnings Ariel Otilibili-Anieli
@ 2025-01-11 0:23 ` Andrii Nakryiko
2025-01-11 0:31 ` Ariel Otilibili-Anieli
0 siblings, 1 reply; 3+ messages in thread
From: Andrii Nakryiko @ 2025-01-11 0:23 UTC (permalink / raw)
To: Ariel Otilibili-Anieli
Cc: Quentin Monnet, bpf, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Shuah Khan, linux-kernel
On Fri, Dec 20, 2024 at 8:28 AM Ariel Otilibili-Anieli
<Ariel.Otilibili-Anieli@eurecom.fr> wrote:
>
> On Friday, December 20, 2024 17:24 CET, Quentin Monnet <qmo@qmon.net> wrote:
>
> > 2024-12-11 22:57 UTC+0100 ~ Ariel Otilibili
> > <ariel.otilibili-anieli@eurecom.fr>
> > > Invalid escape sequences are used, and produced syntax warnings:
> > >
> > > ```
> > > $ test_bpftool_synctypes.py
> > > test_bpftool_synctypes.py:69: SyntaxWarning: invalid escape sequence '\['
> > > self.start_marker = re.compile(f'(static )?const bool {self.array_name}\[.*\] = {{\n')
> > > test_bpftool_synctypes.py:83: SyntaxWarning: invalid escape sequence '\['
> > > pattern = re.compile('\[(BPF_\w*)\]\s*= (true|false),?$')
> > > test_bpftool_synctypes.py:181: SyntaxWarning: invalid escape sequence '\s'
> > > pattern = re.compile('^\s*(BPF_\w+),?(\s+/\*.*\*/)?$')
> > > test_bpftool_synctypes.py:229: SyntaxWarning: invalid escape sequence '\*'
> > > start_marker = re.compile(f'\*{block_name}\* := {{')
> > > test_bpftool_synctypes.py:229: SyntaxWarning: invalid escape sequence '\*'
> > > start_marker = re.compile(f'\*{block_name}\* := {{')
> > > test_bpftool_synctypes.py:230: SyntaxWarning: invalid escape sequence '\*'
> > > pattern = re.compile('\*\*([\w/-]+)\*\*')
> > > test_bpftool_synctypes.py:248: SyntaxWarning: invalid escape sequence '\s'
> > > start_marker = re.compile(f'"\s*{block_name} := {{')
> > > test_bpftool_synctypes.py:249: SyntaxWarning: invalid escape sequence '\w'
> > > pattern = re.compile('([\w/]+) [|}]')
> > > test_bpftool_synctypes.py:267: SyntaxWarning: invalid escape sequence '\s'
> > > start_marker = re.compile(f'"\s*{macro}\s*" [|}}]')
> > > test_bpftool_synctypes.py:267: SyntaxWarning: invalid escape sequence '\s'
> > > start_marker = re.compile(f'"\s*{macro}\s*" [|}}]')
> > > test_bpftool_synctypes.py:268: SyntaxWarning: invalid escape sequence '\w'
> > > pattern = re.compile('([\w-]+) ?(?:\||}[ }\]])')
> > > test_bpftool_synctypes.py:287: SyntaxWarning: invalid escape sequence '\w'
> > > pattern = re.compile('(?:.*=\')?([\w/]+)')
> > > test_bpftool_synctypes.py:319: SyntaxWarning: invalid escape sequence '\w'
> > > pattern = re.compile('([\w-]+) ?(?:\||}[ }\]"])')
> > > test_bpftool_synctypes.py:341: SyntaxWarning: invalid escape sequence '\|'
> > > start_marker = re.compile('\|COMMON_OPTIONS\| replace:: {')
> > > test_bpftool_synctypes.py:342: SyntaxWarning: invalid escape sequence '\*'
> > > pattern = re.compile('\*\*([\w/-]+)\*\*')
> > > ```
> > >
> > > Escaping them clears out the warnings.
> > >
> > > ```
> > > $ tools/testing/selftests/bpf/test_bpftool_synctypes.py; echo $?
> > > 0
> > > ```
> > >
> > > Link: https://docs.python.org/fr/3/library/re.html
> >
> >
> > En version anglaise : https://docs.python.org/3/library/re.html
>
> Merci!
> >
> >
> > > CC: Alexei Starovoitov <ast@kernel.org>
> > > CC: Daniel Borkmann <daniel@iogearbox.net>
> > > CC: Andrii Nakryiko <andrii@kernel.org>
> > > CC: Shuah Khan <shuah@kernel.org>
> > > Signed-off-by: Ariel Otilibili <ariel.otilibili-anieli@eurecom.fr>
> >
> > Right, this seems to be a change in Python 3.12 [0][1]:
> >
> > 'A backslash-character pair that is not a valid escape sequence now
> > generates a SyntaxWarning, instead of DeprecationWarning. For example,
> > re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid
> > escape sequence, use raw strings for regular expression:
> > re.compile(r"\d+\.\d+")).'
> >
> > although I can't remember seeing any DeprecationWarning before.
> >
> > Anyway, the fix makes sense, and does address the warnings. Thank you
> > for this!
> >
> > Tested-by: Quentin Monnet <qmo@kernel.org>
> > Reviewed-by: Quentin Monnet <qmo@kernel.org>
>
> Awesome, Quentin! Thanks for the feedback!
Seems like this was never applied, right? Ariel, can you please rebase
on latest bpf-next, add Quentin's tested-by and reviewed-by and
resend, so BPF CI can do another run on it? Thanks.
> >
> >
> > [0] https://docs.python.org/3.12/whatsnew/3.12.html#other-language-changes
> > [1] https://github.com/python/cpython/issues/98401
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] selftests/bpf: clear out Python syntax warnings
2025-01-11 0:23 ` Andrii Nakryiko
@ 2025-01-11 0:31 ` Ariel Otilibili-Anieli
0 siblings, 0 replies; 3+ messages in thread
From: Ariel Otilibili-Anieli @ 2025-01-11 0:31 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Quentin Monnet, bpf, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Shuah Khan, linux-kernel
Hi Andrii,
On Saturday, January 11, 2025 01:23 CET, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
> On Fri, Dec 20, 2024 at 8:28 AM Ariel Otilibili-Anieli
> <Ariel.Otilibili-Anieli@eurecom.fr> wrote:
>
> Seems like this was never applied, right? Ariel, can you please rebase
> on latest bpf-next, add Quentin's tested-by and reviewed-by and
> resend, so BPF CI can do another run on it? Thanks.
>
Thanks for looking onto the patch. From this link, I can tell it was applied on bpf-next. Right?
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=c5d2bac978c5
Regards,
Ariel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-11 0:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20241211220012.714055-1-ariel.otilibili-anieli@eurecom.fr>
[not found] ` <20241211220012.714055-2-ariel.otilibili-anieli@eurecom.fr>
[not found] ` <26180f2e-1ef7-45de-8e9e-f08a4e6a6d36@qmon.net>
2024-12-20 16:28 ` [PATCH 1/1] selftests/bpf: clear out Python syntax warnings Ariel Otilibili-Anieli
2025-01-11 0:23 ` Andrii Nakryiko
2025-01-11 0:31 ` Ariel Otilibili-Anieli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®