[New-bugs-announce] [issue22266] fix reliance on refcounting in tarfile.gzopen

Brian Kearns report at bugs.python.org
Sun Aug 24 22:35:11 CEST 2014


New submission from Brian Kearns:

tarfile.gzopen relies on refcounting to close the fileobj when the fileobj is created during the call to gzopen (when it is not passed in). Since the fileobj is created outside of GzipFile, GzipFile does not take responsibility for closing the fileobj (so no one does, aside from the GC, which leads to unexpected behavior when using a non-refcounted GC).

This is fixed by having GzipFile open the fileobj itself, so it does take responsibility for closing it when necessary. The same approach is taken in tarfile.py in py3k branch.

----------
files: tarfile.patch
keywords: patch
messages: 225836
nosy: bdkearns
priority: normal
severity: normal
status: open
title: fix reliance on refcounting in tarfile.gzopen
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file36456/tarfile.patch

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


More information about the New-bugs-announce mailing list