bpo-37661: fix venv activation script rigged prompt check#14932
bpo-37661: fix venv activation script rigged prompt check#14932mental32 wants to merge 1 commit intopython:masterfrom mental32:bpo-37661-venv-prompt-test
Conversation
|
Not sure if this is the best solution to the problem as it inlines the prompt creation, creating two places where the default prompt is specified. There's also missing doc updates and it isn't using f-strings. But before you attempt to fix this, @mental32 , please wait a day to see if I come up with a solution for https://bugs.python.org/issue37663 which might make this change a moot point (and if I do I will flag it to you for a review). |
brettcannon
left a comment
There was a problem hiding this comment.
Thanks for attempting this, but there isn't an appropriate doc update, the default prompt is now being created twice, and you didn't use f-strings.
|
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 |
|
That's fine, thanks for reviewing! Hopefully you find a better solution with 37663. I do have a couple of questions:
Thanks for bearing with me, it's very obvious I'm new and nervous but I find the best solution is if I question everything and constantly look to improve, that way end up messing up less often :) |
|
@mental32 Happy to answer the questions!
|
|
Ah bully! Thanks for answering my questions, It cleared up a lot for me. I'll revise the documentation thoroughly next time I make a change to a modules public API and I can't help but think that your second answer, regarding style, could be inserted as a note in the developer guide. Hope you enjoy your hackathon and in the meanwhile I'll be eagerly stalking the bpo :D (I'll close the PR with this comment since I assume you'll have a neater solution lined up later on). |
bpo-37661: Added short circuiting logic to the checks performed in the two scripts affected, this required adding another string substitution
__VENV_DEFAULT_PROMPT__which would evaluate to the default case used when formatting the__VENV_PROMPT__flag.I'm a little paranoid given this is my first contribution, I ran a passing test suite and tested the expressions evaluated in the checks directly but not the actual scripts themselves so I'd love if someone could confirm the correctness of this patch.
https://bugs.python.org/issue37661