Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d74b42

Browse files
committed
Merged revisions 81241 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r81241 | antoine.pitrou | 2010-05-17 01:11:46 +0200 (lun., 17 mai 2010) | 4 lines Clear the OpenSSL error queue each time an error is signalled. When the error queue is not emptied, strange things can happen on the next SSL call, depending on the OpenSSL version. ........
1 parent f9faaad commit 9d74b42

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Modules/_ssl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ PySSL_SetError(PySSLSocket *obj, int ret, char *filename, int lineno)
205205
errstr = "EOF occurred in violation of protocol";
206206
} else if (ret == -1) {
207207
/* underlying BIO reported an I/O error */
208+
ERR_clear_error();
208209
return s->errorhandler();
209210
} else { /* possible? */
210211
p = PY_SSL_ERROR_SYSCALL;
@@ -237,6 +238,7 @@ PySSL_SetError(PySSLSocket *obj, int ret, char *filename, int lineno)
237238
errstr = ERR_error_string(ERR_peek_last_error(), NULL);
238239
}
239240
PyOS_snprintf(buf, sizeof(buf), "_ssl.c:%d: %s", lineno, errstr);
241+
ERR_clear_error();
240242
v = Py_BuildValue("(is)", p, buf);
241243
if (v != NULL) {
242244
PyErr_SetObject(PySSLErrorObject, v);
@@ -256,6 +258,7 @@ _setSSLError (char *errstr, int errcode, char *filename, int lineno) {
256258
errstr = ERR_error_string(errcode, NULL);
257259
}
258260
PyOS_snprintf(buf, sizeof(buf), "_ssl.c:%d: %s", lineno, errstr);
261+
ERR_clear_error();
259262
v = Py_BuildValue("(is)", errcode, buf);
260263
if (v != NULL) {
261264
PyErr_SetObject(PySSLErrorObject, v);

0 commit comments

Comments
 (0)