Author christoph.wiedemann
Recipients christoph.wiedemann
Date 2018-08-01.17:36:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I'm linking an issue from numpy here:

Embedding python suffers from a possibility to reliably reset the state of the python interpreter. For my use case, I noticed that when using numpy with Py_Initialize() and Py_Finalize():

// call code importing numpy
// call same code again

The above code will result in a crash.

One of the comments in the referenced issue is that Py_Finalize doesn't unload loaded DLL's or shared objects. Doing that would probably fix the issues.

As of now, embedding python is fundamentally broken for applications which want to embed non-trivial scientific python scripts involving user-adapted python code, because

a) Py_Finalize cannot be used reliably
b) There is no possibility to reliably reset the python interpreter otherwise (because the sub-interpreters are also not working reliably, which is stated in the documentation)
c) manually reloading changed modules via importlib.reload is not a feasible solution

The possibility to reset an embedded python interpreter to an initial state is a strong requirement for such applications.
Date User Action Args
2018-08-01 17:36:13christoph.wiedemannsetrecipients: + christoph.wiedemann
2018-08-01 17:36:13christoph.wiedemannsetmessageid: <>
2018-08-01 17:36:13christoph.wiedemannlinkissue34309 messages
2018-08-01 17:36:13christoph.wiedemanncreate