tools: ynl: avoid dict errors on older Python versions
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 tools: ynl: avoid dict errors on older Python versions
Python 3.9.0 or newer supports combining dicts() with |, but older versions of Python are still used in the wild (e.g. on CentOS 8, which goes EoL May 31, 2024). With Python 3.6.8 we get:
TypeError: unsupported operand type(s) for |: 'dict' and 'dict'
Use older syntax. Tested with non-legacy families only.
---
CC: [email protected]
This is arguably not a fix, but those trying YNL on 6.4 will likely appreciate not running into the problem.
--- tools/net/ynl/lib/ynl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/net/ynl/lib/ynl.py +3 -2
@@ -578,8 +578,9 @@ genl_family_name_to_id = None print('Unexpected message: ' + repr(gm)) continue - rsp.append(self._decode(gm.raw_attrs, op.attr_set.name) - | gm.fixed_header_attrs) + rsp_msg = self._decode(gm.raw_attrs, op.attr_set.name) + rsp_msg.update(gm.fixed_header_attrs) + rsp.append(rsp_msg) if not rsp: return None
Signature · 1 line
2.40.1
Quoted 11 lines · Jakub Kicinski
Python 3.9.0 or newer supports combining
dicts()with |, but older versions of Python are still used in the wild (e.g. on CentOS 8, which goes EoL May 31, 2024). With Python 3.6.8 we get:TypeError: unsupported operand type(s) for |: 'dict' and 'dict'
Use older syntax. Tested with non-legacy families only.
Fixes f036d936ca57 ("tools: ynl: Add fixed-header support to ynl")Signed-off-by Jakub Kicinski <[email protected]>
Quoted 9 lines · Jakub Kicinski
Python 3.9.0 or newer supports combining
dicts()with |, but older versions of Python are still used in the wild (e.g. on CentOS 8, which goes EoL May 31, 2024). With Python 3.6.8 we get:TypeError: unsupported operand type(s) for |: 'dict' and 'dict'
Use older syntax. Tested with non-legacy families only.
Quoted 7 lines
Fixes f036d936ca57 ("tools: ynl: Add fixed-header support to ynl")Signed-off-by Jakub Kicinski <[email protected]>---
CC: [email protected]This is arguably not a fix, but those trying YNL on 6.4 will likely appreciate not running into the problem.
I just hit the issue on Ubuntu on a BF2 so thank you for getting a fix out before me! Tested with ovs_datapath.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 24 May 2023 10:07:12 -0700 you wrote:
Python 3.9.0 or newer supports combining
dicts()with |, but older versions of Python are still used in the wild (e.g. on CentOS 8, which goes EoL May 31, 2024). With Python 3.6.8 we get:TypeError: unsupported operand type(s) for |: 'dict' and 'dict'
[...]
Here is the summary with links:
- [net] tools: ynl: avoid dict errors on older Python versions
https://git.kernel.org/netdev/net/c/081e8df68199
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html