]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-38971: Open file in codecs.open() closes if exception raised. (GH-17666)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 2 Mar 2020 08:02:16 +0000 (00:02 -0800)
committerGitHub <noreply@github.com>
Mon, 2 Mar 2020 08:02:16 +0000 (00:02 -0800)
commitf4d709f4a3c69bd940bd6968a70241277132bed7
tree723a3f69fc65008dc7b2d7c63af10c70373413c4
parentd3c24350892b55b4ea6fb81b84e577968c1f2f91
bpo-38971: Open file in codecs.open() closes if exception raised. (GH-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 2565edec2c974b2acca03b4cc5025e83f903ddd7)

Co-authored-by: Chris A <christopher.aporta@gmail.com>
Lib/codecs.py
Lib/test/test_codecs.py
Misc/NEWS.d/next/Library/2019-12-20-16-06-28.bpo-38971.fKRYlF.rst [new file with mode: 0644]