diff options
author | Barney Gale <barney.gale@gmail.com> | 2023-05-23 22:31:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-23 22:31:59 (GMT) |
commit | 6b1510cf11c16c8e4381810c15ceeda6f89e79f4 (patch) | |
tree | 12b9d8063d5c285204780980e9391bd23285f755 /Misc/NEWS.d/next | |
parent | e0b3078705b271ff278dfbc788c2b061c92a9aa3 (diff) | |
download | cpython-6b1510cf11c16c8e4381810c15ceeda6f89e79f4.zip cpython-6b1510cf11c16c8e4381810c15ceeda6f89e79f4.tar.gz cpython-6b1510cf11c16c8e4381810c15ceeda6f89e79f4.tar.bz2 |
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.
Diffstat (limited to 'Misc/NEWS.d/next')
-rw-r--r-- | Misc/NEWS.d/next/Library/2023-05-23-19-53-18.gh-issue-83863.eRI5JG.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-05-23-19-53-18.gh-issue-83863.eRI5JG.rst b/Misc/NEWS.d/next/Library/2023-05-23-19-53-18.gh-issue-83863.eRI5JG.rst new file mode 100644 index 0000000..7a073aa --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-05-23-19-53-18.gh-issue-83863.eRI5JG.rst @@ -0,0 +1,4 @@ +Support for using :class:`pathlib.Path` objects as context managers has been +removed. Before Python 3.9, exiting the context manager marked a path as +"closed", which caused some (but not all!) methods to raise when called. +Since Python 3.9, using a path as a context manager does nothing. |