Skip to content

Commit

Permalink
Loosen type of fileobj argument to TarFile.addfile (#12961)
Browse files Browse the repository at this point in the history
It only seems to need something it can read bytes from, rather than a
full-fledged `IO[bytes]`.
  • Loading branch information
cjwatson authored Nov 6, 2024
1 parent 8dd4371 commit 1ae7e61
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/tarfile.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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: ...
Expand Down

0 comments on commit 1ae7e61

Please sign in to comment.