Skip to content

Commit

Permalink
[Lang] Add error message for printing an incomplelely-defined field (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
yihong0618 authored Sep 23, 2021
1 parent 8532cfd commit a301810
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/taichi/lang/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<Field: Definition of this field is incomplete>'
else:
return str(self.to_numpy())

Expand Down

0 comments on commit a301810

Please sign in to comment.