aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython/py3/IPython/lib/pretty.py
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-07-13 15:44:43 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-07-13 15:55:40 +0300
commit585f8fd57a4ab83eca0890f5c05e959b79ef4ea4 (patch)
tree6714fb98ebef8ae413eaf223e3a7b29cf01cedc6 /contrib/python/ipython/py3/IPython/lib/pretty.py
parente12a75707d4c42a0081e951c9142db0bf460d802 (diff)
downloadydb-585f8fd57a4ab83eca0890f5c05e959b79ef4ea4.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/python/ipython/py3/IPython/lib/pretty.py')
-rw-r--r--contrib/python/ipython/py3/IPython/lib/pretty.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/python/ipython/py3/IPython/lib/pretty.py b/contrib/python/ipython/py3/IPython/lib/pretty.py
index 631445b24e..8a24632d60 100644
--- a/contrib/python/ipython/py3/IPython/lib/pretty.py
+++ b/contrib/python/ipython/py3/IPython/lib/pretty.py
@@ -406,8 +406,16 @@ class RepresentationPrinter(PrettyPrinter):
meth = cls._repr_pretty_
if callable(meth):
return meth(obj, self, cycle)
- if cls is not object \
- and callable(cls.__dict__.get('__repr__')):
+ if (
+ cls is not object
+ # check if cls defines __repr__
+ and "__repr__" in cls.__dict__
+ # check if __repr__ is callable.
+ # Note: we need to test getattr(cls, '__repr__')
+ # instead of cls.__dict__['__repr__']
+ # in order to work with descriptors like partialmethod,
+ and callable(_safe_getattr(cls, "__repr__", None))
+ ):
return _repr_pprint(obj, self, cycle)
return _default_pprint(obj, self, cycle)