-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
AttributeError in 3.11 on repr() of enum member if the enum has a non-Enum EnumType parent #102558
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
Comments
Reproduced also on Linux in case it's important: |
Wow, this must be the fastest fix I've ever seen implemented in response to a random dude's complaint in the history of paid SLA contracts. Oh wait, I don't have any contract. Kudos and thanks. |
@ethanfurman |
…onGH-102601) (cherry picked from commit bd06375) Co-authored-by: Dong-hee Na <[email protected]>
Merging in the work-around; will investigate further as time allows. |
(cherry picked from commit bd06375) Co-authored-by: Dong-hee Na <[email protected]>
@vashek What is your actual use-case for that coding style? Making a non- |
@ethanfurman Now I feel a bit silly, because it seems like I brought it upon myself completely needlessly and wasted your time. Sorry. What I'm doing is I have a class with some class methods for enums, and then I'm mixing it into the actual enums. I guess when I did that, my thought process was "if I'm going to mix in another class into the enum, and the enum has a special metaclass, surely I can't just use an ordinary class with its ordinary metaclass -- surely the mixed-in classes must have a common metaclass". Now that I googled and read up on the subject, I think I now understand that this would have only been a problem if my base class used a different metaclass. I don't remember whether I had ever tried it without the metaclass -- maybe I haven't. I tried now and it seems to work fine. I mean the fix is still nice, but I suppose the "bug" was only ever encountered by me and completely unnecessarily anyway, apparently. |
No worries, glad it ended up being an easy fix for us both. |
Thanks, looks like this was fixed and backported! |
…ythonGH-103060) (cherry picked from commit f4ed2c6) Co-authored-by: Ethan Furman <[email protected]>
…3060) (cherry picked from commit f4ed2c6) Co-authored-by: Ethan Furman <[email protected]>
Bug report
In CPython 3.11.0 - 3.11.2 (but not 3.10.10), I get a weird AttributeError when repr() is called on an Enum member of a class that was defined using multiple inheritance. Minimal code to reproduce:
With Python up to 3.10, the output is:
With Python 3.11, the output is:
Your environment
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
(But reproduced also on 3.11.2)
Linked PRs
The text was updated successfully, but these errors were encountered: