New submission from Eric V. Smith <e...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue33947>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to