python / cpython

The Python programming language
https://www.python.org
Other
62.17k stars 29.88k forks source link

zipfile: Deduplicate reinitialization setup for ZipExtFile when seeking #121639

Open danifus opened 1 month ago

danifus commented 1 month ago

Feature or enhancement

Proposal:

ZipExtFile needs to be reinitialized if seeking back beyond it's current buffered data. The code to initialize and then reinitialize are in 2 locations and consolidating these into one location reduces the footprint for introducing potential bugs.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

danifus commented 1 month ago

I forgot I created an issue and PR (https://github.com/python/cpython/issues/88294) for this a few years ago. Originally this change was split out of a bug fix and I guess I forgot I had created that follow up work :p

In any case, the PR attached to this issue will merge cleanly whereas the old PR would need a little bit of work (https://github.com/python/cpython/pull/26116).