Issue 10169: socket.sendto raises incorrect exception when passed incorrect types (original) (raw)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind(('', 0)) s.sendto(u'hellé', s.getsockname()) Traceback (most recent call last): File "", line 1, in TypeError: sendto() takes exactly 3 arguments (2 given) s.sendto(3, s.getsockname()) Traceback (most recent call last): File "", line 1, in TypeError: sendto() takes exactly 3 arguments (2 given) s.sendto('hello', s.getsockname()) 5
The TypeError gives the wrong explanation for what's wrong.