On 2019/02/04 4:02, Johannes Berg wrote:
Ok, that's no fun. However, why not make them take both? We can always assume bytes inside the function, and do something like if isinstance(query, str): query = query.encode('ascii') That way, tests that actually just use plain arguments need no modifications at all, but tests that deal with binascii or similar things that takes bytes can be converted completely to bytes and not have .decode()/.encode() sprinkled over them.
I can modify wpaspy.py to toke both. Almost cases works fine. Though, ap_wpa2_eap_ttls_mschapv2_utf8 fails. Because it includes non printable SSID. So it is recognized as non-string. def request(self, cmd, timeout=10): if isinstance(cmd, str): if self.udp: self.s.sendto(self.cookie + cmd.encode(), self.sockaddr) else: # we specify utf-8 for utf-8 SSID self.s.send(cmd.encode('utf-8')) else: if self.udp: self.s.sendto(self.cookie + cmd, self.sockaddr) else: self.s.send(cmd) Masashi Honma. _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap