From ffa29f579e0b4731fa36a4d20bf9dbe3c21a84b0 Mon Sep 17 00:00:00 2001 From: Thomas Buckley-Houston Date: Sat, 14 Sep 2024 10:49:25 -0300 Subject: [PATCH] fix: use `BinaryIO` not `TextIO` in `start_io()` Although this is strictly an API change, I think it's actually just a fix because passing an actual `TextIO` object causes an error. Fixes: #496 --- pygls/server.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pygls/server.py b/pygls/server.py index d82b8874..da693d8a 100644 --- a/pygls/server.py +++ b/pygls/server.py @@ -23,7 +23,7 @@ import sys from concurrent.futures import ThreadPoolExecutor from threading import Event -from typing import Any, Callable, Optional, TextIO, Type, TypeVar, Union +from typing import Any, BinaryIO, Callable, Optional, Type, TypeVar, Union import cattrs from pygls import IS_PYODIDE @@ -231,7 +231,9 @@ def report_server_error(self, error: Exception, source: ServerErrors): """Default error reporter.""" logger.error("%s", error) - def start_io(self, stdin: Optional[TextIO] = None, stdout: Optional[TextIO] = None): + def start_io( + self, stdin: Optional[BinaryIO] = None, stdout: Optional[BinaryIO] = None + ): """Starts IO server.""" logger.info("Starting IO server")