summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-07-04 14:20:06 (GMT)
committerGitHub <noreply@github.com>2017-07-04 14:20:06 (GMT)
commit67e1478dba6efe60b8e1890192014b8b06dd6bd9 (patch)
treed40e51acd43996f22a3dbbe31e9aa71036d342c1 /Modules
parent378ebb6578b9d709f38b888d23874c0b18125249 (diff)
downloadcpython-67e1478dba6efe60b8e1890192014b8b06dd6bd9.zip
cpython-67e1478dba6efe60b8e1890192014b8b06dd6bd9.tar.gz
cpython-67e1478dba6efe60b8e1890192014b8b06dd6bd9.tar.bz2
bpo-30319: socket.close() now ignores ECONNRESET (#2565)
socket.close() was modified in Python 3.6 to raise OSError on failure: see bpo-26685.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index a1d829f..e18dd32 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2696,7 +2696,9 @@ sock_close(PySocketSockObject *s)
Py_BEGIN_ALLOW_THREADS
res = SOCKETCLOSE(fd);
Py_END_ALLOW_THREADS
- if (res < 0) {
+ /* bpo-30319: The peer can already have closed the connection.
+ Python ignores ECONNRESET on close(). */
+ if (res < 0 && errno != ECONNRESET) {
return s->errorhandler();
}
}