In the Belle2 software the main binary is handles some arguments and runs some setup, then initializes the python interpreter (Py_Initialize()), runs the given python script and exits.
Now most scripts we run will import basf2 which loads a compiled python extension that is linked against the root libraries.
This worked well with GCC 8, python 3.6 and 6.16. But now trying to upgrade to 6.20 we get a segfault in the cleanup procedure. According to valgrind, the gInterpreter is deleted before the cleanup in Cppyy.cc can finish.
For reasons I don't understand, loading of our compiled python extension with our binary (which is also linked against ROOT) seems to change the destruction order. I added some printouts to constructors and destructor calls:
- running a python script which doesn't do anything works fine