GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Enum with `str` or `int` Mixin Breaking Change in Python 3.11 · Issue #100458 · python/cpython Closed batfish/pybatfish #902Closed Copy link Labels 3.11only security fixesonly security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportLooks like there was a breaking change with the way str and int mixins work with Enums in Python 3.11: from enum import Enum class Foo(str, Enum): BAR = "bar" # Python 3.10 f"{Foo.BAR}" # > bar # Python 3.11 f"{Foo.BAR}" # > Foo.BAR The same goes for Enum classes with the In my project we were relying on Foo.BAR to return the enum value, so this change broke our code. We fixed it by replacing str Enum mixin with the newly added StrEnum class (thanks for that, it's exactly what we needed!). I think reverting the breaking change would only introduce another breaking change so that's probably not the way to go. But maybe updating the whatsnew page and call out the change there could help people stumbling into this when doing the upgrade. I've found the existing point about this change in the release notes a little bit confusing and I have already opened a PR to try and clear it up a bit: #100387 I've also written a longer blog post about it here, and there has been some lively discussion in r/python. Your environment
Linked PRsReacted by Juan Estevez, Chase Sterling, JosephSBoyle, Andrey Semakin, Vianney Mixtur, lisez, Noam Miko Tamir, jkbrzt, Jérémy Anger, Tomasz Wesołowski and 16 more Activity
MetadataMetadataAssigneesLabels3.11only security fixesonly security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error Projects
MilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |