I'm trying to decompile and recompile a function.
def decompile(f):
return ast.parse(get_code(f), mode='exec')
def recompile(ast):
return eval(compile(ast, '', 'exec'))
compile(ast) returns a code object, and I can give that to eval() -- but how can I get the live module object back? eval returns None with exec mode. How do I access the evaluated result?