[RF] Deletion order of objects in RooFit/RooStats tutorials should not matter in Python
Different from C++, any objects created in Python are not deleted in the inverse order of their creation.
This causes crashes in some RooFit user code, for examples when some object has only a non-owing reference/pointer as a data member, this data member is used in the constructor, and then the referenced object is destructed first.
Hence, the user is sometimes forced to use del explicitly in Python, for example in these tutorials:
rf207_comptools.py: https://github.com/root-project/root/blob/master/tutorials/roofit/rf207_comptools.py#L116rf514_RooCustomizer.py: https://github.com/root-project/root/blob/master/tutorials/roofit/rf514_RooCustomizer.py#L95rs101_limitexample.py: https://github.com/root-project/root/blob/master/tutorials/roostats/rs101_limitexample.py#L184
The RooFit/RooStats code needs some Pythonizations that manage ownership such that the deletion order doesn't matter anymore.
These problems are probably similar to the ones reported for TMVA in this forum post: https://root-forum.cern.ch/t/tmva-crossvalidation-crashes-on-destructor-pyroot/51195
Just like in that post, using valgrind could help. Or running the Python tutorials with an ASAN build.