Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-11025

Issue with automatic C++ wrapper during inheritance (to replace TPySelector)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: master, 6.22/02
    • Fix Version/s: master, 6.22/04
    • Component/s: Cling, PyROOT
    • Labels:
      None
    • Environment:

      Centos7, Python2/3

      Description

      In order to inherit from TSelector, old PyROOT provided the TPySelector class so that calls from C++ would be redirected to Python for those methods overridden in Python.

      This should not be necessary in the new PyROOT, since cppyy implements the automatic generation of a C++ wrapper class during inheritance Python/C++ . Such class inherits from the C++ base class and redirects any call to Python for overridden methods in Python. Therefore, making the Python class inherit directly from TSelector should be sufficient.

      However, when making a Python class inherit directly from TSelector, an error occurs. For example, the following code:

      import ROOT
       
      class MyPySelector(ROOT.TSelector):
          pass
      

      throws

      Traceback (most recent call last):
        File "simplets.py", line 3, in <module>
          class MyPySelector(ROOT.TSelector):
      KeyError: 'fOutput'
      

      fOutput is a protected data member of TSelector, which makes the C++ wrapper class generated during inheritance include using TSelector::fOutput;. Therefore, this issue is related to ROOT-10872, i.e. the problem with the using declarations.

        Attachments

          Activity

            People

            Assignee:
            etejedor Enric Tejedor Saavedra
            Reporter:
            etejedor Enric Tejedor Saavedra
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: