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
In v2.6.3 I had lines of code that rightfully needed type checking or mypy ignores for union-attr since the fields were typed like <type> | None. However, after I upgraded to v2.6.4 mypy is now telling me many of these type ignores are no longer necessary even though I didn't change my code at all. It seems to only be happening for classes that inherit from another model as you can see from my example. Anything that is just a BaseModel class seems to still require the type checking. I imagine its probably related to the change in this PR?
Thank you for that info @pengelsman7, I was able to confirm locally that #9008 seems to fix your issue. It would be great if you could confirm if there are still any misbehaviors not addressed by that PR but even if you can't I think we'll merge and release it soon since it at least fixes some bugs.
Initial Checks
Description
In v2.6.3 I had lines of code that rightfully needed type checking or mypy ignores for
union-attr
since the fields were typed like<type> | None
. However, after I upgraded to v2.6.4 mypy is now telling me many of these type ignores are no longer necessary even though I didn't change my code at all. It seems to only be happening for classes that inherit from another model as you can see from my example. Anything that is just aBaseModel
class seems to still require the type checking. I imagine its probably related to the change in this PR?Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: