Message415033
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. |
|
Date |
User |
Action |
Args |
2022-03-13 10:38:20 | ronaldoussoren | set | recipients:
+ ronaldoussoren, vinay.sajip, ned.deily, eric.snow, steve.dower, pablogsal |
2022-03-13 10:38:20 | ronaldoussoren | set | messageid: <1647167900.65.0.486461822886.issue46890@roundup.psfhosted.org> |
2022-03-13 10:38:20 | ronaldoussoren | link | issue46890 messages |
2022-03-13 10:38:20 | ronaldoussoren | create | |
|