-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X
Description
Initial Checks
- I have searched GitHub for a duplicate issue and I'm sure this is something new
- I have searched Google & StackOverflow for a solution and couldn't find anything
- I have read and followed the docs and still think this is a bug
- I am confident that the issue is with pydantic (not my code, or another library in the ecosystem like FastAPI or mypy)
Description
In pydantic 1.9.2 (and earlier), the Color class was Hashable. in release 1.10.0 it is not hashable that broke usage color as an argument to function decorated with @lru_cache from std lib. (napari/napari#4995)
A I do not see public method for mutate such object IO thin that it is deprecation.
Example Code
pydantic 1.9.2
In [1]: from pydantic.color import Color
In [2]: a = Color((0,0,0))
In [3]: hash(a)
Out[3]: 8771047785283pydantic 1.10.0
In [1]: from pydantic.color import Color
In [2]: a = Color((0,0,0))
In [3]: hash(a)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-57b555d30865> in <module>
----> 1 hash(a)
TypeError: unhashable type: 'Color'
### Python, Pydantic & OS Version
```Text
pydantic 1.9.2 vs pydantic 1.10.0 tested on ubuntu and macos m1.
Affected Components
- Compatibility between releases
- Data validation/parsing
- Data serialization -
.dict()and.json() - JSON Schema
- Dataclasses
- Model Config
- Field Types - adding or changing a particular data type
- Function validation decorator
- Generic Models
- Other Model behaviour -
construct(), pickling, private attributes, ORM mode - Settings Management
- Plugins and integration with other tools - mypy, FastAPI, python-devtools, Hypothesis, VS Code, PyCharm, etc.
Metadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X