From 5a63864c540421c725544dc9f02df07e6132796d Mon Sep 17 00:00:00 2001 From: yihong0618 Date: Thu, 23 Sep 2021 14:55:57 +0800 Subject: [PATCH] fix: #2973 --- python/taichi/lang/field.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/taichi/lang/field.py b/python/taichi/lang/field.py index 29a2d11de19c3..c5827c477eff9 100644 --- a/python/taichi/lang/field.py +++ b/python/taichi/lang/field.py @@ -187,6 +187,8 @@ def __getitem__(self, key): def __str__(self): if impl.inside_kernel(): return self.__repr__() # make pybind11 happy, see Matrix.__str__ + if self.snode.ptr is None: + return '' else: return str(self.to_numpy())