gh-121639: Deduplicate reinitialization setup for ZipExtFile when seeking #121640
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: gh-121639
Related to: #81719
Add
ZipExtFile._init_read()
to perform initialization and any reinitialization if necessary. The name_init_read()
was chosen to match the surrounding_init_decrypter()
method but these might need to lose the leading_
in a different PR if we're going to allow subclassingZipExtFile
.Since we now check the decryption check byte in
_init_decrypter()
, I think it would also make sense for_init_decrypter()
to return the decrypter (or nothing) rather than the check byte but that would change the (_internal) api so I haven't added it here. Happy to update this PR with that change if it is acceptable.