GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-40105: Truncating file if opened in append mode. by mzr · Pull Request #19337 · python/cpython

Conversation

@mzr

@mzr mzr commented Apr 3, 2020 •
edited by taleinat
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Implemented a test for this behaviour.

If we just truncate the test fails for Unseekable file types. In current implementation, those type of files can't be opened in the append ('a') mode anyway, so we could make a check for that in the future.

https://bugs.python.org/issue40105

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mzr
Truncating file if opened in append mode.
e76411f
@the-knights-who-say-ni the-knights-who-say-ni added the CLA not signed label Apr 3, 2020
@the-knights-who-say-ni

the-knights-who-say-ni commented Apr 3, 2020

Copy link
Copy Markdown

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 Missing

Our records indicate the following people have not signed the CLA:

@mzr

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
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added the awaiting review label Apr 3, 2020
@mzr mzr changed the title Truncating file if opened in append mode. bpo-40105: Truncating file if opened in append mode. Apr 3, 2020
@disconnect3d disconnect3d mentioned this pull request Apr 3, 2020
bpo-40105: fixed zip comment update #19333
Closed
blurb-it Bot and others added 2 commits April 3, 2020 16:14
@blurb-it
📜🤖 Added by blurb_it.
c311362
@mzr
fix news dos
4f8d7cb
@the-knights-who-say-ni the-knights-who-say-ni added CLA signed and removed CLA not signed labels Apr 7, 2020
@csabella
csabella requested review from Yhg1s and serhiy-storchaka July 20, 2020 11:40
taleinat
taleinat suggested changes Sep 26, 2020
View reviewed changes

@taleinat taleinat left a comment

Copy link
Copy Markdown
Contributor

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.

This looks good! Just a couple of minor comments regarding the test.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_zipfile.py Outdated
with zipfile.ZipFile(TESTFN,mode="a") as zipf:
zipf.comment = b"shorter comment"
zipf.comment = one_byte_shorter_comment
self.assertEqual(original_zip_size, os.path.getsize(TESTFN) + 1)

@taleinat taleinat Sep 26, 2020

Copy link
Copy Markdown
Contributor

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.

Testing for the precise size is too restrictive IMO. It would be better to just test that the size was reduced. That would also allow keeping the existing comments.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mzr reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Lib/test/test_zipfile.py Outdated
Comment on lines +1856 to +1857
original_comment = b"original comment that's longer"
one_byte_shorter_comment = original_comment[:-1]

@taleinat taleinat Sep 26, 2020

Copy link
Copy Markdown
Contributor

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.

IMO extracting these to variables makes the test code harder to understand rather than easier. I suggest undoing this change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mzr reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bedevere-bot bedevere-bot removed the awaiting review label Sep 26, 2020
@bedevere-bot

bedevere-bot commented Sep 26, 2020

Copy link
Copy Markdown

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. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added the awaiting changes label Sep 26, 2020
mzr added 3 commits September 28, 2020 18:12
@mzr
check whether file whether zipfile was truncated when appending short…
a93382e
…er comment
@mzr
Merge branch 'master' into zipfile-shorten-comment-test-fix
bdfda09
@mzr
delete unnecessary whitespace change
55d3b46
@mzr

mzr commented Sep 28, 2020

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting change review and removed awaiting changes labels Sep 28, 2020
@bedevere-bot

bedevere-bot commented Sep 28, 2020

Copy link
Copy Markdown

Thanks for making the requested changes!

@taleinat: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot
bedevere-bot requested a review from taleinat September 28, 2020 16:20
@taleinat
slightly reword NEWS entry
198b93b
taleinat
taleinat approved these changes Sep 28, 2020
View reviewed changes

@taleinat taleinat left a comment

Copy link
Copy Markdown
Contributor

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.

Looks good!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting change review labels Sep 28, 2020
@taleinat taleinat added needs backport to 3.8 labels Sep 28, 2020
@taleinat taleinat added the type-bug An unexpected behavior, bug, or error label Sep 28, 2020
@taleinat
taleinat merged commit ff9147d into python:master Sep 28, 2020
@miss-islington

miss-islington commented Sep 28, 2020

Copy link
Copy Markdown
Contributor

Thanks @mzr for the PR, and @taleinat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the awaiting merge label Sep 28, 2020
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 28, 2020
@mzr @miss-islington
bpo-40105: ZipFile truncate in append mode with shorter comment (pyth…
b5420ed
…onGH-19337)

(cherry picked from commit ff9147d)

