-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-29435: Allow is_tarfile to take a filelike obj #18090
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
Conversation
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 MissingOur records indicate the following people have not signed the CLA: 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 You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
This will need a test similar to one in |
Thanks, will do. |
Okay, added tests (for all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good.
A couple minor changes to the docs text are needed.
Please add yourself to the Misc/ACKS
file.
Doc/library/tarfile.rst
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change last sentence to:
*name* may be a :class:`str`, file, or file-like object.
Lib/tarfile.py
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change last sentence to:
'name' should be a string, file, or file-like object.
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! |
Thanks for making the requested changes! @ethanfurman: please review the changes made to this pull request. |
`is_tarfile()` now supports `name` being a file or file-like object.
This makes
tarfile.is_tarfile
behave similarly tozipfile.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