-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
gh-69528: Distinguish between file modes wb+
and rb+
#137834
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
base: main
Are you sure you want to change the base?
Conversation
____ Co-authored-by: Xiang Zhang <[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.
Please add a test for GzipFile with a file opened with mode 'wb+'.
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 is not what I meant.
Open a file in the "wb+" mode and pass it to GzipFile instead of a filename. Check that that GzipFile is writable and not readable. You can also do the same for "rb+" and other modes. Most likely there are already such tests for "rb" and "wb" (and maybe for "ab" and "xb"?).
Do you want that in this PR, or another one? |
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.
Yes, please add tests for all other modes with "+".
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.
Since it emits FutureWarning, the more correct place for these tests is test_fileobj_mode
.
Misc/NEWS.d/next/Core_and_Builtins/2025-08-15-20-35-30.gh-issue-69528.qc-Eh_.rst
Outdated
Show resolved
Hide resolved
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.
LGTM. 👍
Uh oh!
There was an error while loading. Please reload this page.