summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-04-10 12:45:45 (GMT)
committerGuido van Rossum <guido@python.org>2000-04-10 12:45:45 (GMT)
commitfa972c987c394507ca6fb76de5ef0b47e9301226 (patch)
tree5f50005e82d6facf6ac23ae94daebd1e23380bb8
parent7aff6f34fe5af475dae2228402b849a5557dd53d (diff)
downloadcpython-fa972c987c394507ca6fb76de5ef0b47e9301226.zip
cpython-fa972c987c394507ca6fb76de5ef0b47e9301226.tar.gz
cpython-fa972c987c394507ca6fb76de5ef0b47e9301226.tar.bz2
In dealloc(), only close the socket if fd != -1.
-rw-r--r--Modules/socketmodule.c3
1 files changed, 2 insertions, 1 deletions
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);
}