In dealloc(), only close the socket if fd != -1.

This commit is contained in:
Guido van Rossum 2000-04-10 12:45:45 +00:00
parent 7aff6f34fe
commit fa972c987c
1 changed files with 2 additions and 1 deletions

View File

@ -1356,7 +1356,8 @@ static PyMethodDef PySocketSock_methods[] = {
static void
BUILD_FUNC_DEF_1(PySocketSock_dealloc,PySocketSockObject *,s)
{
(void) close(s->sock_fd);
if (s->sock_fd != -1)
(void) close(s->sock_fd);
PyMem_DEL(s);
}