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
…ading it and sets sys._base_executable value for later use.
|
@ned-deily I made a few changes that affect macOS here, but they should be all neutral. Despite the differences in calculating |
|
@vstinner This is an important bugfix for 3.7, but doesn't have to end up in 3.8 in this form - presumably it's best to go into the config structures like the other values. However, since we're so close to 3.8a1 I'd rather get the fix in with a private attribute and we can add the full configurability later. Does that sound okay? |
|
I am in PTO for one week, I will not be able to review properly this change. A better design would be to expose the internal "core config" and "main config", but we didn't agree with Nick Coghlan and Eric Snow how to expose them. Anyway, even if we expose it in 3.8, it wouldn't help for 3.7. I guess that a private sys attribute is fine as soon as we can replace it with a better solution whenever. IMHO a better solution would include to rewrite site in C to call it earlier in the initialisation of the config. But that's a very large and intrusive project... |
|
@vstinner Thanks, I won't hold this up for a full review, just wanted to check the idea and make sure you weren't close to any major work here.
Personally I'd like to rewrite initialisation into Python and figure out how to be able to run it at startup, rather than putting all this in C. This is probably a bigger and more intrusive project, but I think the long-term value is worth it :) But right now, I just want to fix this bug. |
|
Thanks @zooba for the PR |
|
Sorry, @zooba, I could not cleanly backport this to |
…H-11745) After reading __PYVENV_LAUNCHER__ we now set sys._base_executable value for later use. Make the same changes for macOS to avoid extra platform checks.
|
GH-11753 is a backport of this pull request to the 3.7 branch. |
That's someone compatible with PEP 432 design which redesign Python initialization into multiple steps and you are free to stop at any stage. For example, Nick would like to be able to get a Python initialized without access to the filesystem. |
Clears
__PYVENV_LAUNCHER__variable after reading it and sets sys._base_executable value for later use.This allows simple use of
sys.executableto launch in the current venv (either during execution or later), and internal use ofsys._base_executableto reference the original Python when necessary (for example, when usingmultiprocessingor creating a new venv).Since the variable is cleared, using the full path to a non-venv Python will no longer launch in the venv.
https://bugs.python.org/issue35872