mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v3 1/5] bbremote: Fix default payload value in BBPacket
@ 2023-02-07 16:20 Jules Maselbas
  2023-02-07 16:20 ` [PATCH v3 2/5] bbremote: Fix RATP handshake, errata #7321 for RFC916 Jules Maselbas
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jules Maselbas @ 2023-02-07 16:20 UTC (permalink / raw)
  To: barebox; +Cc: Jules Maselbas

The payload variable is expected to typeof bytes, however the default
value in BBPacket contructor is of type str, a simple way to declare
a byte literal in Python is to prefix the string literal with `b`.

Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
 scripts/remote/messages.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/remote/messages.py b/scripts/remote/messages.py
index 76cccad393..de15e72ed5 100644
--- a/scripts/remote/messages.py
+++ b/scripts/remote/messages.py
@@ -35,12 +35,13 @@ class BBType(object):
 
 
 class BBPacket(object):
-    def __init__(self, p_type=0, p_flags=0, payload="", raw=None):
+    def __init__(self, p_type=0, p_flags=0, payload=b"", raw=None):
         self.p_type = p_type
         self.p_flags = p_flags
         if raw is not None:
             self.unpack(raw)
         else:
+            assert isinstance(payload, bytes)
             self.payload = payload
 
     def __repr__(self):
-- 
2.17.1




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

end of thread, other threads:[~2023-02-13  9:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 16:20 [PATCH v3 1/5] bbremote: Fix default payload value in BBPacket Jules Maselbas
2023-02-07 16:20 ` [PATCH v3 2/5] bbremote: Fix RATP handshake, errata #7321 for RFC916 Jules Maselbas
2023-02-07 16:20 ` [PATCH v3 3/5] ratp: Fix retransmission for header-only packets Jules Maselbas
2023-02-07 16:20 ` [PATCH v3 4/5] ratp: Increase the establish timeout to 1sec Jules Maselbas
2023-02-07 16:20 ` [PATCH v3 5/5] ratp: Increase the initial RTO to 200ms Jules Maselbas
2023-02-13  9:11 ` [PATCH v3 1/5] bbremote: Fix default payload value in BBPacket Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox