Terry J. Reedy <tjre...@udel.edu> added the comment:

As is true for most special methods, it is a bug for __repr__ methods to raise. 
 They should return a string, as documented.

Special method wrappers generally assume that the wrapped methods work.  In 
particular, repr assumes this, and so do the __repr__ methods of all 
collections classes.  They do not try to hide bugs.  Example:

>>> class BadRep:
        def __repr__(self): 1/0

        
>>> br = BadRep()
>>> [br]
Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    [br]
  File "C:\Programs\Python39\lib\idlelib\rpc.py", line 620, in displayhook
    text = repr(value)
  File "<pyshell#6>", line 2, in __repr__
    def __repr__(self): 1/0
ZeroDivisionError: division by zero

Bugs should be reported, not masked.  I don't think that FrameSummary should be 
an exception to this.  Therefore I think that this issue should be closed 
(along with the PR) as 'not a bug'.

----------
nosy: +terry.reedy
versions:  -Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39228>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to