From caf6e4fa3319a99a45a42db669aaff28e2ee9ba0 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Tue, 9 Sep 2025 15:51:24 +0200 Subject: [PATCH] [PyROOT] Remove a test that worked just by chance. The test broke when implicit object ownership was switched off in ROOT. However, this test can also break in other circumstances, because del histogram generally does not destroy the C++ object immediately. It used to work because only a single reference to the object was alive (which changed when trying to prepare the test for implicit object ownership off), but one cannot base a test on undocumented details of a Python implementation. For this reason, it does not make sense to test if gDirectory (C++) contains an entry for the object that was just "del"-ed. --- roottest/python/memory/PyROOT_memorytests.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/roottest/python/memory/PyROOT_memorytests.py b/roottest/python/memory/PyROOT_memorytests.py index d1c7cbd6c0ed8..d5ce70dcdc0ab 100644 --- a/roottest/python/memory/PyROOT_memorytests.py +++ b/roottest/python/memory/PyROOT_memorytests.py @@ -60,21 +60,6 @@ def test1ObjectCreationDestruction( self ): del b, c self.assertEqual( MemTester.counter, 0 ) - def test2ObjectDestructionCallback( self ): - """Test ROOT notification on object destruction""" - - # create ROOT traced object - a = TH1F( 'memtest_th1f', 'title', 100, -1., 1. ) - - # locate it - self.assertTrue( a is gROOT.FindObject( 'memtest_th1f' ) ) - - # destroy it - del a - - # should no longer be accessible - self.assertTrue( not gROOT.FindObject( 'memtest_th1f' ) ) - def test3ObjectCallHeuristics( self ): """Test memory mgmt heuristics for object calls""" @@ -139,7 +124,7 @@ def test4DestructionOfDerivedClass( self ): """Derived classes should call base dtor automatically""" MemTester = ROOT.MemTester - + class D1( MemTester ): def __init__( self ): MemTester.__init__( self )