summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDima Tisnek <dimaqq@gmail.com>2020-08-15 17:01:19 (GMT)
committerGitHub <noreply@github.com>2020-08-15 17:01:19 (GMT)
commit495bd035662fda29639f9d52bb6baebea31d72fa (patch)
tree54e403651513c3ac77a15e83ae73d2c369194951 /Modules
parent40e700ad042089120456cc2ee79b8ca69479416b (diff)
downloadcpython-495bd035662fda29639f9d52bb6baebea31d72fa.zip
cpython-495bd035662fda29639f9d52bb6baebea31d72fa.tar.gz
cpython-495bd035662fda29639f9d52bb6baebea31d72fa.tar.bz2
bpo-31122: ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation (GH-18772)
[bpo-31122](): ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation Reproducer: http://tiny.cc/f4ztnz (tiny url because some bot keeps renaming b.p.o.-nnn as bpo links)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ssl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 55a95dd..cb8f04a 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -805,10 +805,11 @@ PySSL_SetError(PySSLSocket *sslsock, int ret, const char *filename, int lineno)
errno = err.c;
return PyErr_SetFromErrno(PyExc_OSError);
}
- Py_INCREF(s);
- s->errorhandler();
- Py_DECREF(s);
- return NULL;
+ else {
+ p = PY_SSL_ERROR_EOF;
+ type = PySSLEOFErrorObject;
+ errstr = "EOF occurred in violation of protocol";
+ }
} else { /* possible? */
p = PY_SSL_ERROR_SYSCALL;
type = PySSLSyscallErrorObject;