On 2019/01/26 5:37, Johannes Berg wrote:
On Thu, 2019-01-24 at 16:46 +0900, Masashi Honma wrote:
+ s.send("ATTACH".encode())
like I said before, b"ATTACH" should work here
+ res = s.recv(100).decode()
if "OK" not in res:
raise Exception("Could not attach a test socket")
But I meant to comment on this - this could also be instead
res = s.recv(100)
- if "OK" not in res:
+ if b"OK" not in res:
since we don't use res for anything else.
And that's really true for many of the cases where you've used
.decode(), like here in the same patch:
+ if "OK" not in dev[0].request("SET disallow_aps ssid " + binascii.hexlify("test".encode()).decode()):
could just be
if b"OK" not in dev[0].request(b"SET disallow_aps ssid " + binascii.hexlify(b"test")):
if we change request() to return the bytes() instead of unicode()/str().
Yes, all of that means sprinkling b"" all over the place, but that still
seems better than all the sprinkling of .decode()/.encode().
Using b'xxx' if possible is OK.
Though not for all places.
Masashi Honma.
_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap