Skip to content

Commit 6c99b65

Browse files
authored
[3.6] bpo-28958: Improve SSLContext error reporting. (GH-3414) (#3432)
Signed-off-by: Christian Heimes <[email protected]> (cherry picked from commit 17c9ac9)
1 parent fb4c28c commit 6c99b65

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
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
@@ -2643,8 +2643,7 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
26432643
return NULL;
26442644
}
26452645
if (ctx == NULL) {
2646-
PyErr_SetString(PySSLErrorObject,
2647-
"failed to allocate SSL context");
2646+
_setSSLError(NULL, 0, __FILE__, __LINE__);
26482647
return NULL;
26492648
}
26502649

0 commit comments

Comments
 (0)