Skip to content

Commit d95484a

Browse files
committed
Remove explicit TarInfo type check in ReadTarFS.openbin
1 parent 59d788a commit d95484a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fs/tarfs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,13 @@ def openbin(self, path, mode="r", buffering=-1, **options):
431431
except KeyError:
432432
six.raise_from(errors.ResourceNotFound(path), None)
433433

434-
if not member.isfile():
434+
# TarFile.extractfile returns None if the entry is
435+
# neither a file nor a symlink
436+
reader = self._tar.extractfile(member)
437+
if reader is None:
435438
raise errors.FileExpected(path)
436439

437-
rw = RawWrapper(cast(IO, self._tar.extractfile(member)))
438-
440+
rw = RawWrapper(reader)
439441
if six.PY2: # Patch nonexistent file.flush in Python2
440442

441443
def _flush():

0 commit comments

Comments
 (0)