[New-bugs-announce] [issue26440] tarfile._FileInFile.seekable is broken in stream mode
Bill Lee
report at bugs.python.org
Thu Feb 25 11:49:19 EST 2016
New submission from Bill Lee:
Description
===========
With a file object, retrieved by the `extractfile` method of a TarFile object opened in stream mode, calling its `seekable` method will raise an AttributeError.
How to Reproduce
================
cat > seekable.py << EOF
import sys
import tarfile
tar = tarfile.open(fileobj=sys.stdin.buffer, mode='r|')
contentFile = tar.extractfile(tar.next())
print(contentFile.seekable())
EOF
tar -cf test.tar seekable.py
python seekable.py < test.tar
Traceback
=========
Traceback (most recent call last):
File "seekable.py", line 5, in <module>
print(contentFile.seekable())
File "/usr/local/lib/python3.5/tarfile.py", line 649, in seekable
return self.fileobj.seekable()
How to Fix
==========
I think that adding a method seekable(), which always return False, to tarfile._Stream will works.
----------
components: Library (Lib)
messages: 260866
nosy: Bill Lee
priority: normal
severity: normal
status: open
title: tarfile._FileInFile.seekable is broken in stream mode
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26440>
_______________________________________
More information about the New-bugs-announce
mailing list