summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ssl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 9ce73cf..5bc2e50 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -199,6 +199,7 @@ PySSL_SetError(PySSLObject *obj, int ret, char *filename, int lineno)
errstr = "EOF occurred in violation of protocol";
} else if (ret == -1) {
/* underlying BIO reported an I/O error */
+ ERR_clear_error();
return s->errorhandler();
} else { /* possible? */
p = PY_SSL_ERROR_SYSCALL;
@@ -231,6 +232,7 @@ PySSL_SetError(PySSLObject *obj, int ret, char *filename, int lineno)
errstr = ERR_error_string(ERR_peek_last_error(), NULL);
}
PyOS_snprintf(buf, sizeof(buf), "_ssl.c:%d: %s", lineno, errstr);
+ ERR_clear_error();
v = Py_BuildValue("(is)", p, buf);
if (v != NULL) {
PyErr_SetObject(PySSLErrorObject, v);
@@ -250,6 +252,7 @@ _setSSLError (char *errstr, int errcode, char *filename, int lineno) {
errstr = ERR_error_string(errcode, NULL);
}
PyOS_snprintf(buf, sizeof(buf), "_ssl.c:%d: %s", lineno, errstr);
+ ERR_clear_error();
v = Py_BuildValue("(is)", errcode, buf);
if (v != NULL) {
PyErr_SetObject(PySSLErrorObject, v);