Closed ysangkok closed 1 year ago
strange, i don't get this error (clearly)... but i'm using python 3.10
I don't understand why this error, the TokenType enum has the @unique
decorator. AND the token types that it complains about having dupe values are both values set by auto
https://docs.python.org/3/library/enum.html#enum.auto
but we know this parts of the python Enum got intervened between 3.10 and 3.11.
Changed in version 3.11.1: In prior versions, auto() had to be the only thing on the assignment line to work properly.
something warrants a deeper dive... without having yet figured this out, I blame python, it's their bug my code is perfect 😂😅
In python 3.10 there is no such a thing as StrEnum
... so why should adding a new kind of Enum, break older python Enums that used to work fine? https://docs.python.org/3/library/enum.html#enum.StrEnum
Yeah, it's weird that the 3.11 changelog doesn't mention changes to auto
...
it's a python bug, a regression of some kind. They have been tweaking enum.py
https://github.com/python/cpython/issues/91456 https://github.com/python/cpython/pull/91457#
How can it be an existing bug in 3.11.3 if both of those are marked fixed/merged in 2022 and 3.11.3 was released last month?
it's an exisiting bug cuz we just found it, but it's not a known bug, so far as I've looked.
Ah, ok, I understand. Looking at the 91456, that is about aliases, which you don't have. And 91457 was backported as 94156 (note how that is not 91456) which suggests that it should only emit a DeprecationWarning but still work, which it doesn't.
so I suppose that your solution, of using StrEnum
instead of Enum
is THE workaround... but Python should not break like this between 3.10 and 3.11....
all that remains if filling the bug report to Python. https://github.com/python/cpython/issues/104271
I made a fix for this, but I haven't bothered to update my local python version, could you test it?
on commit bf4507bfcb25a5d734cb2e54d9cf59e8ccee5c78
trying the command in the readme is erroring
Changing Enum to StrEnum seems to work.