[New-bugs-announce] [issue33947] Dataclasses can raise RecursionError in __repr__

Eric V. Smith report at bugs.python.org
Sat Jun 23 08:58:46 EDT 2018


New submission from Eric V. Smith <eric at trueblade.com>:

>>> @dataclass
... class C:
...   f: "C"
...
>>> c = C(None)
>>> c.f = c
>>> c
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 2, in __repr__
  File "<string>", line 2, in __repr__
  File "<string>", line 2, in __repr__
  [Previous line repeated 328 more times]
RecursionError: maximum recursion depth exceeded
>>>

It would be better to produce "C(f=...)".

----------
components: Library (Lib)
messages: 320305
nosy: eric.smith
priority: low
severity: normal
status: open
title: Dataclasses can raise RecursionError in __repr__
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33947>
_______________________________________


More information about the New-bugs-announce mailing list