Loosen type of fileobj argument to TarFile.addfile (#12961)

It only seems to need something it can read bytes from, rather than a
full-fledged `IO[bytes]`.
This commit is contained in:
Colin Watson
2024-11-06 14:10:25 +00:00
committed by GitHub
parent 8dd43718bc
commit 1ae7e615c0

View File

@@ -1,7 +1,7 @@
import bz2
import io
import sys
from _typeshed import StrOrBytesPath, StrPath
from _typeshed import StrOrBytesPath, StrPath, SupportsRead
from builtins import list as _list # aliases to avoid name clashes with fields named "type" or "list"
from collections.abc import Callable, Iterable, Iterator, Mapping
from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj
@@ -481,7 +481,7 @@ class TarFile:
*,
filter: Callable[[TarInfo], TarInfo | None] | None = None,
) -> None: ...
def addfile(self, tarinfo: TarInfo, fileobj: IO[bytes] | None = None) -> None: ...
def addfile(self, tarinfo: TarInfo, fileobj: SupportsRead[bytes] | None = None) -> None: ...
def gettarinfo(
self, name: StrOrBytesPath | None = None, arcname: str | None = None, fileobj: IO[bytes] | None = None
) -> TarInfo: ...