Skip to content

Commit 9a9e769

Browse files
committed
[Python] Don't call TClass::GetClass() on branch type in TTreePyz
It's not clear to me how it can even happen that TClass::GetClass() is `nullptr` for the type of a TTree branch. It looks like the check is superfluous, and by not doing it we can avoid the memory hogging of `GetClass()` for standard vector types. Closes #18524.
1 parent 9751316 commit 9a9e769

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

bindings/pyroot/pythonizations/src/TTreePyz.cxx

+2-3
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ static std::pair<void *, std::string> ResolveBranch(TTree *tree, const char *nam
8686

8787
// for return of a full object
8888
if (branch->IsA() == TBranchElement::Class() || branch->IsA() == TBranchObject::Class()) {
89-
TClass *klass = TClass::GetClass(branch->GetClassName());
90-
if (klass && branch->GetAddress())
89+
if (branch->GetAddress())
9190
return {*(void **)branch->GetAddress(), branch->GetClassName()};
9291

9392
// try leaf, otherwise indicate failure by returning a typed null-object
9493
TObjArray *leaves = branch->GetListOfLeaves();
95-
if (klass && !tree->GetLeaf(name) && !(leaves->GetSize() && (leaves->First() == leaves->Last())))
94+
if (!tree->GetLeaf(name) && !(leaves->GetSize() && (leaves->First() == leaves->Last())))
9695
return {nullptr, branch->GetClassName()};
9796
}
9897

0 commit comments

Comments
 (0)