Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enums are not correctly resolved by PyROOT when using an alias within a class/struct #9246

Open
1 task done
paguenther opened this issue Nov 5, 2021 · 4 comments
Open
1 task done

Comments

@paguenther
Copy link

paguenther commented Nov 5, 2021

  • 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

@paguenther
Copy link
Author

@martamaja10

@paguenther
Copy link
Author

paguenther commented Oct 20, 2023

slight ping because this has been open for nearly two years now, and still has this problem more recent ROOT versions

@guitargeek
Copy link
Contributor

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:
wlav/cppyy#214

@ferdymercury
Copy link
Contributor

Maybe also related: root-project/cling#521

@guitargeek guitargeek assigned aaronj0 and unassigned etejedor Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants