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.
AlexWaygood
left a comment
There was a problem hiding this comment.
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 makingPathobjects 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.