Re: [PATCH 48/50] tests: Modify wpas_ctrl test sets for python3

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

 



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().

johannes


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux