Conversation
Signed-off-by: Filipe Laíns <lains@riseup.net>
There was a problem hiding this comment.
realpath() returns /proc/self/exe unmodified if it cannot resolve the symlink. I would prefer using readlink() here. But it requires more work, since Modules/getpath.c doesn't implement it here. I can help implementing readlink() in getpath.c if you want.
There was a problem hiding this comment.
Right, using readlink would also be my preference, I just went for this implementation for simplicity. We could move this to progname_to_dict (computes real_executable), but we should still try to honor program_name if it points to the same path.
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
|
Well, this is kind of messy. It seems that several tests rely on being able to feed I'm gonna see if I can find a way to do this without breaking the module path calculation. |
|
Indeed. There may be no meaningful executable, and the actual executed binary if it even exists on a filesystem that /proc/self/exe can point to, does not have to be a Python interpreter or behave like one. It is common to see two behaviors in embedding scenarios, either |

$ bash -c "exec -a echo $(pwd)/python -c 'import sys; print(sys.executable)'" /home/anubis/git/cpython/python