Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In :mod:`ssl`, system call failures that OpenSSL reports using
``ERR_LIB_SYS`` are now raised as :exc:`OSError`.
10 changes: 10 additions & 0 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,11 @@ PySSL_SetError(PySSLSocket *sslsock, const char *filename, int lineno)
ERR_GET_REASON(e) == SSL_R_CERTIFICATE_VERIFY_FAILED) {
type = state->PySSLCertVerificationErrorObject;
}
if (ERR_GET_LIB(e) == ERR_LIB_SYS) {
// A system error is being reported; reason is set to errno
errno = ERR_GET_REASON(e);
return PyErr_SetFromErrno(PyExc_OSError);
}
p = PY_SSL_ERROR_SYSCALL;
}
break;
Expand All @@ -686,6 +691,11 @@ PySSL_SetError(PySSLSocket *sslsock, const char *filename, int lineno)
errstr = "EOF occurred in violation of protocol";
}
#endif
if (ERR_GET_LIB(e) == ERR_LIB_SYS) {
// A system error is being reported; reason is set to errno
errno = ERR_GET_REASON(e);
return PyErr_SetFromErrno(PyExc_OSError);
}
break;
}
default:
Expand Down
Loading