X Tutup
The Wayback Machine - https://web.archive.org/web/20220518142232/https://github.com/python/cpython/pull/92676
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

gh-92675: venv: Fix ensure_directories() to again accept a Path for env_dir #92676

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

davidfstr
Copy link
Contributor

@davidfstr davidfstr commented May 11, 2022

Fixes: #92675

@@ -116,7 +116,7 @@ def create_if_needed(d):
elif os.path.islink(d) or os.path.isfile(d):
raise ValueError('Unable to create directory %r' % d)

if os.pathsep in env_dir:
if isinstance(env_dir, str) and os.pathsep in env_dir:
Copy link
Member

@JelleZijlstra JelleZijlstra May 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the intent here is to enforce that env_dir is only a single path segment. Should we preserve that behavior for path-likes too? For example, we could call env_dir = os.fspath(env_dir) first.

I'm not sure why we need to check for this at all though. What is the reason we have this check?

Copy link
Member

@vsajip vsajip May 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's checking for os.pathsep, not os.sep: it was a fix for bpo-43218. I agree, we should retain the behaviour for path-likes too - otherwise the problem originally solved for will come back.

Copy link
Member

@vsajip vsajip left a comment

Please see comments about a possible change in behaviour, and please add tests (including a failure test for the bpo-43218 issue when a dir containing os.pathsep is passed as a Path).

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented May 11, 2022

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@davidfstr
Copy link
Contributor Author

@davidfstr davidfstr commented May 12, 2022

I have made the requested changes; please review again

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented May 12, 2022

Thanks for making the requested changes!

@vsajip: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from vsajip May 12, 2022
@EwoutH
Copy link

@EwoutH EwoutH commented May 18, 2022

Thanks for the effort fixing this issue! Any update on its status?

Lib/venv/__init__.py Outdated Show resolved Hide resolved
Thanks to JelleZijlstra for the feedback!

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@davidfstr
Copy link
Contributor Author

@davidfstr davidfstr commented May 18, 2022

@JelleZijlstra thanks for the feedback! Did apply your suggestion.

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

Successfully merging this pull request may close these issues.

5 participants
X Tutup