INNER CODE UNIT · Python
pickleable_exception
autokitteh/autokitteh · runtimes/pythonrt/runner/main.py:256
def pickleable_exception(err):
"""Convert Exception to be pickleable by making un-pickled attribute None."""
# Make Err subclass to exception handling will work
class Err(err.__class__):
def __init__(self):
pass # Override super __init__ with no arguments
perr = Err()
if hasattr(err, "__dict__"):
items = err.__dict__.items()
elif hasattr(err, "__slots__"):
items = ((k, getattr(err, k)) for k in err.__slots__)
else:
items = ()
for key, val in items:
try: