Open hotplot opened 10 months ago
The colour
module is interactively redefined at import time here:
https://github.com/colour-science/colour/blob/v0.4.3/colour/__init__.py#L967
the fake module itself is define here:
https://github.com/colour-science/colour/blob/v0.4.3/colour/__init__.py#L905
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.
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.3