TypeError
when raising an exception inside the __init__
method of an enum class
#125259
Labels
3.12
bugs and security fixes
3.13
bugs and security fixes
3.14
new features, bugs and security fixes
needs backport to 3.12
bug and security fixes
needs backport to 3.13
bugs and security fixes
stdlib
Python modules in the Lib dir
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
With #111815, any exception raised inside the
__init__
method of an enum class 1 is expected to be:ValidationError
s, see Python 3.12 Enum Class Validated Initialization TypeError pydantic/pydantic#10593)cpython/Lib/enum.py
Lines 556 to 566 in 120b891
Meaning the following raises a
TypeError
instead of the expectedMyValueError
:CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
Footnotes
An example is documented as an example here. ↩
The text was updated successfully, but these errors were encountered: