Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fixes mypy crash on dataclasses.field(**unpack) - #11137

Merged
hauntsaninja merged 3 commits into
python:masterfrom
sobolevn:issue-10879
Sep 21, 2021
Merged

Fixes mypy crash on dataclasses.field(**unpack)#11137
hauntsaninja merged 3 commits into
python:masterfrom
sobolevn:issue-10879

Conversation

@sobolevn

Copy link
Copy Markdown
Member

Closes #10879

class bool(int): pass
class dict(Generic[_T, _U]): pass

class dict(Mapping[KT, VT]):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We need this for **dict unpack.

Comment thread mypy/plugins/dataclasses.py
Comment thread mypy/plugins/dataclasses.py Outdated
Comment thread test-data/unit/check-dataclasses.test Outdated
Comment thread test-data/unit/check-dataclasses.test Outdated
@hauntsaninja
hauntsaninja merged commit a7d6e68 into python:master Sep 21, 2021
JukkaL pushed a commit that referenced this pull request Sep 24, 2021
)

Fixes #10248

The crash due to dataclasses.field was fixed in the recent PR #11137, but the error 
message was wrong when positional arguments are used.

I update the error message based on 
#10248 (comment)
(Thanks @JelleZijlstra!)
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.

Dataclasses: field function called with ** (double asterisk, unpack-dictionary) results in internal error

3 participants