From d77453938a4b7a5a2bb71d9cb40397ee8bbc2e0a Mon Sep 17 00:00:00 2001 From: David Bieber Date: Fri, 26 Jul 2019 09:10:44 -0700 Subject: [PATCH] make pytype happy w/ __str__ feature. PiperOrigin-RevId: 260155248 Change-Id: Iac4795a8177df8bf9108efe916035f94507e8902 --- fire/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fire/core.py b/fire/core.py index dabfb865..07993de9 100644 --- a/fire/core.py +++ b/fire/core.py @@ -247,7 +247,7 @@ def _PrintResult(component_trace, verbose=False): if hasattr(result, '__str__'): # If the object has a custom __str__ method, rather than one inherited from # object, then we use that to serialize the object. - class_attrs = completion.GetClassAttrsDict(type(result)) + class_attrs = completion.GetClassAttrsDict(type(result)) or {} str_attr = class_attrs.get('__str__') if str_attr and str_attr.defining_class is not object: print(str(result))