Skip to content

Commit 081e8df

Browse files
committed
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. Fixes: f036d93 ("tools: ynl: Add fixed-header support to ynl") Reviewed-by: Simon Horman <simon.horman@corigine.com> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Tested-by: Donald Hunter <donald.hunter@gmail.com> Link: https://lore.kernel.org/r/20230524170712.2036128-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 31642e7 commit 081e8df

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/net/ynl/lib/ynl.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,9 @@ def _op(self, method, vals, dump=False):
591591
print('Unexpected message: ' + repr(gm))
592592
continue
593593

594-
rsp.append(self._decode(gm.raw_attrs, op.attr_set.name)
595-
| gm.fixed_header_attrs)
594+
rsp_msg = self._decode(gm.raw_attrs, op.attr_set.name)
595+
rsp_msg.update(gm.fixed_header_attrs)
596+
rsp.append(rsp_msg)
596597

597598
if not rsp:
598599
return None

0 commit comments

Comments
 (0)