diff --git a/bindings/pyroot/pythonizations/python/ROOT/_facade.py b/bindings/pyroot/pythonizations/python/ROOT/_facade.py index 8cbe7007b5089..69a936e271808 100644 --- a/bindings/pyroot/pythonizations/python/ROOT/_facade.py +++ b/bindings/pyroot/pythonizations/python/ROOT/_facade.py @@ -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: diff --git a/bindings/pyroot/pythonizations/src/PyROOTModule.cxx b/bindings/pyroot/pythonizations/src/PyROOTModule.cxx index c8d04202af239..664a95e5aa0c1 100644 --- a/bindings/pyroot/pythonizations/src/PyROOTModule.cxx +++ b/bindings/pyroot/pythonizations/src/PyROOTModule.cxx @@ -20,6 +20,7 @@ #include "../../cppyy/CPyCppyy/src/ProxyWrappers.h" // ROOT +#include "TInterpreter.h" #include "TROOT.h" #include "TSystem.h" #include "RConfigure.h" @@ -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());