Description
This was caused by the changes to use Py_InitializeFromConfig in "ConfgigPEP587" (which is misspelled). This change was made as part of commit 6afe081
Upon trying to initialize Python with a version of Python within a Conda environment (3.10.5 in this case), the following error occurs: "failed to get the Python codec of the filesystem encoding" which is contained in the err_msg of Status return value of Py_InitializeFromConfig.
I have verified that if I modify "ConfgigPEP587" to call Py_Initialize, and the config was setup the way it was previously, by using Python Flags (such as Py_DebugFlag, Py_VerboseFlag, etc) and using Py_SetPythonHome to set PYTHONHOME (the way it was done previously) then Python from within a Conda environment loads without issue.
This is very hard to debug since the Config manipulation was purposely made opaque by using a "Filler" array with a bunch of TConfigOffsets.
For all I know, the offset for TConfigFields.home is wrong, but I am not sure how to verify the provided offset values.
Since the only difference in PythonVersions.pas for Python from within Conda is to call SetPythonHome on the PythonEngine, my working hypothesis is that this issue is related to not properly setting up PYTHONHOME for the config, but it may in fact be some other issue related to the config.
I also see that PyConfig_SetArgv is being imported but never used. I would think that SetProgramArgs should be calling PyConfig_SetArgv, but again, all of this is really unclear because of how opaque the implementation is.
Any ideas for how to handle this issue?