Show More
@@ -406,7 +406,16 b' class RepresentationPrinter(PrettyPrinter):' | |||
|
406 | 406 | meth = cls._repr_pretty_ |
|
407 | 407 | if callable(meth): |
|
408 | 408 | return meth(obj, self, cycle) |
|
409 | if cls is not object and callable(getattr(cls, '__repr__', None)): | |
|
409 | if ( | |
|
410 | cls is not object | |
|
411 | # check if cls defines __repr__ | |
|
412 | and "__repr__" in cls.__dict__ | |
|
413 | # check if __repr__ is callable. | |
|
414 | # Note: we need to test getattr(cls, '__repr__') | |
|
415 | # instead of cls.__dict__['__repr__'] | |
|
416 | # in order to work with descriptors like partialmethod, | |
|
417 | and callable(getattr(cls, '__repr__', None)) | |
|
418 | ): | |
|
410 | 419 | return _repr_pprint(obj, self, cycle) |
|
411 | 420 | |
|
412 | 421 | return _default_pprint(obj, self, cycle) |
General Comments 0
You need to be logged in to leave comments.
Login now