Skip to content

Commit

Permalink
Remove __root__ from BaseModel typing-only attrs (#3540)
Browse files Browse the repository at this point in the history
* Remove `__root__` from BaseModel typing-only attrs

`__root__` is not a class variable nor is it always present.

The switch to `ClassVar` caused type errors to be reported in Pylance/Pyright.

* Add changelog entry
  • Loading branch information
layday committed Dec 19, 2021
1 parent 0f961d4 commit da916f3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 1 addition & 0 deletions changes/3540-layday.md
@@ -0,0 +1 @@
Removed typing-only `__root__` attribute from `BaseModel`
1 change: 0 additions & 1 deletion pydantic/main.py
Expand Up @@ -306,7 +306,6 @@ class BaseModel(Representation, metaclass=ModelMetaclass):
__pre_root_validators__: ClassVar[List[AnyCallable]]
__post_root_validators__: ClassVar[List[Tuple[bool, AnyCallable]]]
__config__: ClassVar[Type[BaseConfig]] = BaseConfig
__root__: ClassVar[Any] = None
__json_encoder__: ClassVar[Callable[[Any], Any]] = lambda x: x
__schema_cache__: ClassVar['DictAny'] = {}
__custom_root_type__: ClassVar[bool] = False
Expand Down

0 comments on commit da916f3

Please sign in to comment.