Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-29435: Allow is_tarfile to take a filelike obj #18090

Open
wants to merge 3 commits into
base: master
from

Conversation

@woodruffw
Copy link

woodruffw commented Jan 20, 2020

This makes tarfile.is_tarfile behave similarly to zipfile.is_zipfile: instead of just a string or path-like, the single positional argument can also be a file or file-like.

Ref: https://bugs.python.org/issue29435

https://bugs.python.org/issue29435

@woodruffw woodruffw requested a review from ethanfurman as a code owner Jan 20, 2020
@the-knights-who-say-ni

This comment has been minimized.

Copy link

the-knights-who-say-ni commented Jan 20, 2020

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@woodruffw

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@woodruffw woodruffw force-pushed the woodruffw-forks:fix-29435 branch from aea5277 to fe5e983 Jan 20, 2020
@tirkarthi

This comment has been minimized.

Copy link
Member

tirkarthi commented Jan 21, 2020

This will need a test similar to one in test_zipfile and also update to docs that the argument could be a file like object with a versionchanged directive like is_zipfile docs.

@woodruffw

This comment has been minimized.

Copy link
Author

woodruffw commented Jan 22, 2020

This will need a test similar to one in test_zipfile and also update to docs that the argument could be a file like object with a versionchanged directive like is_zipfile docs.

Thanks, will do.

@ethanfurman ethanfurman self-assigned this Jan 22, 2020
woodruffw added 2 commits Jan 22, 2020
@woodruffw

This comment has been minimized.

Copy link
Author

woodruffw commented Jan 22, 2020

Okay, added tests (for all is_tarfile cases, not just files and file-likes) and updated the docs.

Copy link
Member

ethanfurman left a comment

Looking good.

A couple minor changes to the docs text are needed.

Please add yourself to the Misc/ACKS file.

@@ -159,7 +159,10 @@ Some facts and figures:
.. function:: is_tarfile(name)

Return :const:`True` if *name* is a tar archive file, that the :mod:`tarfile`
module can read.
module can read. *name* may be a file or file-like object too.

This comment has been minimized.

Copy link
@ethanfurman

ethanfurman Jan 22, 2020

Member

Change last sentence to:

*name* may be a :class:`str`, file, or file-like object.
@@ -2461,9 +2461,14 @@ def __exit__(self, type, value, traceback):
def is_tarfile(name):
"""Return True if name points to a tar archive that we
are able to handle, else return False.
The name argument may be a file or file-like object.

This comment has been minimized.

Copy link
@ethanfurman

ethanfurman Jan 22, 2020

Member

Change last sentence to:

'name' should be a string, file, or file-like object.
@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jan 22, 2020

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.