Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions reg/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ def clean_dispatch_methods(cls: type[object]) -> None:
:param cls: a class that has :class:`reg.DispatchMethod` methods on it.
"""
for name in dir(cls):
# NOTE: On Python 3.14+ this can invoke `__annotate__` with format
# `VALUE` which can raise a `NameError`, so it can both cause
# exceptions and also involve unnecessary work, so we explicitly
# avoid touching this attribute
if name == "__annotations__": # pragma: no cover
continue

attr = getattr(cls, name)
if inspect.isfunction(attr) and hasattr(attr, "clean"):
attr.clean() # pyright: ignore[reportFunctionMemberAccess]
Loading