-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Fix issue where user environment variables with line endings were not parsed correctly on Unix platforms #20106
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ccordoba12, this might be a good time to review what the Perhaps we need to define, for the purposes of Spyder, what "user environment variables" means. I have a working definition which is:
For Windows users, this is very straight-forward: everything inherits from the registry, so these values can be collected directly from there. For unix platforms, this is more complicated: it depends on the default shell and the profile startup scripts (e.g. /etc/bashrc, ~/.bash_profile, etc.). Ostensibly, For these reasons, I was motivated to use a subprocess to get the "user environment variables" rather than |
0538828
to
26adcca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work here @mrclary! I left some small suggestions for you, otherwise looks almost ready to me.
* from registry (Windows) * from os.environ of python process in clean login shell
* Don't give impression that set_user_env can write environment variables for general purposes on Unix systems. * More descriptive variable name in get_user_environment_variables * Move restore_user_env to spyder/app/tests/conftest.py to avoid Spyder imports in top-level conftest.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now, thanks @mrclary!
Description of Changes
#20297 unsatisfactorily fixed #20097 by skipping environment variables that do not parse correctly. This PR remedies this.
os.environ
from a python process. This circumvents any parsing issues and should reflect exactly what a user would expect from a python process in a standard terminal.Issue(s) Resolved
Fixes #20637.
Fixes #20242.
See #20097