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

Builtin generic type annotations on Python 3.8 #245

Open
Newbytee opened this issue Dec 8, 2023 · 0 comments
Open

Builtin generic type annotations on Python 3.8 #245

Newbytee opened this issue Dec 8, 2023 · 0 comments

Comments

@Newbytee
Copy link

Newbytee commented Dec 8, 2023

Describe the bug
While builtin generic type annotations for types such as contextvars.ContextVar were added in Python 3.9, they do not crash in Python 3.8. As such, it seems to me that they are safe to use in Python 3.8 and an error should not be raised. Right now, Vermin gives an error stating that builtin generic type annotations need Python 3.9.

To Reproduce
Try running for example this code in Python 3.8 and observe that it doesn't crash:

import contextvars
print(contextvars.ContextVar[str])

def test() -> contextvars.ContextVar[str]:
    print("hi")

test()

Expected behavior
Since these builtin generic type annotations do not crash on Python 3.8, I think there is an argument to make that they should be allowed.

Environment (please complete the following information):

  • 1.6.0

Additional context
To clarify, just disabling Vermin's evaluation of types is not a solution to this problem as there are other type hints which are not "backwards compatible" like this and cause issues such as the "new" union syntax.

With all that said, I'm open to being proven wrong.

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

No branches or pull requests

1 participant