My plan is not to change the default implementation to calculate the path configuration, but make it easier to customize the path configuration.
One idea is to rewrite Modules/getpath.c and PC/getpathp.c in Python and convert it to a frozen module. It is easier to modify Python code than C code. In the past, we already did such change for importlib (which also has a frozen part, importlib._bootstrap and importlib._bootstrap_external).
The PEP 587 implementation moves towards that with the "Multi-Phase Initialization Private Provisional API":
https://docs.python.org/dev/c-api/init_config.html#multi-phase-initialization-private-provisional-api |