classification
Title: Dataclass Causes Infinite Recursion when using type of bytes
Type: Stage:
Components: Windows Versions: Python 3.8, Python 3.7
process
Status: pending Resolution:
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 2021-06-24 22:52 by eric.smith.

Messages (2)
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.
History
Date User Action Args
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