[issue13815] tarfile.ExFileObject can't be wrapped using io.TextIOWrapper

Amaury Forgeot d'Arc report at bugs.python.org
Tue May 8 20:16:41 CEST 2012


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

I think it would have been better to keep the ExFileObject class, and base it on io.BufferedReader:

class ExFileObject(io.BufferedReader):
    def __init__(self, tarfile, tarinfo):
        raw = _FileInFile(tarfile.fileobj,
                          tarinfo.offset_data,
                          tarinfo.size,
                          tarinfo.sparse)
        io.BufferedReader.__init__(self, raw)

The result is the same of course, but there is no need to special-case the pre-3.3 API.
In addition, _FileInFile could probably inherit from io.RawIOBase.

----------
nosy: +amaury.forgeotdarc

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13815>
_______________________________________


More information about the Python-bugs-list mailing list