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.

Title: object returned by tarfile.extractfile has an incorrect value of name attribute
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.7, Python 3.6, Python 3.3, Python 3.4, Python 3.5
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Ondrej Kubecka, lars.gustaebel
Priority: normal Keywords:

Created on 2017-05-05 15:09 by Ondrej Kubecka, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 1483 open python-dev, 2017-05-05 19:19
Messages (1)
msg293111 - (view) Author: Ondrej Kubecka (Ondrej Kubecka) * Date: 2017-05-05 15:09
Consider the following code snippet:

import tarfile

tar1 ='tar1.tar.gz')
file_ = tar1.extractfile('FILE')

Up until 3.2.x, the value of name attribute would be 'FILE' as derived from tarinfo of the member. Starting with 3.3 (commits: b062a2fa 7a919e99) this value be obtained from tarfile.fileobj ("parent" tarball file) and would return 'tar1.tar.gz' instead.

This does not seem to be correct as it's not a filename of the ExFileObject / _FileInFile / io.BufferedReader object itself which would otherwise be consistent with values normally found under name.

There is also a problem that this information no longer appears to be accessible at all looking at the object returned from extractfile alone.

And looking at release notes of 3.3, this does not seem to be intentional effect.
Date User Action Args
2022-04-11 14:58:46adminsetgithub: 74468
2017-05-05 20:36:09serhiy.storchakasetnosy: + lars.gustaebel
2017-05-05 19:19:05python-devsetpull_requests: + pull_request1583
2017-05-05 15:09:35Ondrej Kubeckacreate