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
I noticed a regression between v2.6.3 and v2.6.4, probably due to merge request #8826.
This occurs in the following situation:
An optional field is used in a subclass (the optional characteristic is dropped)
Pydantic's mypy plugin is used through the toml configuration
Strict optional config item is set to true (default behavior)
Result from the example code bellow is:
$ cat pyproject.toml[tool.mypy]plugins = ['pydantic.mypy']
$ mypy xxx.pyxxx.py:10: note: Revealed type is "xxx.Sub"xxx.py:11: note: Revealed type is "builtins.str"xxx.py:13: error: Incompatible types in assignment (expression has type "None", variable has type "str") [assignment]
Everything is fine as long as I don't use the plugin, or pydantic v2.6.3, or if I set no_strict_optional, either from the command line or as a configuration entry in the toml file.
Initial Checks
Description
I noticed a regression between v2.6.3 and v2.6.4, probably due to merge request #8826.
This occurs in the following situation:
toml
configurationtrue
(default behavior)Result from the example code bellow is:
Everything is fine as long as I don't use the plugin, or pydantic v2.6.3, or if I set no_strict_optional, either from the command line or as a configuration entry in the
toml
file.Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: