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.

classification
Title: Dataclass Causes Infinite Recursion when using type of bytes
Type: Stage: resolved
Components: Windows Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: eric.smith Nosy List: andrewonboe, eric.smith, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2021-06-21 15:06 by andrewonboe, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg396250 - (view) Author: Andrew C (andrewonboe) Date: 2021-06-21 15:06
Hello,

When given a `Field` on a Dataclass, the `__repr__` throws an infinite recursive error when the data type is bytes.

In the `Field` class, the __repr__ is as follows:

```
    def __repr__(self):
        return (
            'Field('
            f'name={self.name!r},'
            f'type={self.type!r},'
            f'default={self.default!r},'
            f'default_factory={self.default_factory!r},'
            f'init={self.init!r},'
            f'repr={self.repr!r},'
            f'hash={self.hash!r},'
            f'compare={self.compare!r},'
            f'metadata={self.metadata!r},'
            f'_field_type={self._field_type}'
            ')'
        )
```

The issue is the f'type={self.type!r}, part of the code.
msg396269 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-06-21 16:40
Please give a complete example that we can execute.
msg408341 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-12-11 21:21
Closing due to lack of feedback.
History
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88641
2021-12-11 21:21:07eric.smithsetstatus: pending -> closed
resolution: not a bug
messages: + msg408341

stage: resolved
2021-06-24 22:52:30eric.smithsetstatus: open -> pending
assignee: eric.smith
2021-06-21 16:40:52eric.smithsetmessages: + msg396269
2021-06-21 15:35:38xtreaksetnosy: + eric.smith
2021-06-21 15:06:36andrewonboecreate