[Python-Dev] Now test_socket fails
Tim Peters
tim.one@comcast.net
Wed, 31 Jul 2002 13:44:50 -0400
[Michael Gilfix]
> I'm pretty sure that qualifies as a bug. The problem exists on linux
> as well (as a fresh cvs update has shown). In general though, the
> socket call should always take the two arguments.
>
> It seems at one point that the 2.3 version of the socket module
> accepted erroneously just a socket() call, while 2.2 does not. It seems
> Guido added these lines to integrate default timeout testing. If someone
> with write priveleges can just fix that to read:
>
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>
> that should fix the problem.
I'll leave this to you and Guido. The test works fine on Windows now. The
docstring for _socket.socket claims that all arguments are optional. The
code matches the docs:
sock_initobj(PyObject *self, PyObject *args, PyObject *kwds)
{
PySocketSockObject *s = (PySocketSockObject *)self;
SOCKET_T fd;
int family = AF_INET, type = SOCK_STREAM, proto = 0;
static char *keywords[] = {"family", "type", "proto", 0};
ALL ARGS ARE OPTIONAL HERE
if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|iii:socket", keywords,
&family, &type, &proto))
return -1;
Py_BEGIN_ALLOW_THREADS
fd = socket(family, type, proto);
Py_END_ALLOW_THREADS