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

Mypy Syntax Error Python 3.8 #10492

Closed
1 task done
pythonweb2 opened this issue Sep 25, 2024 · 1 comment
Closed
1 task done

Mypy Syntax Error Python 3.8 #10492

pythonweb2 opened this issue Sep 25, 2024 · 1 comment
Labels
bug V2 Bug related to Pydantic V2 pending Awaiting a response / confirmation

Comments

@pythonweb2
Copy link

pythonweb2 commented Sep 25, 2024

Initial Checks

  • I confirm that I'm using Pydantic V2

Description

The issue is explained in python/mypy#17768, but the author closed the issue with no indication it had been resolved or even reported.

Error Message: error: X | Y syntax for unions requires Python 3.10

Example Code

See related issue

Python, Pydantic & OS Version

OS: Ubuntu 20.04
Python: 3.8.10 (Version that ships with Ubuntu 20.04)
Pydantic: 2.9.2
@pythonweb2 pythonweb2 added bug V2 Bug related to Pydantic V2 pending Awaiting a response / confirmation labels Sep 25, 2024
@Viicos
Copy link
Member

Viicos commented Sep 25, 2024

Well the error message is pretty clear? You are on Python 3.8, and this syntax was introduced in 3.10.

Pydantic will still be able to evaluate such expressions thanks to the eval_type_backport package, which needs to be manually installed.

@Viicos Viicos closed this as completed Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V2 Bug related to Pydantic V2 pending Awaiting a response / confirmation
Projects
None yet
Development

No branches or pull requests

2 participants