Skip to content

Commit

Permalink
[PyROOT] Ensure gInterpreter is initialized once gROOT has been initi…
Browse files Browse the repository at this point in the history
…alized
  • Loading branch information
vepadulano authored and guitargeek committed Nov 12, 2024
1 parent 871c514 commit 990c31e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bindings/pyroot/pythonizations/python/ROOT/_facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ def _finalSetup(self):
# Prevent this method from being re-entered through the gROOT wrapper
self.__dict__["gROOT"] = cppyy.gbl.ROOT.GetROOT()

# Make sure the interpreter is initialized once gROOT has been initialized
cppyy.gbl.TInterpreter.Instance()

# Setup interactive usage from Python
self.__dict__["app"] = PyROOTApplication(self.PyConfig, self._is_ipython)
if not self.gROOT.IsBatch() and self.PyConfig.StartGUIThread:
Expand Down
4 changes: 4 additions & 0 deletions bindings/pyroot/pythonizations/src/PyROOTModule.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "../../cppyy/CPyCppyy/src/ProxyWrappers.h"

// ROOT
#include "TInterpreter.h"
#include "TROOT.h"
#include "TSystem.h"
#include "RConfigure.h"
Expand Down Expand Up @@ -166,6 +167,9 @@ extern "C" PyObject *PyInit_libROOTPythonizations()
// Memory management
gROOT->GetListOfCleanups()->Add(&GetRegulatorCleanup());

// Make sure the interpreter is initialized once gROOT has been initialized
TInterpreter::Instance();

// signal policy: don't abort interpreter in interactive mode
CallContext::SetGlobalSignalPolicy(!gROOT->IsBatch());

Expand Down

0 comments on commit 990c31e

Please sign in to comment.