According to the documentation, PyImport_AppendInittab "should be called before Py_Initialize()."
There is no explanation of why this is the case, and ignoring this advice yields a working application. So, since this is working, under what circumstances will it not work?
Because the documentation says so; and violating the API might yield a working application today but not tomorrow.
A couple of issues you might encounter:
sys.builtin_module_names
is initialized within Py_Initialize
, so it won't contain your modulePyImport_AppendInittab
does not take any locks, so if you call it after Py_Initialize
in a multithreaded application you could get memory corruptionIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With