Commit fa972c98 authored by Guido van Rossum's avatar Guido van Rossum

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

parent 7aff6f34
...@@ -1356,7 +1356,8 @@ static PyMethodDef PySocketSock_methods[] = { ...@@ -1356,7 +1356,8 @@ static PyMethodDef PySocketSock_methods[] = {
static void static void
BUILD_FUNC_DEF_1(PySocketSock_dealloc,PySocketSockObject *,s) 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); PyMem_DEL(s);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment