You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
python version checks don't seem to work with 0.780 #8990
This is a typeshed issue. ForwardRef is only defined for Python 3.7+, since it was added then under that name. The previous _ForwardRef name is not represented. PR for typeshed welcome that adds it.
@hauntsaninja thanks for pointing to the other issue. Unfortunately you ForwardRef = cast(Any, typing)._ForwardRef solution doesn't work - this is currently preventing pydantic from upgrading latest mypy (I've found another work around).
Activity
srittau commentedon Jun 11, 2020
This is a typeshed issue.
ForwardRefis only defined for Python 3.7+, since it was added then under that name. The previous_ForwardRefname is not represented. PR for typeshed welcome that adds it.samuelcolvin commentedon Jun 11, 2020
okay, but is there any way around this using
# type: ignorefor both python 3.6 and 3.7?I don't understand why the errors are different between python versions.
There seems no way to specify a "type ignore" that only applies to one python version.
Linked PR on pydantic pydantic/pydantic#1598
hauntsaninja commentedon Jun 11, 2020
Basically a dupe of #8823 (typeshed-specific details aside)
You should be able to work around with something like:
which isn't ideal, since mypy will now treat ForwardRef as Any.
Edit: Actually, you could do the following:
ilevkivskyi commentedon Jun 12, 2020
It doesn't look like there is a (new) action item for mypy here, so closing.
samuelcolvin commentedon Jun 25, 2020
@hauntsaninja thanks for pointing to the other issue. Unfortunately you
ForwardRef = cast(Any, typing)._ForwardRefsolution doesn't work -this is currently preventing pydantic from upgrading latest mypy(I've found another work around).