From afeb39dd0c1d6e46a4a9231ec2c3d1591f83dd31 Mon Sep 17 00:00:00 2001 From: Jules Maselbas Date: Tue, 7 Feb 2023 17:20:51 +0100 Subject: bbremote: Fix default payload value in BBPacket 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 Link: https://lore.barebox.org/20230207162055.10050-1-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer --- scripts/remote/messages.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') 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): -- cgit v1.2.1