Skip to content
Prev Previous commit
Next Next commit
Do not present rustls errors as OSError(0, "Success")
  • Loading branch information
im-0 committed May 21, 2026
commit 7a10b53ba0369d56ef0adebc8b530929079e6937
10 changes: 10 additions & 0 deletions crates/stdlib/src/ssl/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,16 @@ impl SslError {
// Use the proper cert verification error creator
create_ssl_cert_verification_error(vm, &cert_err).expect("unlikely to happen")
}
Self::Io(err) if err.kind() == std::io::ErrorKind::UnexpectedEof => {
create_ssl_eof_error(vm).upcast()
}
Self::Io(err) if err.raw_os_error().is_none() => vm
.new_os_subtype_error(
PySSLError::class(&vm.ctx).to_owned(),
None,
format!("SSL error: {err}"),
)
.upcast(),
Self::Io(err) => err.into_pyexception(vm),
Self::SniCallbackRestart => {
// This should be handled at PySSLSocket level
Expand Down