-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
3.13bugs and security fixesbugs and security fixesstdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
On python 3.10-3.12, the following snippet prints True
, while on Python 3.13.0 it prints False
:
from enum import Enum
from functools import partial
def a():
pass
def b():
pass
class MyCallables(Enum):
A = a
B = partial(b)
print(MyCallables.B in MyCallables)
This is because MyCallables.B
is considered to be functools.partial(<function b at 0x756d7f0065c0>)
on 3.13.0, when it used to be <MyCallables.B: functools.partial(<function b at 0x71f7cbc407c0>)>
before.
This is something I've been using to allow function values in enums not to be considered methods, which I most likely got from this thread. In the example above, A
would always be considered a method.
It seems like on 3.13.0, the "wrapper class" approach is the only one that works.
CPython versions tested on:
3.10, 3.11, 3.12, 3.13
Operating systems tested on:
Linux, Windows
Linked PRs
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixesstdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error