INNER CODE UNIT · Python
is_pickleable
autokitteh/autokitteh · runtimes/pythonrt/runner/main.py:185
def is_pickleable(err):
try:
data = pickle.dumps(err)
pickle.loads(data)
return True
except (TypeError, pickle.PickleError):
return False
except Exception as pickle_err:
# This is unexpected, but we can't not handle it.
# Logging so we can investigate.
log.exception("unexpected error: %r", pickle_err)
tb = "".join(format_exception(pickle_err))
log.error("traceback:\n%r", tb)
log.error("error we tried to pickle: %r", err)
try:
attrs = vars(err)
log.error("exception attributes: %r", attrs)
except Exception: