From fa972c987c394507ca6fb76de5ef0b47e9301226 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 10 Apr 2000 12:45:45 +0000 Subject: In dealloc(), only close the socket if fd != -1. --- Modules/socketmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index bc8c9ae..b96ba65 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -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); } -- cgit v0.12