Skip to content

Commit 52c19bf

Browse files
tempfile.SpooledTemporaryFile: inherit from IOBase on 3.11
python/cpython#29560
1 parent e8b3619 commit 52c19bf

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

stdlib/tempfile.pyi

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import io
12
import os
23
import sys
34
from _typeshed import Self
@@ -219,7 +220,11 @@ class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]):
219220

220221
# It does not actually derive from IO[AnyStr], but it does implement the
221222
# protocol.
222-
class SpooledTemporaryFile(IO[AnyStr]):
223+
if sys.version_info >= (3, 11):
224+
_STFBase = io.IOBase
225+
else:
226+
_STFBase = object
227+
class SpooledTemporaryFile(IO[AnyStr], _STFBase):
223228
@property
224229
def encoding(self) -> str: ... # undocumented
225230
@property
@@ -318,6 +323,13 @@ class SpooledTemporaryFile(IO[AnyStr]):
318323
def fileno(self) -> int: ...
319324
def flush(self) -> None: ...
320325
def isatty(self) -> bool: ...
326+
if sys.version_info >= (3, 11):
327+
def readable(self) -> bool: ...
328+
def read1(self, __size: int = ...) -> AnyStr: ...
329+
def readinto(self, b: WriteableBuffer) -> int: ...
330+
def readinto1(self, b: WriteableBuffer) -> int: ...
331+
def seekable(self) -> bool: ...
332+
321333
def read(self, n: int = ...) -> AnyStr: ...
322334
def readline(self, limit: int = ...) -> AnyStr: ...
323335
def readlines(self, hint: int = ...) -> list[AnyStr]: ...

0 commit comments

Comments
 (0)