Fix internal error inheriting a dataclass duplicated field #7792 (#7808)
The error was:
```
(attr,) = [a for a in all_attrs if a.name == name]
ValueError: not enough values to unpack (expected 1, got 0)
```
No need to enter in the `else` if all_attrs is empty
And don't assume that there is a matching attr in all_attr