From e3406a501e8a0266426bc3586dfa4cdcf3e199bd Mon Sep 17 00:00:00 2001 From: Enric Tejedor Saavedra <enric.tejedor.saavedra@cern.ch> Date: Thu, 10 Jan 2019 13:30:12 +0100 Subject: [PATCH] [ROOT-9789] Re-inject GetObject pythonization in TDirectoryFile Since TDirectoryFile redefines GetObject, we need to re-inject its pythonization (which is added to TDirectory too). Otherwise, invoking GetObject on TDirectoryFile will not access the pythonization when a template proxy is added to TDirectoryFile for GetObject. --- bindings/pyroot/src/Pythonize.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bindings/pyroot/src/Pythonize.cxx b/bindings/pyroot/src/Pythonize.cxx index 6dd1c6bee9c..22ae9f0e816 100644 --- a/bindings/pyroot/src/Pythonize.cxx +++ b/bindings/pyroot/src/Pythonize.cxx @@ -2660,6 +2660,9 @@ Bool_t PyROOT::Pythonize( PyObject* pyclass, const std::string& name ) // add safety for non-TObject derived Get() results Utility::AddToClass( pyclass, "Get", (PyCFunction) TDirectoryFileGet, METH_O ); + // Re-inject here too, since TDirectoryFile redefines GetObject + Utility::AddToClass(pyclass, "GetObject", (PyCFunction)TDirectoryGetObject); + return kTRUE; } @@ -2745,7 +2748,6 @@ Bool_t PyROOT::Pythonize( PyObject* pyclass, const std::string& name ) // allow member-style access to entries in file Utility::AddToClass( pyclass, "__getattr__", (PyCFunction) TFileGetAttr, METH_O ); - } else if ( name.substr(0,8) == "TVector3" ) { -- GitLab