Skip to content

Commit

Permalink
inverse and condition for perf
Browse files Browse the repository at this point in the history
  • Loading branch information
PrettyWood committed Dec 6, 2021
1 parent 06216dc commit 07990ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pydantic/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ def _validate_singleton(
if self.sub_fields:
errors = []

if is_union(get_origin(self.type_)) and self.model_config.smart_union:
if self.model_config.smart_union and is_union(get_origin(self.type_)):
# 1st pass: check if the value is an exact instance of one of the Union types
# (e.g. to avoid coercing a bool into an int)
for field in self.sub_fields:
Expand Down

0 comments on commit 07990ce

Please sign in to comment.