Co-authored-by: Jan Mazur <[email protected]>
@bedevere-bot

bedevere-bot commented Sep 28, 2020

Copy link
Copy Markdown

GH-22436 is a backport of this pull request to the 3.9 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 label Sep 28, 2020
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 28, 2020
@mzr @miss-islington
bpo-40105: ZipFile truncate in append mode with shorter comment (pyth…
bf9ac46
…onGH-19337)

(cherry picked from commit ff9147d)

Co-authored-by: Jan Mazur <[email protected]>
@bedevere-bot

bedevere-bot commented Sep 28, 2020

Copy link
Copy Markdown

GH-22437 is a backport of this pull request to the 3.8 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.8 label Sep 28, 2020
@mzr
mzr deleted the zipfile-shorten-comment-fix branch September 28, 2020 19:04
miss-islington added a commit that referenced this pull request Sep 28, 2020
@miss-islington @mzr
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-1…
e400840
…9337)

(cherry picked from commit ff9147d)

Co-authored-by: Jan Mazur <[email protected]>
@taleinat taleinat added the needs backport to 3.9 label Sep 28, 2020
@miss-islington

miss-islington commented Sep 28, 2020

Copy link
Copy Markdown
Contributor

Thanks @mzr for the PR, and @taleinat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 28, 2020
@mzr @miss-islington
bpo-40105: ZipFile truncate in append mode with shorter comment (pyth…
6f1efdd
…onGH-19337)

(cherry picked from commit ff9147d)

Co-authored-by: Jan Mazur <[email protected]>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 label Sep 28, 2020
@bedevere-bot

bedevere-bot commented Sep 28, 2020

Copy link
Copy Markdown

GH-22439 is a backport of this pull request to the 3.9 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington added a commit that referenced this pull request Sep 28, 2020
@miss-islington @mzr
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-1…
048f54d
…9337)

(cherry picked from commit ff9147d)

Co-authored-by: Jan Mazur <[email protected]>
shihai1991 added a commit to shihai1991/cpython that referenced this pull request Sep 29, 2020
@shihai1991
Merge remote-tracking branch 'origin/master' into bpo_1635741_1
e3b9365
* origin/master: (113 commits)
  bpo-41773: Raise exception for non-finite weights in random.choices().  (pythonGH-22441)
  bpo-41873: Add vectorcall for float() (pythonGH-22432)
  bpo-41861: Convert _sqlite3 PrepareProtocolType to heap type (pythonGH-22428)
  bpo-41842: Add codecs.unregister() function (pythonGH-22360)
  bpo-41875: Use __builtin_unreachable when possible (pythonGH-22433)
  bpo-40105: ZipFile truncate in append mode with shorter comment (pythonGH-19337)
  bpo-41870: Use PEP 590 vectorcall to speed up bool()  (pythonGH-22427)
  [doc] Leverage the fact that the actual types can now be indexed for typing (pythonGH-22340)
  bpo-41861: Convert _sqlite3 cache and node static types to heap types (pythonGH-22417)
  bpo-41858: Clarify line in optparse doc (pythonGH-22407)
  Revert "Fix all Python Cookbook links (python#22205)" (pythonGH-22424)
  bpo-1635741: Port _bisect module to multi-phase init (pythonGH-22415)
  bpo-41428: Fix compiler warning in unionobject.c (pythonGH-22416)
  Fix logging error message (pythonGH-22410)
  bpo-39934: Account for control blocks in 'except' in compiler. (pythonGH-22395)
  bpo-41775: Make 'IDLE Shell' the shell title  (python#22399)
  bpo-41428: Fix compiler warnings in unionobject.c (pythonGH-22388)
  bpo-41654: Fix compiler warning in MemoryError_dealloc() (pythonGH-22387)
  bpo-41833: threading.Thread now uses the target name (pythonGH-22357)
  bpo-30155: Add macros to get tzinfo from datetime instances (pythonGH-21633)
  ...
xzy3 pushed a commit to xzy3/cpython that referenced this pull request Oct 18, 2020
@mzr @xzy3-cdc
bpo-40105: ZipFile truncate in append mode with shorter comment (pyth…
ef4596e
…onGH-19337)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka Awaiting requested review from serhiy-storchaka
@Yhg1s Yhg1s Awaiting requested review from Yhg1s
1 more reviewer
@taleinat taleinat taleinat approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@mzr @the-knights-who-say-ni @bedevere-bot @miss-islington @taleinat
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.