-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
My package does not use pybind11 hacky enums, but instead derives enums from enum.Enum
using a popular helper macro.
However, in that case the generated stub does not contain some values, the ones that are considered non-canonical (as defined in this comment). These are zero values (maybe just in enum.Flag
) and repeated/alias values.
I haven't looked at the implementation, but the issue is probably related to this: python/cpython#109633. If I'm correct, the issue can probable be fixed by iterating over the __members__
of the enum class.
Example of what I mean:
>>> list(iter(InputMode))
[<InputMode.UNICODE: 1>,
<InputMode.GS1: 2>,
<InputMode.ESCAPE: 8>,
<InputMode.GS1PARENS: 16>,
<InputMode.GS1NOCHECK: 32>,
<InputMode.HEIGHTPERROW: 64>,
<InputMode.FAST: 128>,
<InputMode.EXTRA_ESCAPE: 256>]
>>> InputMode.__members__
mappingproxy({'DATA': <InputMode.DATA: 0>,
'UNICODE': <InputMode.UNICODE: 1>,
'GS1': <InputMode.GS1: 2>,
'ESCAPE': <InputMode.ESCAPE: 8>,
'GS1PARENS': <InputMode.GS1PARENS: 16>,
'GS1NOCHECK': <InputMode.GS1NOCHECK: 32>,
'HEIGHTPERROW': <InputMode.HEIGHTPERROW: 64>,
'FAST': <InputMode.FAST: 128>,
'EXTRA_ESCAPE': <InputMode.EXTRA_ESCAPE: 256>})
As you can see, with iter()
, the DATA
value is missing.
Metadata
Metadata
Assignees
Labels
No labels