From: Christian Heimes Date: Thu, 7 Sep 2017 23:45:07 +0000 (-0700) Subject: [2.7] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3433) X-Git-Tag: v2.7.15rc1~212 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=611a3eab194dfd0a54e541e8e8547051df24bcfc;p=python [2.7] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3433) Signed-off-by: Christian Heimes (cherry picked from commit 17c9ac9) --- 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 0000000000..eb4e206be3 --- /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 761554a782..5b4cec203a 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2146,8 +2146,7 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } if (ctx == NULL) { - PyErr_SetString(PySSLErrorObject, - "failed to allocate SSL context"); + _setSSLError(NULL, 0, __FILE__, __LINE__); return NULL; }