Skip to content

Commit 7df7231

Browse files
kuba-moodavem330
authored andcommitted
tools: ynl: move the new line in NlMsg __repr__
We add the new line even if message has no error or extack, which leads to print(nl_msg) ending with two new lines. Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b206acf commit 7df7231

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/net/ynl/lib/ynl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,11 @@ def cmd(self):
213213
return self.nl_type
214214

215215
def __repr__(self):
216-
msg = f"nl_len = {self.nl_len} ({len(self.raw)}) nl_flags = 0x{self.nl_flags:x} nl_type = {self.nl_type}\n"
216+
msg = f"nl_len = {self.nl_len} ({len(self.raw)}) nl_flags = 0x{self.nl_flags:x} nl_type = {self.nl_type}"
217217
if self.error:
218-
msg += '\terror: ' + str(self.error)
218+
msg += '\n\terror: ' + str(self.error)
219219
if self.extack:
220-
msg += '\textack: ' + repr(self.extack)
220+
msg += '\n\textack: ' + repr(self.extack)
221221
return msg
222222

223223

0 commit comments

Comments
 (0)