All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] tools: ynl: avoid dict errors on older Python versions
@ 2023-05-24 17:07 Jakub Kicinski
  2023-05-25  8:29 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2023-05-24 17:07 UTC (permalink / raw)
  To: davem; +Cc: netdev, edumazet, pabeni, Jakub Kicinski, donald.hunter

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 <kuba@kernel.org>
---
CC: donald.hunter@gmail.com

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(-)

diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
index 39a2296c0003..7c7a54d6841c 100644
--- a/tools/net/ynl/lib/ynl.py
+++ b/tools/net/ynl/lib/ynl.py
@@ -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
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] tools: ynl: avoid dict errors on older Python versions
  2023-05-24 17:07 [PATCH net] tools: ynl: avoid dict errors on older Python versions Jakub Kicinski
@ 2023-05-25  8:29 ` Simon Horman
  2023-05-25 10:45 ` Donald Hunter
  2023-05-26  4:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2023-05-25  8:29 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, donald.hunter

On Wed, May 24, 2023 at 10:07:12AM -0700, Jakub Kicinski 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'
> 
> Use older syntax. Tested with non-legacy families only.
> 
> Fixes: f036d936ca57 ("tools: ynl: Add fixed-header support to ynl")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] tools: ynl: avoid dict errors on older Python versions
  2023-05-24 17:07 [PATCH net] tools: ynl: avoid dict errors on older Python versions Jakub Kicinski
  2023-05-25  8:29 ` Simon Horman
@ 2023-05-25 10:45 ` Donald Hunter
  2023-05-26  4:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Donald Hunter @ 2023-05-25 10:45 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni

Jakub Kicinski <kuba@kernel.org> writes:

> 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 <kuba@kernel.org>
> ---
> CC: donald.hunter@gmail.com
>
> 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.

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Tested-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] tools: ynl: avoid dict errors on older Python versions
  2023-05-24 17:07 [PATCH net] tools: ynl: avoid dict errors on older Python versions Jakub Kicinski
  2023-05-25  8:29 ` Simon Horman
  2023-05-25 10:45 ` Donald Hunter
@ 2023-05-26  4:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-05-26  4:10 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, donald.hunter

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-26  4:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24 17:07 [PATCH net] tools: ynl: avoid dict errors on older Python versions Jakub Kicinski
2023-05-25  8:29 ` Simon Horman
2023-05-25 10:45 ` Donald Hunter
2023-05-26  4:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.