Skip to content
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

Please decide on chdir() / workdir() context manager #77

Closed
tiran opened this issue Sep 15, 2021 · 2 comments
Closed

Please decide on chdir() / workdir() context manager #77

tiran opened this issue Sep 15, 2021 · 2 comments

Comments

@tiran
Copy link
Member

tiran commented Sep 15, 2021

Hi steering council,

please discuss and decide whether a context manager for managing the current working directory of a process should be added to Python stdlib. Several core developers are in favor of the feature, others are against it.

Personally I'm against the feature, because the presence of the feature would promote a problematic and potentially dangerous style. chdir is not thread-safe and concurrency-safe. There are better ways like dir_fd feature on POSIX, use of absolute paths, or subprocess' cwd argument.

PR: python/cpython#28271
python-ideas discussion: https://mail.python.org/archives/list/[email protected]/thread/C525UVPP3ALGTXDNFL2GFDV23KCHP3RL/

@brettcannon
Copy link
Member

I've added it to the agenda, although it's already quite long so I'm not sure when we will get to this.

@brettcannon
Copy link
Member

SC says yes to the context manager with an appropriate warning in the docs about its limitations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants