-
Notifications
You must be signed in to change notification settings - Fork 313
Closed
Description
In src/serializers/type_serializers/function.rs SerializationInfo::round_trip is defined as a property:
pydantic-core/src/serializers/type_serializers/function.rs
Lines 557 to 558 in 061711f
| #[pyo3(get)] | |
| round_trip: bool, |
In python/pydantic_core/core_schema.py SerializationInfo.round_trip is defined as a method, however:
| def round_trip(self) -> bool: ... |
Trying to call SerializationInfo.round_trip in a model validator fails with a TypeError:
Error calling function `serialize_model`: TypeError: 'bool' object is not callable
File "<source file>", line 108, in serialize_model
round_trip=info.round_trip(),
^^^^^^^^^^^^^^^^^
TypeError: 'bool' object is not callableThe fix is simple, I think, just mark SerializationInfo.round_trip as a property in python/pydantic_core/core_schema.py. This fixes the type checking issues for my code. I don't have a full Rust development environment installed, so I can't test whether any other changes are needed.
Metadata
Metadata
Assignees
Labels
No labels