-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
Move contextlib.chdir
to shutil.chdir_context
contingent on gh-128432
#128499
Comments
I believe we should not change anything here (some people expressed the same sentiment in the Discourse thread, though it got a little buried around the naming discussion). Deprecations have a cost in terms of making Python upgrades harder, and this change isn't worth that cost. |
This essentially means that we're removing it in 2029, when it's no more accepting security patches but many distributions are still patching very old releases (e.g., openSUSE with 3.6 patches) so, if we can alleviate the work on their side (even if this targets an EOL branch), why not doing it. So I'm rather a -0.5 on this one even though it's for the sake of consistency (if we really want to change it, I would prefer that |
We're continuing with this issue / PR. We'll see in 2029 whether the Really though for distros who choose to use dead versions of Python it's up to them to write compatibility code, eg import sys
if sys.version_info >= (3,18):
from shutil import chdir_context as chdir
else:
from contextlib import chdir beyond the lifespan of |
Hold on; there is no consensus for making this change. Several core devs seem to want to reject this. Please wait with a PR until there is consensus. |
Closed due to cancellation of #128432 |
Feature or enhancement
Proposal:
Summary
contextlib.chdir
toshutil.chdir_context
.contextlib.chdir
member to be a compatibility import, which can be removed when Python <=3.13 is no longer supported, for a gentle deprecation path.Rationale
This is really part (2/2) of #128432 which is resolved by the pending #128433. The naming convention
chdir_context
followsumask_context
. Documentation re-organising, and code style introduced in #128433 allows this one to slot right in.contextlib
shouldn't have been the location thatchdir
was added to in the first place, and now is the opportune time to correct this mis-step.PR Preview
Git (re)based on #128433, the PR draft branch is on my fork
Discussions
On discuss.python.org.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/move-contextlib-chdir-to-become-shutil-chdir/76007/
The text was updated successfully, but these errors were encountered: