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

Do not rely on sys.executable being accurate. #1049

Merged
merged 2 commits into from
Sep 29, 2020

Conversation

jsirois
Copy link
Member

@jsirois jsirois commented Sep 29, 2020

Unfortunately, OSX framework Python interpreters have had launch schemes
that could lead to misreported sys.executable. We no longer trust
sys.executable when caching interpreters or reading them from the
cache.

Fixes #1009

Unfortunately, OSX framework Python interpreters have had launch schemes
that could lead to misreported `sys.executable`. We no longer trust
`sys.executable` when caching interpreters or reading them from the
cache.

Fixes pex-tool#1009
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Ludicrous behavior from macOS. Thanks for digging into this.

pex/interpreter.py Outdated Show resolved Hide resolved
Co-authored-by: Eric Arellano <[email protected]>
@@ -435,7 +455,7 @@ def create_interpreter(stdout):
if os.path.isfile(cache_file):
try:
with open(cache_file, "rb") as fp:
return SpawnedJob.completed(create_interpreter(fp.read()))
return SpawnedJob.completed(create_interpreter(fp.read(), check_binary=True))
except (IOError, OSError, cls.Error, PythonIdentity.Error):
safe_rmtree(cache_dir)
Copy link
Member Author

Choose a reason for hiding this comment

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

We purge the cache right here. Note the new check_binary argument is only passed here (in the try above).

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

Successfully merging this pull request may close these issues.

No such file for interpreter's binary name
2 participants