Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-84481: Add ZipFile.data_offset attribute#132165

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gpshead merged 4 commits intopython:mainfromemmatyping:zipfile_offset
Apr 6, 2025

Conversation

@emmatyping
Copy link
Member

@emmatypingemmatyping commentedApr 6, 2025
edited by github-actionsbot
Loading

This attribute provides the offset to zip data from the start of the file, when available.

I chosedata_offset to avoid confusion with the_offset property that is unrelated.


📚 Documentation preview 📚:https://cpython-previews--132165.org.readthedocs.build/

This attribute provides the offset to zip data from the start of the file, when available.
@python-cla-bot
Copy link

python-cla-botbot commentedApr 6, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@emmatyping
Copy link
MemberAuthor

I have signed the CLA with my current email. (I had already signed it under another email anyway)

@gpsheadgpshead merged commit0788948 intopython:mainApr 6, 2025
43 checks passed
self.fp=_Tellable(self.fp)
self.start_dir=0
self._seekable=False
self._data_offset=None
Copy link
Member

@picnixzpicnixzApr 6, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It may not be set ifmode == 'a' and ifBadZipFile is raised. In this case, we should still have aNone according to the docs (otherwise an AttributeError will be raised).

For mode 'r', it should be noted that failing_RealGetContents() means that the object will never be initialized so we don't care about the lack of attribute.

emmatyping reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I believe that in this case, since mode 'a' callstell() unconditionally, we can set thedata_offset to the result of that, right?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Though honestly the defensive thing to do here is to initialize it to None early on then change it later when possible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Though honestly the defensive thing to do here is to initialize it to None early on then change it later when possible.

Yes, that's what I thought.

seehwan pushed a commit to seehwan/cpython that referenced this pull requestApr 16, 2025
* Add ZipFile.data_offset attributeThis attribute provides the offset to zip data from the start of the file, when available.* Add blurb-it* Try fixing class ref in NEWS
emmatyping added a commit to emmatyping/cpython that referenced this pull requestJul 21, 2025
gpshead added a commit that referenced this pull requestJul 21, 2025
* Revert "gh-84481: Make ZipFile.data_offset more robust (#132178)"This reverts commit6cd1d6c.* Revert "gh-84481: Add ZipFile.data_offset attribute (#132165)"This reverts commit0788948.---------Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJul 21, 2025
* Revert "pythongh-84481: Make ZipFile.data_offset more robust (pythonGH-132178)"This reverts commit6cd1d6c.* Revert "pythongh-84481: Add ZipFile.data_offset attribute (pythonGH-132165)"This reverts commit0788948.---------(cherry picked from commit6bf1c0a)Co-authored-by: Emma Smith <emma@emmatyping.dev>Co-authored-by: Gregory P. Smith <greg@krypto.org>
gpshead added a commit that referenced this pull requestJul 22, 2025
…36955)gh-136170: Revert adding `ZipFile.data_offset` (GH-136950)* Revert "gh-84481: Make ZipFile.data_offset more robust (GH-132178)"This reverts commit6cd1d6c.* Revert "gh-84481: Add ZipFile.data_offset attribute (GH-132165)"This reverts commit0788948.---------(cherry picked from commit6bf1c0a)Co-authored-by: Emma Smith <emma@emmatyping.dev>Co-authored-by: Gregory P. Smith <greg@krypto.org>
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull requestAug 4, 2025
* Revert "pythongh-84481: Make ZipFile.data_offset more robust (python#132178)"This reverts commit6cd1d6c.* Revert "pythongh-84481: Add ZipFile.data_offset attribute (python#132165)"This reverts commit0788948.---------Co-authored-by: Gregory P. Smith <greg@krypto.org>
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull requestAug 19, 2025
* Revert "pythongh-84481: Make ZipFile.data_offset more robust (python#132178)"This reverts commit6cd1d6c.* Revert "pythongh-84481: Add ZipFile.data_offset attribute (python#132165)"This reverts commit0788948.---------Co-authored-by: Gregory P. Smith <greg@krypto.org>
kumaraditya303 pushed a commit to miss-islington/cpython that referenced this pull requestSep 9, 2025
…-136950) (python#136955)pythongh-136170: Revert adding `ZipFile.data_offset` (pythonGH-136950)* Revert "pythongh-84481: Make ZipFile.data_offset more robust (pythonGH-132178)"This reverts commit6cd1d6c.* Revert "pythongh-84481: Add ZipFile.data_offset attribute (pythonGH-132165)"This reverts commit0788948.---------(cherry picked from commit6bf1c0a)Co-authored-by: Emma Smith <emma@emmatyping.dev>Co-authored-by: Gregory P. Smith <greg@krypto.org>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@picnixzpicnixzpicnixz left review comments

@gpsheadgpsheadgpshead approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@emmatyping@gpshead@picnixz

[8]ページ先頭

©2009-2025 Movatter.jp