mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +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,6 +1356,7 @@ static PyMethodDef PySocketSock_methods[] = {
|
||||||
static void
|
static void
|
||||||
BUILD_FUNC_DEF_1(PySocketSock_dealloc,PySocketSockObject *,s)
|
BUILD_FUNC_DEF_1(PySocketSock_dealloc,PySocketSockObject *,s)
|
||||||
{
|
{
|
||||||
|
if (s->sock_fd != -1)
|
||||||
(void) close(s->sock_fd);
|
(void) close(s->sock_fd);
|
||||||
PyMem_DEL(s);
|
PyMem_DEL(s);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue