Skip to content

Commit 4bf2f92

Browse files
committed
fix: Ignore NameError when introspecting plan functions
When getting type hints to determine if a function is a plan, a NameError can be raised (specifically when checking pydantic.Field in this case) and the context loading crashes. Ignoring the error in the same way that we ignore TypeError allows us to ignore broken types. As we are only interested in specific return types (Generator) this shouldn't affect which functions are treated as plans.
1 parent 7622ee0 commit 4bf2f92

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/blueapi/core/bluesky_types.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def is_bluesky_plan_generator(func: PlanGenerator) -> bool:
7575
return (get_origin(return_type) == Generator) and (
7676
get_args(return_type)[0] == Msg
7777
)
78-
except TypeError:
78+
except (TypeError, NameError):
7979
# get_type_hints fails on some objects (such as Union or Optional)
8080
return False
8181

0 commit comments

Comments
 (0)