mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Don't close an already closed socket.
This commit is contained in:
parent
9b0581192d
commit
084814624d
1 changed files with 5 additions and 3 deletions
|
@ -610,9 +610,11 @@ BUILD_FUNC_DEF_2(PySocketSock_close,PySocketSockObject *,s, PyObject *,args)
|
|||
{
|
||||
if (!PyArg_NoArgs(args))
|
||||
return NULL;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
(void) close(s->sock_fd);
|
||||
Py_END_ALLOW_THREADS
|
||||
if (s->sock_fd != -1) {
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
(void) close(s->sock_fd);
|
||||
Py_END_ALLOW_THREADS
|
||||
}
|
||||
s->sock_fd = -1;
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue