[New-bugs-announce] [issue13815] tarfile.ExFileObject can't be wrapped using io.TextIOWrapper

Colin Watson report at bugs.python.org
Wed Jan 18 14:16:17 CET 2012

New submission from Colin Watson <cjwatson at users.sourceforge.net>:

The file-like object returned by TarFile.extractfile can't be wrapped in an io.TextIOWrapper (which would be rather convenient in some cases to get something that reads str rather than bytes).

The attached patch demonstrates the problem by way of a test case, and fixes it.  It's just a matter of adding a no-op flush method so that TextIOWrapper.close is happy with it.

components: Library (Lib)
files: tarfile-exfileobject-flush.patch
keywords: patch
messages: 151536
nosy: cjwatson
priority: normal
severity: normal
status: open
title: tarfile.ExFileObject can't be wrapped using io.TextIOWrapper
versions: Python 3.3
Added file: http://bugs.python.org/file24271/tarfile-exfileobject-flush.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list