Skip to content

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

Merged
JukkaL merged 3 commits into
masterfrom
type-var-syntax-6-call-alias
Jun 4, 2024
Merged

[PEP 695] Generate error if 3.12 type alias is called#17320
JukkaL merged 3 commits into
masterfrom
type-var-syntax-6-call-alias

Conversation

@JukkaL

@JukkaL JukkaL commented Jun 3, 2024

Copy link
Copy Markdown
Collaborator

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

Work on #15238.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Jun 4, 2024

Copy link
Copy Markdown
Contributor

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
@JukkaL
JukkaL deleted the type-var-syntax-6-call-alias branch June 4, 2024 12:32
@sdb9696

sdb9696 commented Jun 10, 2024

Copy link
Copy Markdown

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

JukkaL commented Jun 10, 2024

Copy link
Copy Markdown
Collaborator Author

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