Enums are not correctly resolved by PyROOT when using an alias within a class/struct
- [x] Checked for duplicates
Describe the bug
PyROOT is not able correctly resolve an enum when it is aliased in a struct.
Expected behavior
Giving a different name to the enum should not cause PyROOT to fail to correctly resolve it.
To Reproduce
Python 3.9.6 (default, Sep 6 2021, 15:36:22)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> gROOT = ROOT.gROOT
>>> gROOT.ProcessLine('enum Enum { a,b,c }')
0
>>> ROOT.Enum
<class 'ROOT._facade.Enum'>
>>> ROOT.Enum.a
0
>>> ROOT.Enum.b
1
>>>> gROOT.ProcessLine('struct Track { using Type = Enum; }')
0
>>> ROOT.Track.Type.a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'int' has no attribute 'a'
>>> ROOT.Enum.a
0
>>>
Setup
ROOT 6.24.06 from LCG101 on CentOS7
Additional context
@martamaja10
slight ping because this has been open for nearly two years now, and still has this problem more recent ROOT versions
Thanks @paguenther for the ping! PyROOT uses cppyy to create the automatic Python bindings, so these kind of problems are good to also post there:
https://github.com/wlav/cppyy/issues/214
Maybe also related: https://github.com/root-project/cling/issues/521