Vector<vector<string>> issues

I have a problem using vector<vector<>> in root 5.27.04. The same code works without issue in root 5.26.00. (Both use python 2.5.4.) The following test code illustrates the problem:

import ROOT

vtype = “vector<vector >”

try:
a=getattr(ROOT,vtype)()
except AttributeError:
fn=vtype.replace(’>’,’’).replace(’<’,’’).replace(’ ‘,’_’)+’.C’
f=open(fn,“w”)
f.write("#include \n#ifdef MAKECINT\n#pragma link C++ class %s+;\n#endif\n" % vtype)
f.close()
ROOT.gROOT.ProcessLine(".L %s+" % fn)

a=getattr(ROOT,vtype)()

print a

With root 5.27.04 this gives a segmentation fault. What changes are necessary to make this work with 5.27?

Hi,

looks like TClass::GetClass() is going bananas:

#0 0xb7d3e9e7 in ?? () from /lib/libc.so.6 #1 0xb7d410ba in malloc () from /lib/libc.so.6 #2 0xb5c8a525 in operator new(unsigned int) () from /usr/lib/libstdc++.so.6 #3 0xb5c63a65 in std::string::_Rep::_S_create(unsigned int, unsigned int, std::allocator<char> const&) () from /usr/lib/libstdc++.so.6 #4 0xb5c6472f in std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned int) () from /usr/lib/libstdc++.so.6 #5 0xb5c655de in std::string::reserve(unsigned int) () from /usr/lib/libstdc++.so.6 #6 0xb5c65acf in std::string::append(std::string const&) () from /usr/lib/libstdc++.so.6 #7 0xb75c1e87 in TClassEdit::IsDefAlloc(char const*, char const*) () from /home/wlav/rootdev/root/lib/libCore.so #8 0xb75c42aa in TClassEdit::TSplitType::ShortType(std::string&, int) () from /home/wlav/rootdev/root/lib/libCore.so #9 0xb75c3941 in TClassEdit::ShortType(char const*, int) () from /home/wlav/rootdev/root/lib/libCore.so #10 0xb75c3bf2 in TClassEdit::TSplitType::ShortType(std::string&, int) () from /home/wlav/rootdev/root/lib/libCore.so #11 0xb75c3941 in TClassEdit::ShortType(char const*, int) () from /home/wlav/rootdev/root/lib/libCore.so #12 0xb75798a9 in TClass::GetClass(char const*, bool, bool) () from /home/wlav/rootdev/root/lib/libCore.so #13 0xb7501bbc in TROOT::LoadClass(char const*, bool) const () from /home/wlav/rootdev/root/lib/libCore.so #14 0xb7579707 in TClass::GetClass(char const*, bool, bool) () from /home/wlav/rootdev/root/lib/libCore.so #15 0xb7501bbc in TROOT::LoadClass(char const*, bool) const () from /home/wlav/rootdev/root/lib/libCore.so #16 0xb7579707 in TClass::GetClass(char const*, bool, bool) () from /home/wlav/rootdev/root/lib/libCore.so #17 0xb7501bbc in TROOT::LoadClass(char const*, bool) const () from /home/wlav/rootdev/root/lib/libCore.so #18 0xb7579707 in TClass::GetClass(char const*, bool, bool) () from /home/wlav/rootdev/root/lib/libCore.so etc. etc. etc.
I’ll have a look, but most probably a missing ‘std::’ here or there.

Cheers,
Wim

Hi,

well, I can’t find a combination std::'s (or not) that would work, but a brute force:

as the first line in the AttributeError except clause works for me …

HTH,
Wim

Thank you, that worked.