Message359770
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'. |
|
Date |
User |
Action |
Args |
2020-01-11 00:32:09 | terry.reedy | set | recipients:
+ terry.reedy, blueyed |
2020-01-11 00:32:09 | terry.reedy | set | messageid: <1578702729.62.0.00781039887943.issue39228@roundup.psfhosted.org> |
2020-01-11 00:32:09 | terry.reedy | link | issue39228 messages |
2020-01-11 00:32:08 | terry.reedy | create | |
|