[Python-Dev] Re: PyArg_ParseTuple

Walter Dörwald walter@livinglogic.de
Wed, 09 Jan 2002 17:02:13 +0100


Guido van Rossum wrote:

> [...]
> No, you should test for PyTuple_Check before calling
> PyArg_ParseTuple.  Why do you think it's called that?
> 
> The other problem with this use, alas, is that when it catches a
> legitimate error, the error it reports is confusing if you don't
> change it.  Example:
> 
> 
>>>>from socket import *
>>>>s = socket(AF_INET, SOCK_STREAM)
>>>>s.bind(())
>>>>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: getsockaddrarg() takes exactly 2 arguments (0 given)


This should be fixed by using ;error message in the format string.

Bye,
    Walter Dörwald