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

Flag for unusable sys.executable #77361

Closed
zooba opened this issue Mar 29, 2018 · 5 comments
Closed

Flag for unusable sys.executable #77361

zooba opened this issue Mar 29, 2018 · 5 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes type-bug An unexpected behavior, bug, or error

Comments

@zooba
Copy link
Member

zooba commented Mar 29, 2018

BPO 33180
Nosy @ncoghlan, @jwilk, @ericsnowcurrently, @zooba

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/zooba'
closed_at = <Date 2018-09-21.20:44:42.307>
created_at = <Date 2018-03-29.14:53:31.468>
labels = ['3.8', 'type-bug', '3.7', 'invalid']
title = 'Flag for unusable sys.executable'
updated_at = <Date 2018-09-21.20:44:42.306>
user = 'https://github.com/zooba'

bugs.python.org fields:

activity = <Date 2018-09-21.20:44:42.306>
actor = 'steve.dower'
assignee = 'steve.dower'
closed = True
closed_date = <Date 2018-09-21.20:44:42.307>
closer = 'steve.dower'
components = []
creation = <Date 2018-03-29.14:53:31.468>
creator = 'steve.dower'
dependencies = []
files = []
hgrepos = []
issue_num = 33180
keywords = []
message_count = 5.0
messages = ['314655', '314656', '314660', '314661', '326036']
nosy_count = 4.0
nosy_names = ['ncoghlan', 'jwilk', 'eric.snow', 'steve.dower']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue33180'
versions = ['Python 3.7', 'Python 3.8']

@zooba
Copy link
Member Author

zooba commented Mar 29, 2018

If you host Python in another program, it's likely that sys.executable is not pointing to a normal Python interpreter. This can cause libraries such as multiprocessing to fail when they try to launch the interpreter again. Worse, it may have launched your application many more times before failure :)

I think we should add either a flag to indicate to any such library that sys.executable is not useful for relaunching Python, or a field that points to the actual executable but can safely be left None (or for most horrendous generality, a list of arguments to relaunch, as sometimes a command line option can get you into a normal interpreter). These would be set by embedders only, and Programs/python.c would set the "normal" values.

Thoughts?

@zooba zooba added 3.7 (EOL) end of life 3.8 only security fixes labels Mar 29, 2018
@zooba zooba self-assigned this Mar 29, 2018
@zooba zooba added the type-bug An unexpected behavior, bug, or error label Mar 29, 2018
@zooba
Copy link
Member Author

zooba commented Mar 29, 2018

Looking at the docs https://docs.python.org/3/library/sys.html#sys.executable maybe we only need to clarify that it's not None only if it provides the normal command line? Then file bugs against all the libraries that don't work when it's not set?

@ncoghlan
Copy link
Contributor

I'm not sure what the right solution is at the design level, but I did recently run into a quirk related to this in the embedding tests: on \*nix systems, PySys_SetProgramName affects sys.executable, while Windows ignores it.

But certainly the intention is that a non-None sys.executable should be usable the way multiprocessing and the test suite use it: as a way to run Python in a subprocess. If an embedding environment wants to support that, it can set it to something suitable, and if it doesn't, it can set it to None.

(I do sometimes wonder if subprocess should have some sys.executable-specific helpers though - rerunning Python with the same settings as the current Python requires quite a bit more than just calling sys.executable with no particular options)

@ncoghlan
Copy link
Contributor

Also mentioning https://docs.python.org/3/library/multiprocessing.html#multiprocessing.set_executable, since it came up on the pickle-protocol-version-5 thread.

@zooba
Copy link
Member Author

zooba commented Sep 21, 2018

Closing in favour of bpo-34725

@zooba zooba closed this as completed Sep 21, 2018
@zooba zooba added the invalid label Sep 21, 2018
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life 3.8 only security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants