diff --git a/GPy/util/caching.py b/GPy/util/caching.py index 196ce343..42a3d0f6 100644 --- a/GPy/util/caching.py +++ b/GPy/util/caching.py @@ -149,10 +149,12 @@ class Cacher(object): return Cacher(self.operation, self.limit, self.ignore_args, self.force_kwargs) def __getstate__(self, memo=None): - raise NotImplementedError("Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation))) + from pickle import PicklingError + raise PicklingError("Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation))) def __setstate__(self, memo=None): - raise NotImplementedError("Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation))) + from pickle import PicklingError + raise PicklingError("Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation))) @property def __name__(self):