[PATCH v3 1/5] bbremote: Fix default payload value in BBPacket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux