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 604 error with TypedDict not recognized #918

Closed
cdce8p opened this issue Feb 4, 2021 · 2 comments
Closed

PEP 604 error with TypedDict not recognized #918

cdce8p opened this issue Feb 4, 2021 · 2 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@cdce8p
Copy link

cdce8p commented Feb 4, 2021

Environment data

  • Language Server version: 2021.2.0
  • OS and version: darwin x64
  • Python version: 3.8
  • python.analysis.indexing: true
  • python.analysis.typeCheckingMode: basic / strict

Expected behaviour

Recognize Alternative syntax for unions error for TypedDict equivalent syntax forms even with postponed evaluation enabled (Python 3.8). https://docs.python.org/3/library/typing.html#typing.TypedDict

Actual behaviour

The code sample below causes two TypeErrors to be thrown even with from __future__ import annotations.
However, pylance only recognizes it if the future import is missing.

Logs

--

Code Snippet / Additional information

from __future__ import annotations
from typing import TypedDict

CustomTypedDict = TypedDict("CustomTypedDict", my_var=int | str)  # TypeError
CustomTypedDict2 = TypedDict("CustomTypedDict2", {"my_var": int | str})  # TypeError

--
Similar to #917

@github-actions github-actions bot added the triage label Feb 4, 2021
@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels Feb 5, 2021
@erictraut
Copy link
Contributor

Thanks for the bug report. This will be fixed in the next release.

@jakebailey
Copy link
Member

This issue has been fixed in version 2021.2.1, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202121-10-february-2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants