Make mypy 1.11 happy

This commit is contained in:
Kovid Goyal
2024-07-20 10:15:01 +05:30
parent 681a2b7b28
commit ae8da889c4
3 changed files with 11 additions and 7 deletions

View File

@@ -48,10 +48,12 @@ def setup_debug_print() -> bool:
def send_to_kitten(x: Any) -> None:
f = sys.__stdout__
assert f is not None
try:
sys.__stdout__.buffer.write(json.dumps(x).encode())
sys.__stdout__.buffer.write(b'\n')
sys.__stdout__.buffer.flush()
f.buffer.write(json.dumps(x).encode())
f.buffer.write(b'\n')
f.buffer.flush()
except BrokenPipeError:
raise SystemExit('Pipe to kitten was broken while sending data to it')