-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
GH-83863: Drop support for using pathlib.Path
objects as context managers
#104807
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
GH-83863: Drop support for using pathlib.Path
objects as context managers
#104807
Conversation
…ext managers 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.
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.
Hooray! Maybe worth an entry in "what's new in 3.13"?
Thanks Alex! |
|
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 makingPath
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.