Skip to content

[cppyy] New crash when iterating over polymorphic std::vector #19267

Open
@Nowakus

Description

@Nowakus

Check duplicate issues.

  • Checked for duplicates

Description

Starting around 24/06/2025 a new crash appeared in 10 years old code where we iterate in python over an std::vector of polymorphic objects created on the C++ side. The inheritance structure is 4 levels deep and contains virtual inheritance that is apparently the reason cppyy trips. The iteration is the faulty part - single object uses work fine.

Reproducer

For now just quick copy/paste to give the overall feel of the situation:
Here's a brief summary of the inheritance hierarchy:

class Analysis::JetFitterTagInfo : public virtual Analysis::IJetFitterTagInfo
class Analysis::IJetFitterTagInfo : public virtual Analysis::BaseTagInfo
class Analysis::BaseTagInfo : public JetTagInfoBase
class JetTagInfoBase : public Analysis::ITagInfo

 class TagInfoTest {   public:
      typedef std::vector<const JetTagInfoBase*>       tagstore_t;
      const tagstore_t makeInfoVector(const char* tag) const {
         tagstore_t store;
         store.push_back( new Analysis::BaseTagInfo(tag) );
         store.push_back( new Analysis::JetFitterTagInfo(tag) );
         return store;
      }
   }; 

>>> import ROOT
>>> for i in ROOT.TagInfoTest().makeInfoVector('bla'):
...   print( i.infoType() )
... 
bla
free(): invalid pointer
 *** Break *** abort

ROOT version

master

Installation method

ATLAS

Operating system

Linux

Additional context

No response

Metadata

Metadata

Labels

bugexperimentAffects an experiment / reported by its software & computimng expertsin:Python InterfaceregressionThis issue was not present in a previous releases of ROOT

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions