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

ForwardRef stub for python 3.6 raises error on MyPy check #1738

Closed
SirTelemak opened this issue Jul 17, 2020 · 0 comments · Fixed by #1739
Closed

ForwardRef stub for python 3.6 raises error on MyPy check #1738

SirTelemak opened this issue Jul 17, 2020 · 0 comments · Fixed by #1739
Labels
bug V1 Bug related to Pydantic V1.X

Comments

@SirTelemak
Copy link
Contributor

SirTelemak commented Jul 17, 2020

Bug

#1598 introduce stub class for ForwardRef without __init__ for type checking so mypy raise error for ForwardRef
https://github.com/samuelcolvin/pydantic/blob/e985857e5a9ede8d346b010a5a039aa84a089826/pydantic/typing.py#L31-L33
I not pretty sure is this is planned or bug and if this is a bug I can fix it with stub __init__

Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":

pydantic version: 1.6.1
            pydantic compiled: False
                 install path: \venv\Lib\site-packages\pydantic
               python version: 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)]
                     platform: Windows-10-10.0.18362-SP0
     optional deps. installed: ['typing-extensions', 'email-validator']

test.py

# For python version < 3.7
from pydantic.typing import ForwardRef

ref = ForwardRef('A')

class A:
    ...
mypy test.py
> test.py:3: error: Too many arguments for "ForwardRef"
@SirTelemak SirTelemak added the bug V1 Bug related to Pydantic V1.X label Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant