'Avoid pickling objects in the traceback.'

def __getstate__(self):

    if self.pickled:
        return self.__dict__
    c = self.__dict__.copy()
    c['frames'] = [[v[0], v[1], v[2], _safeReprVars(v[3]), _safeReprVars(v[4])] for v in self.frames]
    c['tb'] = None
    if (self.stack is not None):
        c['stack'] = [[v[0], v[1], v[2], _safeReprVars(v[3]), _safeReprVars(v[4])] for v in self.stack]
    c['pickled'] = 1
    return c
