[New-bugs-announce] [issue10169] socket.sendto raises incorrect exception when passed incorrect types

Jean-Paul Calderone report at bugs.python.org
Thu Oct 21 19:22:08 CEST 2010


New submission from Jean-Paul Calderone <invalid at example.invalid>:

>>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> s.bind(('', 0))
>>> s.sendto(u'hellé', s.getsockname())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: sendto() takes exactly 3 arguments (2 given)
>>> s.sendto(3, s.getsockname())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: sendto() takes exactly 3 arguments (2 given)
>>> s.sendto('hello', s.getsockname())
5

The TypeError gives the wrong explanation for what's wrong.

----------
components: Library (Lib)
messages: 119320
nosy: exarkun
priority: normal
severity: normal
status: open
title: socket.sendto raises incorrect exception when passed incorrect types
type: behavior
versions: Python 2.6, Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10169>
_______________________________________


More information about the New-bugs-announce mailing list