Skip to content

Commit 67cf7c3

Browse files
committed
fix: guard ROOT v6.34 SwapWithObjAtAddr, fall back to bind_object/swap
1 parent 8828eb6 commit 67cf7c3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

DDCore/src/python/PythonPlugin.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <DD4hep/Printout.h>
1818

1919
// ROOT includes
20+
#include <RVersion.h>
2021
#include <TPython.h>
2122

2223
// C++ includes
@@ -237,8 +238,13 @@ namespace {
237238
<< "except Exception:\n"
238239
<< " import traceback; traceback.print_exc()\n"
239240
<< " raise\n"
241+
#if ROOT_VERSION_CODE >= ROOT_VERSION(6,34,0)
240242
<< "cppyy.gbl.ROOT.Internal.SwapWithObjAtAddr['dd4hep::DetElement']"
241243
<< "(_dd4hep_py_det, " << res_addr << ")\n";
244+
#else
245+
<< "_dd4hep_py_res = cppyy.bind_object(" << res_addr << ", 'dd4hep::DetElement')\n"
246+
<< "cppyy.gbl.std.swap(_dd4hep_py_det, _dd4hep_py_res)\n";
247+
#endif
242248

243249
if (!TPython::Exec(script.str().c_str())) {
244250
except(factory_name, "+++ Python function %s.%s failed", mod.c_str(), func.c_str());

0 commit comments

Comments
 (0)