From 1f829f41a1342b9916ac560b35f137a4a1d069d3 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Thu, 16 Jul 2026 21:58:51 +0000 Subject: [PATCH] [RF] Delete fit objects before continuing in rs401d_FeldmanCousins.py Similar to 49fb353caf7. The Python version of this tutorial sporadically crashes on CI with the upcoming cppyy upgrade. It is the same overlapping-heap-ownership problem that was worked around for `rf619_discrete_profiling.py` in 49fb353caf7. The nll/pll pair used for the likelihood surface in pad 3 is not needed after that plot. Deleting it right there tears down the NLL evaluation machinery at a well-defined point instead of at interpreter shutdown, where the order of cleanups is less controlled. With this change the previously deterministic poisoned repro (4/4 crashing) passes 3/3, and plain and ctest invocations pass as well. --- tutorials/roofit/roostats/rs401d_FeldmanCousins.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tutorials/roofit/roostats/rs401d_FeldmanCousins.py b/tutorials/roofit/roostats/rs401d_FeldmanCousins.py index 55a21e81a9b6f..9db04dacfebe5 100644 --- a/tutorials/roofit/roostats/rs401d_FeldmanCousins.py +++ b/tutorials/roofit/roostats/rs401d_FeldmanCousins.py @@ -164,6 +164,12 @@ def rs401d_FeldmanCousins(doFeldmanCousins=False, doMCMC=True): dataCanvas.Draw() dataCanvas.SaveAs("3.png") + # The profile likelihood and the NLL are not needed anymore. Delete them + # already here, so that the NLL evaluation machinery is not torn down at + # interpreter shutdown, where the order of cleanups is less controlled. + del pll + del nll + # -------------------------------------------------------------- # show use of Feldman-Cousins utility in RooStats # set the distribution creator, which encodes the test statistic