You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems the pull request (#108704) that tried to handle erroneous calls to Enum.__new__ introduced some other behavior as well. In a few projects that I'm involved with we use this pattern:
where calling Result(0) would return CommonResult.OK. Now in 3.11.6 and onwards this throws a TypeError. Was this intentional? It's a nice pattern to have and there are to me no obvious ways to replace it with something as elegant, so I hope that it can be solved some other way (maybe by checking if the class actually overrides __new__ and if not, then allowing the call to _missing_?)
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux, Windows
The text was updated successfully, but these errors were encountered:
Found a workaround which is not horrible. I still think that it would be nice for a few other use cases if the _missing_ pattern worked, but if anyone else needs it, here's a solution that replicates what at least I did:
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
It seems the pull request (#108704) that tried to handle erroneous calls to
Enum.__new__
introduced some other behavior as well. In a few projects that I'm involved with we use this pattern:where calling
Result(0)
would returnCommonResult.OK
. Now in 3.11.6 and onwards this throws a TypeError. Was this intentional? It's a nice pattern to have and there are to me no obvious ways to replace it with something as elegant, so I hope that it can be solved some other way (maybe by checking if the class actually overrides__new__
and if not, then allowing the call to_missing_
?)CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux, Windows
The text was updated successfully, but these errors were encountered: