From 0d95bad46af457366ddd7f78f99e56b7177bd9d6 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Wed, 23 Oct 2024 06:48:30 -0700 Subject: [PATCH] correct inheritance for io.StringIO (#12884) --- stdlib/_io.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/_io.pyi b/stdlib/_io.pyi index 8ec10a0b2..2a3ae09f7 100644 --- a/stdlib/_io.pyi +++ b/stdlib/_io.pyi @@ -173,13 +173,15 @@ class TextIOWrapper(TextIOBase, _TextIOBase, TextIO, Generic[_BufferT_co]): # t # operations. def seek(self, cookie: int, whence: int = 0, /) -> int: ... -class StringIO(TextIOWrapper, TextIOBase, _TextIOBase): # type: ignore[misc] # incompatible definitions of write in the base classes +class StringIO(TextIOBase, _TextIOBase, TextIO): # type: ignore[misc] # incompatible definitions of write in the base classes def __init__(self, initial_value: str | None = ..., newline: str | None = ...) -> None: ... # StringIO does not contain a "name" field. This workaround is necessary # to allow StringIO sub-classes to add this field, as it is defined # as a read-only property on IO[]. name: Any def getvalue(self) -> str: ... + @property + def line_buffering(self) -> bool: ... class IncrementalNewlineDecoder: def __init__(self, decoder: codecs.IncrementalDecoder | None, translate: bool, errors: str = ...) -> None: ...