def __setstate__(self, state): soname = state.pop('_soname', None) binary = state.pop('binary', None) for k, v in state.items(): setattr(self, k, v) # If the `sonames` don't match, there *might* be a hidden bug as the # unpickled Operator might be generating code that differs from that # generated by the pickled Operator. For example, a stupid bug that we # had to fix was due to rebuilding SymPy expressions which weren't # automatically getting the flag `evaluate=False`, thus producing x+2 # on the unpickler instead of x+1+1). However, different `sonames` # doesn't necessarily means there's a bug: if the unpickler and the # pickler are two distinct processes and the unpickler runs with a # different `configuration` dictionary, then the `sonames` might indeed # be different, depending on which entries in `configuration` differ. if soname is not None: if soname != self._soname: warning( "The pickled and unpickled Operators have different .sonames; " "this might be a bug, or simply a harmless difference in " "`configuration`. You may check they produce the same code." ) save(self._soname, binary, self._compiler) self._lib = load(self._soname) self._lib.name = self._soname
def __setstate__(self, state): soname = state.pop('_soname', None) binary = state.pop('binary', None) for k, v in state.items(): setattr(self, k, v) # If the `sonames` don't match, there *might* be a hidden bug as the # unpickled Operator might be generating code that differs from that # generated by the pickled Operator. For example, a stupid bug that we # had to fix was due to rebuilding SymPy expressions which weren't # automatically getting the flag `evaluate=False`, thus producing x+2 # on the unpickler instead of x+1+1). However, different `sonames` # doesn't necessarily means there's a bug: if the unpickler and the # pickler are two distinct processes and the unpickler runs with a # different `configuration` dictionary, then the `sonames` might indeed # be different, depending on which entries in `configuration` differ. if soname is not None: if soname != self._soname: warning("The pickled and unpickled Operators have different .sonames; " "this might be a bug, or simply a harmless difference in " "`configuration`. You may check they produce the same code.") save(self._soname, binary, self._compiler)
def __setstate__(self, state): binary = state.pop('binary') for k, v in state.items(): setattr(self, k, v) save(self._soname, binary, self._compiler)