mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
In dealloc(), only close the socket if fd != -1.
This commit is contained in:
parent
7aff6f34fe
commit
fa972c987c
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue