Skip to content

Synthetic types are not processed in third pass #3308

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
ilevkivskyi opened this issue May 3, 2017 · 0 comments · Fixed by #3322
Closed

Synthetic types are not processed in third pass #3308

ilevkivskyi opened this issue May 3, 2017 · 0 comments · Fixed by #3322

Comments

@ilevkivskyi
Copy link
Member

While working on #3305 I discovered that "synthetic" types are not always properly processed in third pass (also there can be additional problems with them in fixup.py). This leads to crashes like these:

from typing import List, NewType, NamedTuple
from mypy_extensions import TypedDict

NT = NewType('NT', List[int, str])

class NM(NamedTuple):
    x: List[int, str]

class TD(TypedDict):
    x: List[int, str]

# crashers: any of these crashes with "IndexError: list index out of range"

TD({'x': []})
NM(x=[])
NT([])
@ilevkivskyi ilevkivskyi self-assigned this May 3, 2017
gvanrossum pushed a commit that referenced this issue May 24, 2017
Fixes #3308  

This PR adds better processing of "synthetic" types (``NewType``, ``NamedTuple``, ``TypedDict``) to the third pass and moves some processing from the second to the third pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant