Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Description
Feature or enhancement
Currentlysys.path[0] is set bypymain_run_python() (in Modules/main.c). This happensafterpymain_init(), which initializes the runtime, including the rest ofsys.path (via getpath.py and site.py). This makes it harder to reason about and introduces extra complexity for subinterpreters. (Seegh-109793 andgh-109794.)
We should consider calculatingsys.path[0] and setting it to its ownPyConfig field via getpath.py, when the rest of the basesys.path is calculated. We may need a later check to verify that there is a matching importer, aspymain_run_python() does. (FWIW, it isn't clear that there's any value to storing thesys.path[0] value on the global_PyPathConfig.)
Also, we currently wait to actually setsys.path[0] (for the main interpreter) until after the readline/rlcompleter modules are imported inpymain_run_python(). We'd need to factor that in.
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status