##// END OF EJS Templates
Don't use getattr() when searching for the _repr_pretty_ method....
Walter Doerwald -
Show More
@@ -353,8 +353,10 b' class RepresentationPrinter(PrettyPrinter):'
353 # Some objects automatically create any requested
353 # Some objects automatically create any requested
354 # attribute. Try to ignore most of them by checking for
354 # attribute. Try to ignore most of them by checking for
355 # callability.
355 # callability.
356 if callable(getattr(obj_class, '_repr_pretty_')):
356 if '_repr_pretty_' in obj_class.__dict__:
357 return obj_class._repr_pretty_(obj, self, cycle)
357 meth = obj_class._repr_pretty_
358 if callable(meth):
359 return meth(obj, self, cycle)
358 return _default_pprint(obj, self, cycle)
360 return _default_pprint(obj, self, cycle)
359 finally:
361 finally:
360 self.end_group()
362 self.end_group()
General Comments 0
You need to be logged in to leave comments. Login now