You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I import my code it returns TypeError: cannot pickle 'classmethod' object
full stack
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/site-packages/redis_om/model/model.py", line 1205, in __new__
new_class = super().__new__(cls, name, bases, attrs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pydantic/v1/main.py", line 221, in __new__
inferred = ModelField.infer(
^^^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pydantic/v1/fields.py", line 506, in infer
return cls(
^^^^
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pydantic/v1/fields.py", line 436, in __init__
self.prepare()
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pydantic/v1/fields.py", line 546, in prepare
self._set_default_and_type()
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pydantic/v1/fields.py", line 570, in _set_default_and_type
default_value = self.get_default()
^^^^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pydantic/v1/fields.py", line 439, in get_default
return smart_deepcopy(self.default) if self.default_factory is None else self.default_factory()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pydantic/v1/utils.py", line 693, in smart_deepcopy
return deepcopy(obj) # slowest way when we actually might need a deepcopy
^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/copy.py", line 271, in _reconstruct
state = deepcopy(state, memo)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/copy.py", line 146, in deepcopy
y = copier(x, memo)
^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/copy.py", line 231, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.11.2/lib/python3.11/copy.py", line 161, in deepcopy
rv = reductor(4)
^^^^^^^^^^^
TypeError: cannot pickle 'classmethod' object
I'm attempting to hash the password before save using Pydantic validators
sample Model code
When I import my code it returns
TypeError: cannot pickle 'classmethod' object
full stack
When I change to to BaseModel the code works fine
Version details
The text was updated successfully, but these errors were encountered: