Incomplete Python bindings under GCC9

ROOT Version: 6.18/04
Platform: CentOS 7
Compiler: GCC 9

I’m seeing that the Python bindings of std::set are different depending on the compiler version and how I import the std namespace. There may be other differences, but the one I bumped in to was std::set iteration being missing on GCC 9.

I have this test script that creates an std::set<int>, fills it, asserts it is not empty, converts it to a Python list, and then asserts the list is not empty:

import sys

method = sys.argv[-1].lower()
if sys.argv[-1] == 'root':
    import ROOT
    std = ROOT.std
elif sys.argv[-1] == 'cppyy':
    import cppyy
    std = cppyy.gbl.std
    print('Unknown method')

s = std.set(int)()
nentries = 5
for i in range(nentries):
assert s.size() == nentries, s
l = list(s)
assert len(l) == nentries, l

My environment is an LCG view, version 96b (ROOT 6.18/04). With platform x86_64-centos7-gcc8-opt:

$ source /cvmfs/ LCG_96b x86_64-centos7-gcc8-opt
$ python root
$ python cppyy

The issue is that if I run from a GCC9 view, the cppyy method fails. With platform x86_64-centos7-gcc9-opt:

$ source /cvmfs/ LCG_96b x86_64-centos7-gcc9-opt
$ python root
$ python cppyy
Traceback (most recent call last):
  File "", line 20, in <module>
    assert len(l) == nentries, l
AssertionError: []

I do not see the problem on x86_64-centos7-gcc9-dbg, x86_64-centos7-gcc62-opt, nor x86_64-centos7-clang8-opt

Thank you for reporting, actually we got a ticket today that seems related:

I propose to follow it up there.


Indeed, this is the same underlying issue (missing iterator bindings).


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.