You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
title='Add a method to importlib.abc.SourceLoader for converting source to a code object'updated_at=<Date2013-03-31.18:45:58.034>user='https://github.com/brettcannon'
A classmethod called importlib.abc.SourceLoader.source_to_code(source_bytes, path) would return a code object. By default it would be equivalent to compile(source_bytes, source_path, 'exec', dont_inherit=True), but others could override this to e.g. convert the source to an AST, optimize the AST, and then call compile() to get the desired code object.
Sorry, just now digging out of a massive backlog here. The originally proposed name of "source_to_code()" might be more appropriate than compile_source(). The relationship to compilation is not compulsory and the name/docstring/docs might imply that. If you're not opposed, Brett, I can make the change.