There was an error while loading. Please reload this page.
1 parent 23e2c3d commit 580cd5cCopy full SHA for 580cd5c
2 files changed
Misc/NEWS.d/next/Library/2017-07-04-13-48-21.bpo-30319.hg_3TX.rst
@@ -0,0 +1 @@
1
+socket.close() now ignores ECONNRESET error.
Modules/socketmodule.c
@@ -2704,7 +2704,9 @@ sock_close(PySocketSockObject *s)
2704
Py_BEGIN_ALLOW_THREADS
2705
res = SOCKETCLOSE(fd);
2706
Py_END_ALLOW_THREADS
2707
- if (res < 0) {
+ /* bpo-30319: The peer can already have closed the connection.
2708
+ Python ignores ECONNRESET on close(). */
2709
+ if (res < 0 && errno != ECONNRESET) {
2710
return s->errorhandler();
2711
}
2712
0 commit comments