PyROOT hangs loading libraries


I just figured out a workaround for this issue, but I’d like to ask if there’s something more fundamentally wrong here. All the stuff below is using ROOT v5.34.04.

I’ve been having problems with PyROOT and loading external .so files (specifically using RootCore and the script). I compile multiple library files, each with its own LinkDef.h file, and load them with:

This script works fine in a CINT session, except for a warning message about a duplicate entry in the TClassTable:

root [3] .x $ROOTCOREDIR/scripts/load_packages.C+
[load_packages] Loading ApplyJetCalibration
[load_packages] Loading D3PDReader
[load_packages] Loading GoodRunsLists
Warning in <TClassTable::Add>: class pair<TString,TString> already in TClassTable

However, when the same script is called from PyROOT, the program simply hangs:

Python code:

import os
import sys
import glob
import re
import ROOT
from ROOT import *
gROOT.ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+")


[load_packages] Loading ApplyJetCalibration
[load_packages] Loading D3PDReader
[load_packages] Loading GoodRunsLists
<<hangs here indefinitely>>

I was able to solve the problem by removing the duplicate entry in the TClassTable from the relevant LinkDef.h files. I.e. the following line was contained in multiple LinkDef.h files, and I deleted it from all but the first library loaded:

#pragma link C++ class pair<TString,TString>+;

However, it certainly seems less than ideal that PyROOT simply halts here, rather than throwing a warning and continuing as in the CINT case. Is this a known issue, and is there a better solution than having to comb through all of my LinkDef.h files and remove the duplicate entries?

Thanks much,


there are a few cases (deep in ROOT/meta) that are known to cause infinite loops, but that’d not hang forever: you’d run out of stack space well before that.

Do you have an easy way to reproduce the problem, though? I tried based on your description, but then I only get the warning, no hanging.