pyelftools icon indicating copy to clipboard operation
pyelftools copied to clipboard

Access enums as enums, not strings?

Open rossburton opened this issue 6 years ago • 1 comments

It would be nice if enums such as E_MACHINE were exposed as Python enum.Enum instead of strings?

>>> elf = elftools.elf.elffile.ELFFile(open("/usr/bin/find", "rb"))
>>> elf.header.e_machine
'EM_X86_64'
>>> type(elf.header.e_machine)
<class 'str'>

https://docs.python.org/3/library/enum.html

Yes, this means Python 3.4 onwards only. Considering at the time of writing Python 2 is EOL in 20 days, is this still an issue?

rossburton avatar Dec 11 '19 00:12 rossburton

I'd prefer not to do breaking changes at this point. If this can be packaged as a non-breaking change, I will consider accepting a PR when Python 2 officially EOLs.

eliben avatar Dec 12 '19 13:12 eliben