Skip to content

Commit cc1d07a

Browse files
test(python): Fix pydantic model_fields deprecation (#21958)
1 parent b9ea05a commit cc1d07a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

py-polars/polars/_utils/construction/dataframe.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,9 @@ def _sequence_of_pydantic_models_to_pydf(
846846

847847
old_pydantic = parse_version(pydantic.__version__) < (2, 0)
848848
model_fields = list(
849-
first_element.__fields__ if old_pydantic else first_element.model_fields
849+
first_element.__fields__
850+
if old_pydantic
851+
else first_element.__class__.model_fields
850852
)
851853
(
852854
unpack_nested,

0 commit comments

Comments
 (0)