STINNER Victor <vstin...@python.org> added the comment:

The current workaround is to use PyConfig._init_main=0, call 
Py_InitializeFromConfig(), tune Python, and then call _Py_InitializeMain() to 
finish the "main" initialization:

https://docs.python.org/dev/c-api/init_config.html#multi-phase-initialization-private-provisional-api

You can execute code between init_importlib() and init_importlib_external().

I understand that it's not enough for you. As I wrote, it's a workaround.

--

Well, your use case is to fully control the "Python Path Configuration":
https://docs.python.org/dev/c-api/init_config.html#path-configuration

This part was completely put aside in PEP 587 on purpose (to be able to put the 
done part in Python 3.8), but it's part of PEP 432.

It was proposed to rewrite getpath.c and getpathc.c in pure Python to let 
embedders to fully override this code with their own Python implementation. But 
nobody is available to implement this feature.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40333>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to