Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated hash is the same as builtin dataclass
Before: ``` class A(BaseModel): x: int y: List[int] class Config: allow_mutation = False a = A(x=1, y=[1,2,3]) d = {a: 2} d[a] ``` does not raise any error. After: It raises a Type error: "unhashable type: 'list'" because `y` field is not hashable. NB: This copy the behavior of builtin dataclass where the hash function is the hash of the *tuple* of the fields. In the previous commit, I was using the hash of the *dict_values* of the fields dict, which does not raise if values are not hashable.
- Loading branch information
Showing
2 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters