Skip to content
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

[PEP 695] Generate error if 3.12 type alias is called #17320

Merged
merged 3 commits into from
Jun 4, 2024

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Jun 3, 2024

PEP 695 type aliases raise an exception at runtime if called.

Work on #15238.

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Jun 4, 2024

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@JukkaL JukkaL merged commit c762191 into master Jun 4, 2024
18 checks passed
@JukkaL JukkaL deleted the type-var-syntax-6-call-alias branch June 4, 2024 12:32
@sdb9696
Copy link

sdb9696 commented Jun 10, 2024

Hi, fyi this PR caused an issue for me which appeared to be due to the mypy cache not having serialized python_3_12_type_alias

  File "/redacted/lib/python3.12/site-packages/mypy/nodes.py", line 261, in deserialize
    return method(data)
           ^^^^^^^^^^^^
  File "/redacted/lib/python3.12/site-packages/mypy/nodes.py", line 3699, in deserialize
    python_3_12_type_alias = data["python_3_12_type_alias"]

KeyError: 'python_3_12_type_alias'

I was able to clear this by running mypy once with --no-incremental but you might want to make the deserialization handle the case where python_3_12_type_alias is missing. Or maybe not as presumably the cache is invalidated when running a proper new release as opposed to mypy 1.11.0+dev?

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jun 10, 2024

The cache is normally invalidated when mypy version is changed. We don't attempt to maintain cache compatibility between mypy versions.

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.

3 participants