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
{{ message }}
Repository navigation
Enum _missing_ function changes __contains__ behaviour #132684
I am fairly certain this is a side effect of #131053, but I'm not sure what the correct behavior should be. @picnixz@ethanfurman, what are your thoughts?
Arf... this is something I didn't think of. This can be pretty annoying and we could also need to revert it in 3.12 :< I'll mark it as a release-blocker for now to draw attention.
In other words, if Weekday(x) would return a valid member, then x in Weekday should return True.
Now, here Color("blue") returns Color.RED. So... if we were to follow the same logic, "blue" in Color would still be correct. I'm not entirely sure whether we need to fix this or not but I know for sure that sometimes we do checks of the form x in ENUM and depending on how the ENUM is being done, we may or may not have broken some code out there.
We can still ask @Yhg1s if he would consider the bugfix as an incomplete bugfix then (considering we broke something =/) and backport your recent bugfix.
However, something to keep in mind is that as a security fix release, we won't be distributing installers for Windows / macOS.
Hum. Then I don't know then. This could be quite annoying if it's an OS-dependant stuff. I think it's better to tell people to upgrade to Python 3.13 in this case.
That being said, I attempted a backport and it broke 21 old tests, so I decided it's not worth fiddling with it and breaking it even more. After speaking with Thomas, we are aborting the 3.12 backport.
Activity
noamcohen97 commentedon Apr 18, 2025
I am fairly certain this is a side effect of #131053, but I'm not sure what the correct behavior should be.
@picnixz @ethanfurman, what are your thoughts?
picnixz commentedon Apr 18, 2025
Arf... this is something I didn't think of. This can be pretty annoying and we could also need to revert it in 3.12 :< I'll mark it as a release-blocker for now to draw attention.
picnixz commentedon Apr 18, 2025
Actually, Ethan said on the previous issue:
Now, here
Color("blue")returnsColor.RED. So... if we were to follow the same logic,"blue" in Colorwould still be correct. I'm not entirely sure whether we need to fix this or not but I know for sure that sometimes we do checks of the formx in ENUMand depending on how the ENUM is being done, we may or may not have broken some code out there.s3rius commentedon Apr 18, 2025
I guess it makes total sense, because usually you only check that the value is present in the enum to create its member.
But if you really want to mimic the behavior of 3.12 then you can use this workaround:
noamcohen97 commentedon Apr 18, 2025
Perhaps we should simply document the change in behavior?
picnixz commentedon Apr 18, 2025
If possible, yes, but it's also sad that the behavior of some constructions have been broken in a stable release.
1 remaining item
ethanfurman commentedon Apr 22, 2025
3.12 is in security-only mode, unfortunately.
picnixz commentedon Apr 24, 2025
We can still ask @Yhg1s if he would consider the bugfix as an incomplete bugfix then (considering we broke something =/) and backport your recent bugfix.
gh-132684: [Enum] only call _missing_ in __contains__ for Flags (GH-1…
pythongh-132684: [Enum] only call _missing_ in __contains__ for Flags (…
[3.13] gh-132684: [Enum] only call _missing_ in __contains__ for Flags (
hugovk commentedon May 5, 2025
(Noting this is release-blocker for 3.12, not 3.14 or 3.13)
Yhg1s commentedon Jun 2, 2025
Yeah, fine, get this backport in the next release if you want.
However, something to keep in mind is that as a security fix release, we won't be distributing installers for Windows / macOS.
picnixz commentedon Jun 2, 2025
Hum. Then I don't know then. This could be quite annoying if it's an OS-dependant stuff. I think it's better to tell people to upgrade to Python 3.13 in this case.
ambv commentedon Jun 3, 2025
It's not "OS-dependent", we simply don't provide installers for the fix, but you can still get them through ActiveState or Anaconda or winpython or...
ambv commentedon Jun 3, 2025
That being said, I attempted a backport and it broke 21 old tests, so I decided it's not worth fiddling with it and breaking it even more. After speaking with Thomas, we are aborting the 3.12 backport.
ethanfurman commentedon Jun 3, 2025
Thanks for trying.