classification
Title: Allow to pass fileobj to is_tarfile
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ethan.furman Nosy List: ethan.furman, twiggers, xtreak, yossarian
Priority: normal Keywords: patch

Created on 2017-02-03 14:37 by twiggers, last changed 2020-01-23 02:50 by yossarian. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18090 merged yossarian, 2020-01-20 23:42
Messages (5)
msg286869 - (view) Author: Thom Wiggers (twiggers) Date: 2017-02-03 14:37
The tarfile.is_tarfile() function only supports opening from paths. However, the `Tarfile` class also supports opening from `fileobj`s. It would be useful if the is_tarfile function would also accept those.

For reference, this is the current implementation: https://github.com/python/cpython/blob/fcc3915a266b6cd220483c7020de0d71e293b2cb/Lib/tarfile.py#L2432
msg360205 - (view) Author: William Woodruff (yossarian) * Date: 2020-01-17 18:08
I'll take a stab at this. It looks like `Tarfile.open` takes an optional keyword that should make this straightforward.
msg360531 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2020-01-23 02:24
New changeset dd754caf144009f0569dda5053465ba2accb7b4d by Ethan Furman (William Woodruff) in branch 'master':
bpo-29435: Allow is_tarfile to take a filelike obj (GH-18090)
https://github.com/python/cpython/commit/dd754caf144009f0569dda5053465ba2accb7b4d
msg360532 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2020-01-23 02:26
Thanks, William!
msg360533 - (view) Author: William Woodruff (yossarian) * Date: 2020-01-23 02:50
Thanks to you to!
History
Date User Action Args
2020-01-23 02:50:14yossariansetmessages: + msg360533
2020-01-23 02:26:01ethan.furmansetstatus: open -> closed
messages: + msg360532

assignee: ethan.furman
resolution: fixed
stage: patch review -> resolved
2020-01-23 02:24:28ethan.furmansetmessages: + msg360531
2020-01-20 23:42:05yossariansetkeywords: + patch
stage: patch review
pull_requests: + pull_request17482
2020-01-19 16:14:50xtreaksetnosy: + ethan.furman, xtreak

versions: + Python 3.9
2020-01-17 18:08:30yossariansetnosy: + yossarian
messages: + msg360205
2017-02-03 14:37:33twiggerscreate