Skip to content

Commit

Permalink
Added _compat typing.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBackx committed Nov 9, 2024
1 parent 8d3eabd commit 63db9af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/click/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,14 @@ def auto_wrap_for_ansi(stream: t.TextIO, color: bool | None = None) -> t.TextIO:
rv = t.cast(t.TextIO, ansi_wrapper.stream)
_write = rv.write

def _safe_write(s):
def _safe_write(s: str) -> int:
try:
return _write(s)
except BaseException:
ansi_wrapper.reset_all()
raise

rv.write = _safe_write
rv.write = _safe_write # type: ignore[method-assign]

try:
_ansi_stream_wrappers[stream] = rv
Expand Down

0 comments on commit 63db9af

Please sign in to comment.