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

Skip to content

Commit 65ec8ae

Browse files
committed
Fix (hopefully) the remaining test_ssl buildbot failures
1 parent 467f28d commit 65ec8ae

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Lib/test/test_ssl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def test_ciphers(self):
142142
# Error checking can happen at instantiation or when connecting
143143
with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"):
144144
s = ssl.wrap_socket(socket.socket(socket.AF_INET),
145-
cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx")
145+
cert_reqs=ssl.CERT_NONE, ciphers="xyzzy")
146146
s.connect(remote)
147147

148148
@support.cpython_only
@@ -186,7 +186,7 @@ def test_ciphers(self):
186186
ctx.set_ciphers("ALL")
187187
ctx.set_ciphers("DEFAULT")
188188
with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"):
189-
ctx.set_ciphers("^$:,;?*'dorothyx")
189+
ctx.set_ciphers("xyzzy")
190190

191191
def test_verify(self):
192192
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)

Modules/_ssl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,10 @@ set_ciphers(PySSLContext *self, PyObject *args)
14621462
return NULL;
14631463
ret = SSL_CTX_set_cipher_list(self->ctx, cipherlist);
14641464
if (ret == 0) {
1465+
/* Clearing the error queue is necessary on some OpenSSL versions,
1466+
otherwise the error will be reported again when another SSL call
1467+
is done. */
1468+
ERR_clear_error();
14651469
PyErr_SetString(PySSLErrorObject,
14661470
"No cipher can be selected.");
14671471
return NULL;

0 commit comments

Comments
 (0)