Skip to content

Commit 611a3ea

Browse files
authored
[2.7] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3433)
Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 17c9ac9)
1 parent 82cae7c commit 611a3ea

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ssl.SSLContext() now uses OpenSSL error information when a context cannot be
2+
instantiated.

Modules/_ssl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,8 +2146,7 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
21462146
return NULL;
21472147
}
21482148
if (ctx == NULL) {
2149-
PyErr_SetString(PySSLErrorObject,
2150-
"failed to allocate SSL context");
2149+
_setSSLError(NULL, 0, __FILE__, __LINE__);
21512150
return NULL;
21522151
}
21532152

0 commit comments

Comments
 (0)