Skip to content

Commit b196609

Browse files
committed
Assert that returned value is a str
Anything else would be a bug.
1 parent c10ebb7 commit b196609

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def add_input_character(self, e: str) -> None:
179179
)
180180
self.cursor_offset += 1
181181

182-
def readline(self, size: int = -1) -> Union[str, Any]:
182+
def readline(self, size: int = -1) -> str:
183183
if not isinstance(size, int):
184184
raise TypeError(
185185
f"'{type(size).__name__}' object cannot be interpreted as an integer"
@@ -189,6 +189,7 @@ def readline(self, size: int = -1) -> Union[str, Any]:
189189
self.has_focus = True
190190
self.repl.send_to_stdin(self.current_line)
191191
value = self.coderunner.request_from_main_context()
192+
assert isinstance(value, str)
192193
self.readline_results.append(value)
193194
return value if size <= -1 else value[:size]
194195

0 commit comments

Comments
 (0)