[pickling] pickle error

This commit is contained in:
Max Zwiessele 2015-09-04 16:23:30 +01:00
parent 55d714f78c
commit 8d61fe632b
2 changed files with 5 additions and 19 deletions

View file

@ -3,6 +3,7 @@
from ..core.parameterization.observable import Observable
import collections, weakref
from functools import reduce
from pickle import PickleError
class Cacher(object):
def __init__(self, operation, limit=5, ignore_args=(), force_kwargs=()):
@ -149,10 +150,10 @@ 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)))
raise PickleError("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)))
raise PickleError("Trying to pickle Cacher object with function {}, pickling functions not possible.".format(str(self.operation)))
@property
def __name__(self):