{{ message }}
bpo-38971: open file in codecs.open() closes if exception raised - #17666
Merged
serhiy-storchaka merged 4 commits intoMar 2, 2020
Merged
Conversation
Open issue in the BPO indicated a desire to make the implementation of codecs.open() at parity with io.open(), which implements a try/except to assure file stream gets closed before an exception is raised.
caporta
force-pushed
the
bpo-38971-fix-codecs-open
branch
from
December 19, 2019 22:45
96e88dc to
f6b7759
Compare
serhiy-storchaka
left a comment
Member
There was a problem hiding this comment.
The fix LGTM, but I have some comments about the test.
- Move spec out of seperate class and into CodecsModuleTest - Pass invalid encoding to force exception rather than mock - Specify that a LookupError is raised specifically
Contributor
Author
|
@serhiy-storchaka addressed the above comments, should be ready for re-review. thanks |
serhiy-storchaka
left a comment
Member
There was a problem hiding this comment.
Thank you. Yet a nitpick to tests.
Prefer positional args to keywords in spec Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
caporta
requested review from
serhiy-storchaka
and removed request for
serhiy-storchaka
February 14, 2020 04:13
Contributor
Author
|
@serhiy-storchaka would it be possible to get a re-review of this PR? Thanks in advance! |
serhiy-storchaka
approved these changes
Mar 2, 2020
Contributor
|
Thanks @caporta for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
Contributor
|
Thanks @caporta for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8. |
|
GH-18733 is a backport of this pull request to the 3.7 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Mar 2, 2020
…thonGH-17666) Open issue in the BPO indicated a desire to make the implementation of codecs.open() at parity with io.open(), which implements a try/except to assure file stream gets closed before an exception is raised. (cherry picked from commit 2565ede) Co-authored-by: Chris A <christopher.aporta@gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Mar 2, 2020
…thonGH-17666) Open issue in the BPO indicated a desire to make the implementation of codecs.open() at parity with io.open(), which implements a try/except to assure file stream gets closed before an exception is raised. (cherry picked from commit 2565ede) Co-authored-by: Chris A <christopher.aporta@gmail.com>
miss-islington
added a commit
that referenced
this pull request
Mar 2, 2020
…-17666) Open issue in the BPO indicated a desire to make the implementation of codecs.open() at parity with io.open(), which implements a try/except to assure file stream gets closed before an exception is raised. (cherry picked from commit 2565ede) Co-authored-by: Chris A <christopher.aporta@gmail.com>
miss-islington
added a commit
that referenced
this pull request
Mar 2, 2020
…-17666) Open issue in the BPO indicated a desire to make the implementation of codecs.open() at parity with io.open(), which implements a try/except to assure file stream gets closed before an exception is raised. (cherry picked from commit 2565ede) Co-authored-by: Chris A <christopher.aporta@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

https://bugs.python.org/issue38971
Open issue in the BPO indicated a desire to make the implementation of
codecs.open() at parity with io.open(), which implements a try/except to
assure file stream gets closed before an exception is raised.
https://bugs.python.org/issue38971