This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients blueyed, terry.reedy
Date 2020-01-11.00:32:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1578702729.62.0.00781039887943.issue39228@roundup.psfhosted.org>
In-reply-to
Content
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'.
History
Date User Action Args
2020-01-11 00:32:09terry.reedysetrecipients: + terry.reedy, blueyed
2020-01-11 00:32:09terry.reedysetmessageid: <1578702729.62.0.00781039887943.issue39228@roundup.psfhosted.org>
2020-01-11 00:32:09terry.reedylinkissue39228 messages
2020-01-11 00:32:08terry.reedycreate