Skip to content

Commit

Permalink
Fixed TypeError when TLS handshake fails with truststore SSLContext
Browse files Browse the repository at this point in the history
Fixes #795.
  • Loading branch information
agronholm committed Oct 2, 2024
1 parent 63af371 commit 7788b12
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/anyio/streams/tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,8 @@ async def _call_sslobject_method(
except ssl.SSLError as exc:
self._read_bio.write_eof()
self._write_bio.write_eof()
if (
isinstance(exc, ssl.SSLEOFError)
or "UNEXPECTED_EOF_WHILE_READING" in exc.strerror
if isinstance(exc, ssl.SSLEOFError) or (
exc.strerror and "UNEXPECTED_EOF_WHILE_READING" in exc.strerror
):
if self.standard_compatible:
raise BrokenResourceError from exc
Expand Down

0 comments on commit 7788b12

Please sign in to comment.