Skip to content

Fix Python 3.12 compatibility: EventEnum empty enum TypeError - #204

Closed
westclox-star wants to merge 1 commit into
demberto:masterfrom
westclox-star:wcs/fixing-enum-lookup-on-none
Closed

Fix Python 3.12 compatibility: EventEnum empty enum TypeError#204
westclox-star wants to merge 1 commit into
demberto:masterfrom
westclox-star:wcs/fixing-enum-lookup-on-none

Conversation

@westclox-star

@westclox-star westclox-star commented May 2, 2026

Copy link
Copy Markdown

Python 3.12 changed EnumMeta.call to raise TypeError when called on an enum with no members, before missing is invoked. EventEnum has no members of its own (all live in subclasses), breaking parse() on Python 3.12+.

Fix by overriding call in _EventEnumMeta to route through missing directly when the enum has no members.

Fixes #183 temporarily. IMO the lookup needs to change and I will attempt it in the future on my fork.

Python 3.12 changed EnumMeta.__call__ to raise TypeError when called
on an enum with no members, before _missing_ is invoked. EventEnum has
no members of its own (all live in subclasses), breaking parse() on
Python 3.12+.

Fix by overriding __call__ in _EventEnumMeta to route through _missing_
directly when the enum has no members.

Fixes demberto#183
@westclox-star
westclox-star deleted the wcs/fixing-enum-lookup-on-none branch May 3, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞 Python 3.12 Enum issue

1 participant