Skip to content

Commit

Permalink
fix: use BinaryIO not TextIO in start_io()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tombh committed Sep 14, 2024
1 parent 9cf066a commit ffa29f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pygls/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit ffa29f5

Please sign in to comment.