diff options
author | Guido van Rossum <guido@python.org> | 2000-04-10 12:45:45 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-04-10 12:45:45 (GMT) |
commit | fa972c987c394507ca6fb76de5ef0b47e9301226 (patch) | |
tree | 5f50005e82d6facf6ac23ae94daebd1e23380bb8 | |
parent | 7aff6f34fe5af475dae2228402b849a5557dd53d (diff) | |
download | cpython-fa972c987c394507ca6fb76de5ef0b47e9301226.zip cpython-fa972c987c394507ca6fb76de5ef0b47e9301226.tar.gz cpython-fa972c987c394507ca6fb76de5ef0b47e9301226.tar.bz2 |
In dealloc(), only close the socket if fd != -1.
-rw-r--r-- | Modules/socketmodule.c | 3 |
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); } |