From aea5abdd70c215ead48613405bb8c83f499db341 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 7 Apr 2024 16:29:21 -0400 Subject: [PATCH] Use `object()` when checking for error field value Since the field value could be `None` or some other type with truthy-ness evaluating to `False`.. --- tractor/_ipc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tractor/_ipc.py b/tractor/_ipc.py index 9af28e5..694eaf9 100644 --- a/tractor/_ipc.py +++ b/tractor/_ipc.py @@ -172,7 +172,8 @@ def _raise_msg_type_err( # specific field's type problem msgspec_msg: str = validation_err.args[0].rstrip('`') msg, _, maybe_field = msgspec_msg.rpartition('$.') - if field_val := msg_dict.get(maybe_field): + obj = object() + if (field_val := msg_dict.get(maybe_field, obj)) is not obj: field_type: Union[Type] = msg_type.__signature__.parameters[ maybe_field ].annotation