-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
gh-102120: Added an iter function that doesn't cache #102128
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
I would rather add a new keyword to the |
That would probably be better |
I'll be adding some tests later today |
I believe this is working as intended now. I'm open to criticism in the implementation |
Co-authored-by: Ethan Furman <[email protected]>
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.
Overall, looks good. I missed feature-freeze, though, so this will have to go in 3.13. Update the 3.12
s to 3.13
s and I'll get it merged.
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 |
@ethanfurman I went ahead and did that, thanks for reviewing it. It's too bad it didn't make it in before feature freeze but oh well. |
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. |
Refers to #102120
This is a proposed solution to the linked issue which is to provide a way to iterate over a tar object so that it doesn't cache.
My suggestion is to reuse the code from
Tarfile._next()
to yield a tarinfo each time instead of caching it. This way it doesn't take up a tonne of memory.I am looking for feedback on this so I will mark this as a draft.
Edit:
As from suggestions a parameter called stream can be passed to the object which will make sure nothing is cached. I will add a code example later today.