Author pablogsal
Recipients FFY00, pablogsal, theacodes, tlalexander, veky
Date 2021-07-12.10:15:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1626084911.18.0.653169707271.issue44603@roundup.psfhosted.org>
In-reply-to
Content
Unfortunately, I don't know how that can help because the stack trace is the same in these two cases:

>>> import traceback
>>> class A:
...   def __repr__(self):
...      traceback.print_stack()

>>> A()
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 4, in __repr__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __repr__ returned non-string (type NoneType)

>>> print([A()])
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 4, in __repr__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __repr__ returned non-string (type NoneType)

This also becomes a bit tricky if __repr__ is called from C code or from native threads.

In general, the underlying problem is that __repr__ should not have side effects.
History
Date User Action Args
2021-07-12 10:15:11pablogsalsetrecipients: + pablogsal, veky, FFY00, theacodes, tlalexander
2021-07-12 10:15:11pablogsalsetmessageid: <1626084911.18.0.653169707271.issue44603@roundup.psfhosted.org>
2021-07-12 10:15:11pablogsallinkissue44603 messages
2021-07-12 10:15:10pablogsalcreate