* [PATCH 0/1] clear out Python syntax warnings
@ 2024-12-11 21:57 Ariel Otilibili
2024-12-11 21:57 ` [PATCH 1/1] selftests/bpf: " Ariel Otilibili
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Ariel Otilibili @ 2024-12-11 21:57 UTC (permalink / raw)
To: bpf
Cc: Ariel Otilibili, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Shuah Khan
Hello,
This is my first patch to the list; your feedback is much appreciated.
I have been using GNU/Linux for more than a decade, and discovered eBPF recently.
Thank you
Ariel Otilibili (1):
selftests/bpf: clear out Python syntax warnings
.../selftests/bpf/test_bpftool_synctypes.py | 28 +++++++++----------
1 file changed, 14 insertions(+), 14 deletions(-)
--
2.47.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/1] selftests/bpf: clear out Python syntax warnings
2024-12-11 21:57 [PATCH 0/1] clear out Python syntax warnings Ariel Otilibili
@ 2024-12-11 21:57 ` Ariel Otilibili
2024-12-20 16:24 ` Quentin Monnet
2024-12-17 21:10 ` [PING] " Ariel Otilibili-Anieli
2024-12-20 17:00 ` [PATCH 0/1] " patchwork-bot+netdevbpf
2 siblings, 1 reply; 8+ messages in thread
From: Ariel Otilibili @ 2024-12-11 21:57 UTC (permalink / raw)
To: bpf
Cc: Ariel Otilibili, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Shuah Khan
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
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>
---
.../selftests/bpf/test_bpftool_synctypes.py | 28 +++++++++----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_bpftool_synctypes.py b/tools/testing/selftests/bpf/test_bpftool_synctypes.py
index 0ed67b6b31dd..238121fda5b6 100755
--- a/tools/testing/selftests/bpf/test_bpftool_synctypes.py
+++ b/tools/testing/selftests/bpf/test_bpftool_synctypes.py
@@ -66,7 +66,7 @@ class ArrayParser(BlockParser):
def __init__(self, reader, array_name):
self.array_name = array_name
- self.start_marker = re.compile(f'(static )?const bool {self.array_name}\[.*\] = {{\n')
+ self.start_marker = re.compile(fr'(static )?const bool {self.array_name}\[.*\] = {{\n')
super().__init__(reader)
def search_block(self):
@@ -80,7 +80,7 @@ class ArrayParser(BlockParser):
Parse a block and return data as a dictionary. Items to extract must be
on separate lines in the file.
"""
- pattern = re.compile('\[(BPF_\w*)\]\s*= (true|false),?$')
+ pattern = re.compile(r'\[(BPF_\w*)\]\s*= (true|false),?$')
entries = set()
while True:
line = self.reader.readline()
@@ -178,7 +178,7 @@ class FileExtractor(object):
@enum_name: name of the enum to parse
"""
start_marker = re.compile(f'enum {enum_name} {{\n')
- pattern = re.compile('^\s*(BPF_\w+),?(\s+/\*.*\*/)?$')
+ pattern = re.compile(r'^\s*(BPF_\w+),?(\s+/\*.*\*/)?$')
end_marker = re.compile('^};')
parser = BlockParser(self.reader)
parser.search_block(start_marker)
@@ -226,8 +226,8 @@ class FileExtractor(object):
@block_name: name of the blog to parse, 'TYPE' in the example
"""
- start_marker = re.compile(f'\*{block_name}\* := {{')
- pattern = re.compile('\*\*([\w/-]+)\*\*')
+ start_marker = re.compile(fr'\*{block_name}\* := {{')
+ pattern = re.compile(r'\*\*([\w/-]+)\*\*')
end_marker = re.compile('}\n')
return self.__get_description_list(start_marker, pattern, end_marker)
@@ -245,8 +245,8 @@ class FileExtractor(object):
@block_name: name of the blog to parse, 'TYPE' in the example
"""
- start_marker = re.compile(f'"\s*{block_name} := {{')
- pattern = re.compile('([\w/]+) [|}]')
+ start_marker = re.compile(fr'"\s*{block_name} := {{')
+ pattern = re.compile(r'([\w/]+) [|}]')
end_marker = re.compile('}')
return self.__get_description_list(start_marker, pattern, end_marker)
@@ -264,8 +264,8 @@ class FileExtractor(object):
@macro: macro starting the block, 'HELP_SPEC_OPTIONS' in the example
"""
- start_marker = re.compile(f'"\s*{macro}\s*" [|}}]')
- pattern = re.compile('([\w-]+) ?(?:\||}[ }\]])')
+ start_marker = re.compile(fr'"\s*{macro}\s*" [|}}]')
+ pattern = re.compile(r'([\w-]+) ?(?:\||}[ }\]])')
end_marker = re.compile('}\\\\n')
return self.__get_description_list(start_marker, pattern, end_marker)
@@ -283,8 +283,8 @@ class FileExtractor(object):
@block_name: name of the blog to parse, 'TYPE' in the example
"""
- start_marker = re.compile(f'local {block_name}=\'')
- pattern = re.compile('(?:.*=\')?([\w/]+)')
+ start_marker = re.compile(fr'local {block_name}=\'')
+ pattern = re.compile(r'(?:.*=\')?([\w/]+)')
end_marker = re.compile('\'$')
return self.__get_description_list(start_marker, pattern, end_marker)
@@ -316,7 +316,7 @@ class MainHeaderFileExtractor(SourceFileExtractor):
{'-p', '-d', '--pretty', '--debug', '--json', '-j'}
"""
start_marker = re.compile(f'"OPTIONS :=')
- pattern = re.compile('([\w-]+) ?(?:\||}[ }\]"])')
+ pattern = re.compile(r'([\w-]+) ?(?:\||}[ }\]"])')
end_marker = re.compile('#define')
parser = InlineListParser(self.reader)
@@ -338,8 +338,8 @@ class ManSubstitutionsExtractor(SourceFileExtractor):
{'-p', '-d', '--pretty', '--debug', '--json', '-j'}
"""
- start_marker = re.compile('\|COMMON_OPTIONS\| replace:: {')
- pattern = re.compile('\*\*([\w/-]+)\*\*')
+ start_marker = re.compile(r'\|COMMON_OPTIONS\| replace:: {')
+ pattern = re.compile(r'\*\*([\w/-]+)\*\*')
end_marker = re.compile('}$')
parser = InlineListParser(self.reader)
--
2.47.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PING] clear out Python syntax warnings
2024-12-11 21:57 [PATCH 0/1] clear out Python syntax warnings Ariel Otilibili
2024-12-11 21:57 ` [PATCH 1/1] selftests/bpf: " Ariel Otilibili
@ 2024-12-17 21:10 ` Ariel Otilibili-Anieli
2024-12-20 17:00 ` [PATCH 0/1] " patchwork-bot+netdevbpf
2 siblings, 0 replies; 8+ messages in thread
From: Ariel Otilibili-Anieli @ 2024-12-17 21:10 UTC (permalink / raw)
To: Ariel Otilibili; +Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
Hello,
Is there any news on the series? I got this warning from patchwork-ci:
https://github.com/kernel-patches/bpf/actions/runs/12379738694/job/34555356286
I am looking forward your feedback,
Ariel
On Wednesday, December 11, 2024 22:57 CET, Ariel Otilibili <ariel.otilibili-anieli@eurecom.fr> wrote:
> Hello,
>
> This is my first patch to the list; your feedback is much appreciated.
>
> I have been using GNU/Linux for more than a decade, and discovered eBPF recently.
>
> Thank you
>
> Ariel Otilibili (1):
> selftests/bpf: clear out Python syntax warnings
>
> .../selftests/bpf/test_bpftool_synctypes.py | 28 +++++++++----------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
> --
> 2.47.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] selftests/bpf: clear out Python syntax warnings
2024-12-11 21:57 ` [PATCH 1/1] selftests/bpf: " Ariel Otilibili
@ 2024-12-20 16:24 ` Quentin Monnet
2024-12-20 16:28 ` Ariel Otilibili-Anieli
0 siblings, 1 reply; 8+ messages in thread
From: Quentin Monnet @ 2024-12-20 16:24 UTC (permalink / raw)
To: Ariel Otilibili, bpf
Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Shuah Khan
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
> 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>
[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] 8+ messages in thread
* Re: [PATCH 1/1] selftests/bpf: clear out Python syntax warnings
2024-12-20 16:24 ` Quentin Monnet
@ 2024-12-20 16:28 ` Ariel Otilibili-Anieli
2025-01-11 0:23 ` Andrii Nakryiko
0 siblings, 1 reply; 8+ 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] 8+ messages in thread
* Re: [PATCH 0/1] clear out Python syntax warnings
2024-12-11 21:57 [PATCH 0/1] clear out Python syntax warnings Ariel Otilibili
2024-12-11 21:57 ` [PATCH 1/1] selftests/bpf: " Ariel Otilibili
2024-12-17 21:10 ` [PING] " Ariel Otilibili-Anieli
@ 2024-12-20 17:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-20 17:00 UTC (permalink / raw)
To: Ariel Otilibili-Anieli
Cc: bpf, ariel.otilibili-anieli, ast, daniel, andrii, shuah
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Wed, 11 Dec 2024 22:57:28 +0100 you wrote:
> Hello,
>
> This is my first patch to the list; your feedback is much appreciated.
>
> I have been using GNU/Linux for more than a decade, and discovered eBPF recently.
>
> Thank you
>
> [...]
Here is the summary with links:
- [1/1] selftests/bpf: clear out Python syntax warnings
https://git.kernel.org/bpf/bpf-next/c/c5d2bac978c5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] selftests/bpf: clear out Python syntax warnings
2024-12-20 16:28 ` Ariel Otilibili-Anieli
@ 2025-01-11 0:23 ` Andrii Nakryiko
2025-01-11 0:31 ` Ariel Otilibili-Anieli
0 siblings, 1 reply; 8+ 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] 8+ 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; 8+ 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] 8+ messages in thread
end of thread, other threads:[~2025-01-11 0:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-11 21:57 [PATCH 0/1] clear out Python syntax warnings Ariel Otilibili
2024-12-11 21:57 ` [PATCH 1/1] selftests/bpf: " Ariel Otilibili
2024-12-20 16:24 ` Quentin Monnet
2024-12-20 16:28 ` Ariel Otilibili-Anieli
2025-01-11 0:23 ` Andrii Nakryiko
2025-01-11 0:31 ` Ariel Otilibili-Anieli
2024-12-17 21:10 ` [PING] " Ariel Otilibili-Anieli
2024-12-20 17:00 ` [PATCH 0/1] " patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox