summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-05-16 23:14:34 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-05-16 23:14:34 (GMT)
commitb6e3e3ab928ac9f3410793f77d1b3e1cce5ac1a9 (patch)
tree8f8c3d4a1af16a76bb0c52e154747255fe299e8c /Modules
parentec0a3886cac040166dfd144f3e36142f6492b829 (diff)
downloadcpython-b6e3e3ab928ac9f3410793f77d1b3e1cce5ac1a9.zip
cpython-b6e3e3ab928ac9f3410793f77d1b3e1cce5ac1a9.tar.gz
cpython-b6e3e3ab928ac9f3410793f77d1b3e1cce5ac1a9.tar.bz2
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. ........
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 ff634d6..c02703d 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -196,6 +196,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 obj->Socket->errorhandler();
} else { /* possible? */
p = PY_SSL_ERROR_SYSCALL;
@@ -228,6 +229,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);
@@ -247,6 +249,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);