diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-05-16 23:18:00 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-05-16 23:18:00 (GMT) |
commit | 321257da1aa3bbc16be9f6a9a9205878e99aa545 (patch) | |
tree | f22360c1f6a2bb75f1a7530e98556599bcdcd90a | |
parent | 49c78a6b32b7d056d457ec88bbe18b130141ce5e (diff) | |
download | cpython-321257da1aa3bbc16be9f6a9a9205878e99aa545.zip cpython-321257da1aa3bbc16be9f6a9a9205878e99aa545.tar.gz cpython-321257da1aa3bbc16be9f6a9a9205878e99aa545.tar.bz2 |
Merged revisions 81242 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r81242 | antoine.pitrou | 2010-05-17 01:14:22 +0200 (lun., 17 mai 2010) | 10 lines
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.
........
................
-rw-r--r-- | Modules/_ssl.c | 3 |
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); |