Skip to content

Valid namedtuple invocation determined invalid #5078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
emmatyping opened this issue May 18, 2018 · 2 comments
Closed

Valid namedtuple invocation determined invalid #5078

emmatyping opened this issue May 18, 2018 · 2 comments
Labels
bug mypy got something wrong false-positive mypy gave an error on correct code priority-1-normal topic-named-tuple

Comments

@emmatyping
Copy link
Member

I recently came accross the following snippet in the inspect module

FrameInfo = namedtuple('FrameInfo', ('frame',) + Traceback._fields)  # Traceback._fields is a Tuple[str, str])

It is falsely flagged as invalid since the second argument is not a tuple literal. I believe #3575 may help here.

@emmatyping emmatyping added bug mypy got something wrong priority-1-normal false-positive mypy gave an error on correct code topic-named-tuple labels May 18, 2018
@ilevkivskyi
Copy link
Member

Isn't this essentially a duplicate of #3520? Or do you propose to just use less specific type when such code is found (i.e. treating this as FrameInfo = Tuple[Any, ...])?

@emmatyping
Copy link
Member Author

Ah, yes I missed that. Closing as duplicate of #3520 then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong false-positive mypy gave an error on correct code priority-1-normal topic-named-tuple
Projects
None yet
Development

No branches or pull requests

2 participants