Ronald Oussoren <ronaldousso...@mac.com> added the comment:
I've updated the title to better reflect the actual problem. An update on the current state of this issue: I haven't looked at the code for a couple of days because because I got stuck. With a fresh mind I've continued debugging and noticed that I'm looking in the wrong place... I've added some warn() calls to the end of getpath.py to print the updated variables: `` warn(f"END prefix: {config['prefix']}") warn(f"END exec_prefix: {config['exec_prefix']}") warn(f"END base_prefix: {config['base_prefix']}") warn(f"END base_exec_prefix: {config['base_exec_prefix']}") ``` When I use this build with a framework build with and alternate name (``--enable-framework --with-framework-name=DebugPython``) and then create a venv in ``X/workenv`` I get expected output when I use the python in that venv: ``` $ X/workenv/bin/python -c 'import sys; print(f"ACTUAL prefix: {sys.prefix}\nACTUAL base_prefix: {sys.base_prefix}")' END prefix: /Library/Frameworks/DebugPython.framework/Versions/3.11 END exec_prefix: /Library/Frameworks/DebugPython.framework/Versions/3.11 END base_prefix: /Library/Frameworks/DebugPython.framework/Versions/3.11 END base_exec_prefix: /Library/Frameworks/DebugPython.framework/Versions/3.11 ACTUAL prefix: /Users/ronald/Projects/Forks/cpython/build/X/workenv ACTUAL base_prefix: /Library/Frameworks/DebugPython.framework/Versions/3.11 ``` Note how "ACTUAL prefix" is different from "END prefix". The weird bit is that the only reference to 'workenv' (the name of the venv) is in the value of config["executable"]. I'm now convinced that sys.prefix is set after ``_PyConfig_InitPathConfig``, I've added some more debug prints around the call to ``_PyConfig_FromDict`` in ``_PyConfig_InitPathConfig`` and that prints: ``` before reconfig: config->prefix = (null) before reconfig: sys.prefix = (not set) after reconfig: config->prefix = /Library/Frameworks/DebugPython.framework/Versions/3.11 after reconfig: sys.prefix = (not set) ``` I have no idea where sys.prefix get's initialised though, the configuration initialisation code could use some documentation. I've attached a new version of my patch, still work in progress and including debug code. Definitely not ready for merging. In short: my patch (v3) seems to work, but I have no idea why. ---------- title: venv does not create "python" link in python 3.11 -> getpath problems with framework build Added file: https://bugs.python.org/file50669/issue-46890-v3.txt _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46890> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com