KEMBAR78
Fix internal error inheriting a dataclass duplicated field #7792 by vbarbaresi · Pull Request #7808 · python/mypy · GitHub
Skip to content

Conversation

vbarbaresi
Copy link
Contributor

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 the matching attr exists in all_attr

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
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Looks good. The first error message looks a bit odd but it's a much less serious issue than a crash.

@JukkaL JukkaL merged commit dc325e4 into python:master Oct 29, 2019
@vbarbaresi vbarbaresi deleted the fix_7792 branch October 29, 2019 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants