From 59740448adc638f4219ebe618a51261b8f9ebfc1 Mon Sep 17 00:00:00 2001
From: Walter Lampl <Walter.Lampl@cern.ch>
Date: Mon, 17 Aug 2020 13:31:26 +0200
Subject: [PATCH] AthenaPython: Syntax adjustments for root v6.22 (PyException)

---
 Control/AthenaPython/CMakeLists.txt         | 2 +-
 Control/AthenaPython/src/PyAthenaUtils.cxx  | 6 +++---
 Control/AthenaPython/src/PyComponentMgr.cxx | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Control/AthenaPython/CMakeLists.txt b/Control/AthenaPython/CMakeLists.txt
index 222c1fc684cc..e248f15c17e7 100644
--- a/Control/AthenaPython/CMakeLists.txt
+++ b/Control/AthenaPython/CMakeLists.txt
@@ -5,7 +5,7 @@ atlas_subdir( AthenaPython )
 
 # External dependencies:
 find_package( Python COMPONENTS Development )
-find_package( ROOT COMPONENTS Core PyROOT )
+find_package( ROOT COMPONENTS Core PyROOT ROOTTPython cppyy3_7)
 
 # Component(s) in the package:
 atlas_add_library( AthenaPython
diff --git a/Control/AthenaPython/src/PyAthenaUtils.cxx b/Control/AthenaPython/src/PyAthenaUtils.cxx
index 56ff50344be2..c228f87abcc4 100644
--- a/Control/AthenaPython/src/PyAthenaUtils.cxx
+++ b/Control/AthenaPython/src/PyAthenaUtils.cxx
@@ -25,7 +25,7 @@
 
 // PyROOT includes
 #include "TPython.h"
-#include "TPyException.h"
+#include "CPyCppyy/PyException.h"
 
 // Reflex includes
 #include "DataModelRoot/RootType.h"
@@ -160,7 +160,7 @@ void PyAthena::throw_py_exception (bool display)
       Py_XDECREF (f);
     }
   }
-  throw PyROOT::TPyException();
+  throw CPyCppyy::PyException();
 }
 
 StatusCode 
@@ -383,7 +383,7 @@ void PyAthena::pyAudit ATLAS_NOT_THREAD_SAFE
   PyObject* pySc = TPython::CPPInstance_FromVoidPtr((void*)&sc,
 						    "StatusCode");
   if ( !pySc ) {
-    throw PyROOT::TPyException();
+    throw CPyCppyy::PyException();
   }
 
   PyObject* call = PyObject_CallMethod(self,
diff --git a/Control/AthenaPython/src/PyComponentMgr.cxx b/Control/AthenaPython/src/PyComponentMgr.cxx
index 893e93d2c9b5..da202f92dc09 100755
--- a/Control/AthenaPython/src/PyComponentMgr.cxx
+++ b/Control/AthenaPython/src/PyComponentMgr.cxx
@@ -29,7 +29,7 @@ SG_BASES1(PyObject, SG::NoBase);
 #include "AthenaPython/IPyComponent.h"
 
 // PyROOT includes
-#include "TPyException.h"
+#include "CPyCppyy/PyException.h"
 #include "TPython.h"
 
 using namespace PyAthena;
@@ -93,7 +93,7 @@ PyComponentMgr::initialize()
   if ( !module || !PyModule_Check( module ) ) {
     ATH_MSG_ERROR("Could not import [" << pyModuleName << "] !!");
     Py_XDECREF (module);
-    throw PyROOT::TPyException();
+    throw CPyCppyy::PyException();
   }
 
   const std::string pyClassName = "PyComponents";
@@ -200,7 +200,7 @@ PyComponentMgr::pyObject( IPyComponent* cppComp )
     ATH_MSG_ERROR("No such python component [" << name
                   << "] or invalid item !!");
     Py_XDECREF( o );
-    throw PyROOT::TPyException();
+    throw CPyCppyy::PyException();
   }
   m_components[name] = o;
 
-- 
GitLab