]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-83863: Drop support for using `pathlib.Path` objects as context managers (GH-104807)
authorBarney Gale <barney.gale@gmail.com>
Tue, 23 May 2023 22:31:59 +0000 (23:31 +0100)
committerGitHub <noreply@github.com>
Tue, 23 May 2023 22:31:59 +0000 (22:31 +0000)
commit6b1510cf11c16c8e4381810c15ceeda6f89e79f4
tree12b9d8063d5c285204780980e9391bd23285f755
parente0b3078705b271ff278dfbc788c2b061c92a9aa3
GH-83863: Drop support for using `pathlib.Path` objects as context managers (GH-104807)

In Python 3.8 and prior, `pathlib.Path.__exit__()` marked a path as closed;
some subsequent attempts to perform I/O would raise an IOError. This
functionality was never documented, and had the effect of making `Path`
objects mutable, contrary to PEP 428. In Python 3.9 we made `__exit__()` a
no-op, and in 3.11 `__enter__()` began raising deprecation warnings. Here
we remove both methods.
Doc/whatsnew/3.13.rst
Lib/pathlib.py
Lib/test/test_pathlib.py
Misc/NEWS.d/next/Library/2023-05-23-19-53-18.gh-issue-83863.eRI5JG.rst [new file with mode: 0644]