Mercurial > cpython-lru_cache-weakref
diff Modules/_ssl.c @ 61644:7a7ae476df4f
Merged revisions 81241 via svnmerge from
svn+ssh://pythondev@svn.python.org/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.
........
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sun, 16 May 2010 23:14:22 +0000 |
| parents | a09eb3d59ff7 |
| children | 5ee47f0b26b0 |
line wrap: on
line diff
--- a/Modules/_ssl.c Sun May 16 21:36:37 2010 +0000 +++ b/Modules/_ssl.c Sun May 16 23:14:22 2010 +0000 @@ -205,6 +205,7 @@ 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; @@ -237,6 +238,7 @@ 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); @@ -256,6 +258,7 @@ 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);
