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 trying to cloudpickle a function that references the colour-science library, the following exception is raised:
Traceback (most recent call last):
File "/home/hrrsxb/aip/x/test.py", line 10, in <module>
y = cloudpickle.loads(x)
File "/home/hrrsxb/.cache/pypoetry/virtualenvs/x-Z-zmud14-py3.10/lib/python3.10/site-packages/colour/__init__.py", line 911, in __getattr__
return super().__getattr__(attribute)
File "/home/hrrsxb/.cache/pypoetry/virtualenvs/x-Z-zmud14-py3.10/lib/python3.10/site-packages/colour/utilities/deprecation.py", line 361, in __getattr__
change = self._changes.get(attribute)
...
File "/home/hrrsxb/.cache/pypoetry/virtualenvs/x-Z-zmud14-py3.10/lib/python3.10/site-packages/colour/__init__.py", line 911, in __getattr__
return super().__getattr__(attribute)
File "/home/hrrsxb/.cache/pypoetry/virtualenvs/x-Z-zmud14-py3.10/lib/python3.10/site-packages/colour/utilities/deprecation.py", line 361, in __getattr__
change = self._changes.get(attribute)
RecursionError: maximum recursion depth exceeded
and has a generic __getattr__ to lookup attributes + some class level attributes that are defined a-posteriori when first importing the real module.
I suspect that since it's a fake module, cloudpickle is also trying to pickle it by value instead of pickling it by reference. And the way it's designed it cannot be pickled by value.
Maybe cloudpickle's heuristic to detect what module should be pickled by value could be improved.
Alternatively, colour itself might be fixed or improved to make it safe to pickle its fake module by value, for instance by defining the class attributes in the class definition itself rather than by setting them a posteriori.
ogrisel
changed the title
Can't pickle functions that use the colour library
Can't pickle functions that use the colour-science library
Nov 3, 2023
When trying to cloudpickle a function that references the
colour-science
library, the following exception is raised:Minimal code to reproduce:
The issue does not occur when using standard
pickle
Versions used are:
python
: 3.10.12cloudpickle
: 2.2.1 and 3.0.0 both testedcolour
: 0.4.3The text was updated successfully, but these errors were encountered: