-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
About the invalid of Py_InitializeFromConfig
#125497
Comments
cc @vstinner |
If you want to use |
I'm sorry. What I want to express is that it seems that when he executed sys.path initialization, Edit: |
|
Your program fails silently because you should compute the whole sys.path (e.g. path to the stdlib), not just add your I suggest you to modify For example, call this function after
Yeah sorry, the |
Bug report
Bug description:
My test code.
output
This issue is a continuation of issue #122963. Based on my tests, I discovered that
sys.path
is actually obtained through the config retrieved by _PyInterpreterState_GetConfig, rather than the config passed by the user. As a result, theconfig
argument in thePy_InitializeFromConfig
function does not actually take effect. I have completed my modifications regarding this. My solution is to save the config passed by the user and then append its content tosys.path
.In fact, by the time
pyinit_main
is executed, theconfig
obtained through the thread context is no longer the one passed by the user.My change diff.
changed output
If I'm allowed to fix this, I'll look for a more suitable modification than this one.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
The text was updated successfully, but these errors were encountered: