bpf_doc: Fix build error with older python versions
PATCH 1/1 bpf_doc: Fix build error with older python versions
+ make -j48 -s -C /dev/shm/kbuild/linux.33946/current ARCH=powerpc HOSTCC=gcc CROSS_COMPILE=powerpc64-suse-linux- clean
TypeError: '_sre.SRE_Match' object is not subscriptable
--- scripts/bpf_doc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/bpf_doc.py +1 -1
@@ -271,7 +271,7 @@ class HeaderParser(object): if capture: fn_defines_str += self.line helper_name = capture.expand(r'bpf_\1') - self.helper_enum_vals[helper_name] = int(capture[2]) + self.helper_enum_vals[helper_name] = int(capture.group(2)) self.helper_enum_pos[helper_name] = i i += 1 else:
Signature · 1 line
2.35.3
2023-01-06 12:40 UTC+0100 ~ Michal Suchanek <[email protected]>
Quoted 15 lines
+ make -j48 -s -C
/dev/shm/kbuild/linux.33946/currentARCH=powerpc HOSTCC=gcc CROSS_COMPILE=powerpc64-suse-linux- clean
TypeError: '_sre.SRE_Match' object is not subscriptableFixes 8a76145a2ec2 ("bpf: explicitly define BPF_FUNC_xxx integer values")Signed-off-by Michal Suchanek <[email protected]>--- scripts/bpf_doc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/bpf_doc.py +0
-0
scripts/bpf_doc.py class HeaderParser(object): · line 277
Quoted 8 lines
scripts/bpf_doc.py +1
-1@@ -271,7 +271,7 @@ class HeaderParser(object): if capture: fn_defines_str += self.line helper_name = capture.expand(r'bpf_\1') - self.helper_enum_vals[helper_name] = int(capture[2]) + self.helper_enum_vals[helper_name] = int(capture.group(2)) self.helper_enum_pos[helper_name] = i i += 1 else:
Thanks, the change looks good.
Would be nice to have a bit more context in the commit log: As I understand, Match objects have been scriptable since Python 3.6 (2016).
Daniel Borkmann
maintainerQuoted 27 lines · Quentin Monnet
2023-01-06 12:40 UTC+0100 ~ Michal Suchanek <[email protected]>
Quoted 15 lines
+ make -j48 -s -C
/dev/shm/kbuild/linux.33946/currentARCH=powerpc HOSTCC=gcc CROSS_COMPILE=powerpc64-suse-linux- clean
TypeError: '_sre.SRE_Match' object is not subscriptableFixes 8a76145a2ec2 ("bpf: explicitly define BPF_FUNC_xxx integer values")Signed-off-by Michal Suchanek <[email protected]>--- scripts/bpf_doc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/bpf_doc.py +0
-0scripts/bpf_doc.py class HeaderParser(object): · line 277
Quoted 8 lines
scripts/bpf_doc.py +1
-1@@ -271,7 +271,7 @@ class HeaderParser(object): if capture: fn_defines_str += self.line helper_name = capture.expand(r'bpf_\1') - self.helper_enum_vals[helper_name] = int(capture[2]) + self.helper_enum_vals[helper_name] = int(capture.group(2)) self.helper_enum_pos[helper_name] = i i += 1 else:Thanks, the change looks good.
Quoted 6 lines
Acked-by Quentin Monnet <[email protected]>Would be nice to have a bit more context in the commit log: As I understand, Match objects have been scriptable since Python 3.6 (2016).
Agree, Michal, could you improve the commit description as it's a bit terse as-is and then resubmit your patch.
Thanks,
Daniel
PATCH 1/1 bpf_doc: Fix build error with older python versions
The ability to subscript match result as an array is only available since python 3.6. Existing code in bpf_doc uses the older group() interface but commit 8a76145a2ec2 adds code using the new interface.
Use the old interface consistently to avoid build error on older distributions like the below:
+ make -j48 -s -C /dev/shm/kbuild/linux.33946/current ARCH=powerpc HOSTCC=gcc CROSS_COMPILE=powerpc64-suse-linux- clean
TypeError: '_sre.SRE_Match' object is not subscriptable
---
v2: Add more details to commit message
--- scripts/bpf_doc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/bpf_doc.py +1 -1
@@ -271,7 +271,7 @@ class HeaderParser(object): if capture: fn_defines_str += self.line helper_name = capture.expand(r'bpf_\1') - self.helper_enum_vals[helper_name] = int(capture[2]) + self.helper_enum_vals[helper_name] = int(capture.group(2)) self.helper_enum_pos[helper_name] = i i += 1 else:
Signature · 1 line
2.35.3
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Quoted 8 lines · On Mon, 9 Jan 2023 12:34:42 +0100 you wrote:
The ability to subscript match result as an array is only available since python 3.6. Existing code in
bpf_docuses the oldergroup()interface but commit8a76145a2ec2adds code using the new interface.Use the old interface consistently to avoid build error on older distributions like the below:
[...]
Here is the summary with links:
- bpf_doc: Fix build error with older python versions
https://git.kernel.org/bpf/bpf-next/c/5fbea42387eb
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html