From 83369951de3cbfc419310a21de9e260350716dfd Mon Sep 17 00:00:00 2001 From: Hannes Vogt Date: Tue, 16 Jun 2026 18:06:02 +0200 Subject: [PATCH] fix[eve]: use identity check for None in infer_type 'value in (None, type(None))' invokes '__eq__', which fails for values with non-boolean equality such as NumPy arrays ('The truth value of an array ... is ambiguous'). Compare by identity instead. --- src/gt4py/eve/extended_typing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gt4py/eve/extended_typing.py b/src/gt4py/eve/extended_typing.py index 8e7b9f75eb..d95d63e625 100644 --- a/src/gt4py/eve/extended_typing.py +++ b/src/gt4py/eve/extended_typing.py @@ -776,7 +776,9 @@ def infer_type( if isinstance(value, (StdGenericAliasType, _TypingSpecialFormType)): return value - if value in (None, type(None)): + # note: identity check instead of `in`, which would use `__eq__` and fail + # for values with non-boolean equality (e.g. NumPy arrays) + if value is None or value is type(None): return type(None) if none_as_type else None if isinstance(value, type):