From e5e47d8949bef8442e9db506eb13e0a54a47cd56 Mon Sep 17 00:00:00 2001 From: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com> Date: Tue, 14 Nov 2023 08:50:37 -0600 Subject: [PATCH] Fixes to add to `2.5.1` (#8110) --- HISTORY.md | 1 + pydantic/_internal/_validate_call.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 6806e0f8f3..c7340980ab 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -21,6 +21,7 @@ The code released in v2.5.0 is functionally identical to that of v2.5.0b1. * Added `validation_error_cause` to config by @zakstucke in [#7626](https://github.com/pydantic/pydantic/pull/7626) * Make path of the item to validate available in plugin by @hramezani in [#7861](https://github.com/pydantic/pydantic/pull/7861) * Add `CallableDiscriminator` and `Tag` by @dmontagu in [#7983](https://github.com/pydantic/pydantic/pull/7983) + * `CallableDiscriminator` renamed to `Discriminator` by @dmontagu in [#8047](https://github.com/pydantic/pydantic/pull/8047) * Make union case tags affect union error messages by @dmontagu in [#8001](https://github.com/pydantic/pydantic/pull/8001) * Add `examples` and `json_schema_extra` to `@computed_field` by @alexmojaki in [#8013](https://github.com/pydantic/pydantic/pull/8013) * Add `JsonValue` type by @dmontagu in [#7998](https://github.com/pydantic/pydantic/pull/7998) diff --git a/pydantic/_internal/_validate_call.py b/pydantic/_internal/_validate_call.py index 543b064b95..3f1aadaf0b 100644 --- a/pydantic/_internal/_validate_call.py +++ b/pydantic/_internal/_validate_call.py @@ -145,5 +145,12 @@ def __set_name__(self, owner: Any, name: str) -> None: def __repr__(self) -> str: return f'ValidateCallWrapper({self.raw_function})' - def __eq__(self, other): - return self.raw_function == other.raw_function + def __eq__(self, other) -> bool: + return ( + (self.raw_function == other.raw_function) + and (self._config == other._config) + and (self._validate_return == other._validate_return) + ) + + def __hash__(self): + return hash(self.raw_function)