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"?
Sorry, something went wrong.
|
Thanks Alex! |
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot s390x SLES 3.x has failed when building commit 6b1510c. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/all/#builders/540/builds/5391 Failed tests:
Summary of the results of the build (if available): == Tests result: FAILURE then ENV CHANGED == 445 tests OK. 10 slowest tests:
1 test altered the execution environment: 19 tests skipped: 1 re-run test: Total duration: 6 min 41 sec Click to see traceback logsremote: Enumerating objects: 26, done.
remote: Counting objects: 3% (1/26)
remote: Counting objects: 7% (2/26)
remote: Counting objects: 11% (3/26)
remote: Counting objects: 15% (4/26)
remote: Counting objects: 19% (5/26)
remote: Counting objects: 23% (6/26)
remote: Counting objects: 26% (7/26)
remote: Counting objects: 30% (8/26)
remote: Counting objects: 34% (9/26)
remote: Counting objects: 38% (10/26)
remote: Counting objects: 42% (11/26)
remote: Counting objects: 46% (12/26)
remote: Counting objects: 50% (13/26)
remote: Counting objects: 53% (14/26)
remote: Counting objects: 57% (15/26)
remote: Counting objects: 61% (16/26)
remote: Counting objects: 65% (17/26)
remote: Counting objects: 69% (18/26)
remote: Counting objects: 73% (19/26)
remote: Counting objects: 76% (20/26)
remote: Counting objects: 80% (21/26)
remote: Counting objects: 84% (22/26)
remote: Counting objects: 88% (23/26)
remote: Counting objects: 92% (24/26)
remote: Counting objects: 96% (25/26)
remote: Counting objects: 100% (26/26)
remote: Counting objects: 100% (26/26), done.
remote: Compressing objects: 10% (1/10)
remote: Compressing objects: 20% (2/10)
remote: Compressing objects: 30% (3/10)
remote: Compressing objects: 40% (4/10)
remote: Compressing objects: 50% (5/10)
remote: Compressing objects: 60% (6/10)
remote: Compressing objects: 70% (7/10)
remote: Compressing objects: 80% (8/10)
remote: Compressing objects: 90% (9/10)
remote: Compressing objects: 100% (10/10)
remote: Compressing objects: 100% (10/10), done.
remote: Total 14 (delta 12), reused 5 (delta 4), pack-reused 0
From https://github.com/python/cpython
* branch main -> FETCH_HEAD
Note: switching to '6b1510cf11c16c8e4381810c15ceeda6f89e79f4'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 6b1510cf11 GH-83863: Drop support for using `pathlib.Path` objects as context managers (GH-104807)
Switched to and reset branch 'main'
./configure: line 8401: -reorder-blocks=ext-tsp: command not found
make: *** [Makefile:2008: buildbottest] Error 3 |
Sorry, something went wrong.
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.