From 8f80c772d78a09e88893721b950c2b330d6029bc Mon Sep 17 00:00:00 2001
From: TJ Khoo <khoo@cern.ch>
Date: Fri, 7 Dec 2018 21:04:21 +0100
Subject: [PATCH] Change to use isinstance for type checking. Handle public and
 private toolhandle arrays better.

Former-commit-id: 08a607f42e3084358dabf57b40ff2b67c9e439c7
---
 .../python/ComponentAccumulator.py                  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py
index a4d253ad2ba..d100edbfac6 100644
--- a/Control/AthenaConfiguration/python/ComponentAccumulator.py
+++ b/Control/AthenaConfiguration/python/ComponentAccumulator.py
@@ -7,7 +7,7 @@ from AthenaCommon.AlgSequence import AthSequencer
 
 from AthenaConfiguration.AthConfigFlags import AthConfigFlags
 import GaudiKernel.GaudiHandles as GaudiHandles
-from GaudiKernel.GaudiHandles import PublicToolHandle, PublicToolHandleArray, ServiceHandle, PrivateToolHandle
+from GaudiKernel.GaudiHandles import PublicToolHandle, PublicToolHandleArray, ServiceHandle, PrivateToolHandle, PrivateToolHandleArray
 import ast
 import collections
 
@@ -72,10 +72,13 @@ class ComponentAccumulator(object):
                     continue
 
                 propstr = str(propval)
-                if propval.__class__ == PublicToolHandleArray:
-                    ths = [str(th) for th in propval]
+                if isinstance(propval,PublicToolHandleArray):
+                    ths = [th.getFullName() for th in propval]
                     propstr = "PublicToolHandleArray([ {0} ])".format(', '.join(ths))
-                elif ConfigurableAlgTool in propval.__class__.__bases__:
+                elif isinstance(propval,PrivateToolHandleArray):
+                    ths = [th.getFullName() for th in propval]
+                    propstr = "PrivateToolHandleArray([ {0} ])".format(', '.join(ths))
+                elif isinstance(propval,ConfigurableAlgTool):
                     propstr = propval.getFullName()
                 self._msg.info( " "*nestLevel +"    * {0}: {1}".format(propname,propstr) )
             return
@@ -426,7 +429,7 @@ class ComponentAccumulator(object):
                     existingAlg = findAlgorithm( dest, c.name(), depth=1 )
                     if existingAlg:
                         if existingAlg != c: # if it is the same we can just skip it, else this indicates an error
-                            raise ConfigurationError( "Duplicate algorithm %s in source and destination sequences %s" % ( c.name(), src.name()  ) )           
+                            raise ConfigurationError( "Duplicate algorithm %s in source and destination sequences %s" % ( c.name(), src.name()  ) )
                     else: # absent, adding
                         self._msg.debug("  Merging algorithm %s to a sequence %s", c.name(), dest.name() )
                         dest += c
-- 
GitLab