]> granicus.if.org Git - python/commitdiff
Fix (hopefully) the remaining test_ssl buildbot failures
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 16 May 2010 19:56:32 +0000 (19:56 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 16 May 2010 19:56:32 +0000 (19:56 +0000)
Lib/test/test_ssl.py
Modules/_ssl.c

index 6cd3a5e6d9b46c83ac1a9523974551471b2ee562..36ed3aa91246dd9ae2c63b09bfbb301ee2d6a365 100644 (file)
@@ -142,7 +142,7 @@ class BasicSocketTests(unittest.TestCase):
         # Error checking can happen at instantiation or when connecting
         with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"):
             s = ssl.wrap_socket(socket.socket(socket.AF_INET),
-                                cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx")
+                                cert_reqs=ssl.CERT_NONE, ciphers="xyzzy")
             s.connect(remote)
 
     @support.cpython_only
@@ -186,7 +186,7 @@ class ContextTests(unittest.TestCase):
         ctx.set_ciphers("ALL")
         ctx.set_ciphers("DEFAULT")
         with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"):
-            ctx.set_ciphers("^$:,;?*'dorothyx")
+            ctx.set_ciphers("xyzzy")
 
     def test_verify(self):
         ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
index 96d79b31333a69426a66c234d785af137d6391f5..39fec7b669707f940b6c24eaee775f659f59fa15 100644 (file)
@@ -1462,6 +1462,10 @@ set_ciphers(PySSLContext *self, PyObject *args)
         return NULL;
     ret = SSL_CTX_set_cipher_list(self->ctx, cipherlist);
     if (ret == 0) {
+        /* Clearing the error queue is necessary on some OpenSSL versions,
+           otherwise the error will be reported again when another SSL call
+           is done. */
+        ERR_clear_error();
         PyErr_SetString(PySSLErrorObject,
                         "No cipher can be selected.");
         return NULL;