This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2014年08月24日 20:35 by bdkearns, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| tarfile.patch | bdkearns, 2014年08月25日 04:32 | |||
| tarfile2.patch | bdkearns, 2014年08月25日 15:09 | |||
| Messages (5) | |||
|---|---|---|---|
| msg225836 - (view) | Author: Brian Kearns (bdkearns) * | Date: 2014年08月24日 20:35 | |
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. |
|||
| msg225848 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2014年08月24日 23:35 | |
I think technically this changes semantics, since the construction of the GzipFile is no longer in the main try-except. You should probably backport the full 3.x behavior. |
|||
| msg225864 - (view) | Author: Brian Kearns (bdkearns) * | Date: 2014年08月25日 04:32 | |
Yes, I guess that makes sense (though this behavior is undocumented and untested...) |
|||
| msg225876 - (view) | Author: Brian Kearns (bdkearns) * | Date: 2014年08月25日 14:52 | |
Updated to backport all the cases where 3.x handles this issue. |
|||
| msg226007 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2014年08月28日 00:31 | |
New changeset 6f0dae921bee by Benjamin Peterson in branch '2.7': properly handle file closing in error cases (closes #22266) http://hg.python.org/cpython/rev/6f0dae921bee |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:07 | admin | set | github: 66462 |
| 2014年08月28日 00:31:49 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg226007 resolution: fixed stage: resolved |
| 2014年08月25日 15:09:56 | bdkearns | set | files: + tarfile2.patch |
| 2014年08月25日 15:09:49 | bdkearns | set | files: - tarfile2.patch |
| 2014年08月25日 14:52:32 | bdkearns | set | files:
+ tarfile2.patch messages: + msg225876 |
| 2014年08月25日 04:32:27 | bdkearns | set | files:
+ tarfile.patch messages: + msg225864 |
| 2014年08月25日 04:31:29 | bdkearns | set | files: - tarfile.patch |
| 2014年08月24日 23:35:22 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg225848 |
| 2014年08月24日 20:45:42 | alex | set | nosy:
+ alex |
| 2014年08月24日 20:35:11 | bdkearns | create | |