Skip to content
6 changes: 3 additions & 3 deletions mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ class Node(Context):
__slots__ = ()

def __str__(self) -> str:
ans = self.accept(mypy.strconv.StrConv(options=Options()))
if ans is None:
a = self.accept(mypy.strconv.StrConv(options=Options()))
if a is None:
# Some visitors might have empty bodies and actually return `None`
return repr(self) # type: ignore[unreachable]
return ans
return a

def str_with_options(self, options: Options) -> str:
a = self.accept(mypy.strconv.StrConv(options=options))
Expand Down