[Python-checkins] [3.6] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3432)

Christian Heimes webhook-mailer at python.org
Thu Sep 7 19:45:42 EDT 2017


https://github.com/python/cpython/commit/6c99b652f7909f86753b9e567ea18c95ee736e83
commit: 6c99b652f7909f86753b9e567ea18c95ee736e83
branch: 3.6
author: Christian Heimes <christian at python.org>
committer: GitHub <noreply at github.com>
date: 2017-09-07T16:45:39-07:00
summary:

[3.6] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3432)

Signed-off-by: Christian Heimes <christian at python.org>
(cherry picked from commit 17c9ac9)

files:
A Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst
M Modules/_ssl.c

diff --git a/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst b/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst
new file mode 100644
index 00000000000..eb4e206be37
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2017-09-06-19-41-01.bpo-28958.x4-K5F.rst
@@ -0,0 +1,2 @@
+ssl.SSLContext() now uses OpenSSL error information when a context cannot be
+instantiated.
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 25fb8090f43..ab30d212b9d 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2643,8 +2643,7 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
         return NULL;
     }
     if (ctx == NULL) {
-        PyErr_SetString(PySSLErrorObject,
-                        "failed to allocate SSL context");
+        _setSSLError(NULL, 0, __FILE__, __LINE__);
         return NULL;
     }
 



More information about the Python-checkins mailing list