Skip to content

Commit d8d876f

Browse files
committed
Fix TypeError introduced in 2.5
1 parent 7353e5b commit d8d876f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pydantic_settings/sources.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
Optional,
3333
Sequence,
3434
Tuple,
35+
Type,
3536
TypeVar,
3637
Union,
3738
cast,
@@ -2115,7 +2116,7 @@ def read_env_file(
21152116
def _annotation_is_complex(annotation: type[Any] | None, metadata: list[Any]) -> bool:
21162117
# If the model is a root model, the root annotation should be used to
21172118
# evaluate the complexity.
2118-
if isinstance(annotation, type) and issubclass(annotation, RootModel):
2119+
if annotation is not None and inspect.isclass(annotation) and issubclass(annotation, RootModel):
21192120
# In some rare cases (see test_root_model_as_field),
21202121
# the root attribute is not available. For these cases, python 3.8 and 3.9
21212122
# return 'RootModelRootType'.

0 commit comments

Comments
 (0)