Parse user code to AST using compiler flags. #784

Merged
merged 2 commits into from Sep 12, 2011

2 participants

@takluyver
IPython member

Closes gh-777.

@fperez fperez commented on an outdated diff Sep 12, 2011
IPython/core/compilerop.py
@@ -77,6 +78,16 @@ class CachingCompiler(codeop.Compile):
# stdlib that call it outside our control go through our codepath
# (otherwise we'd lose our tracebacks).
linecache.checkcache = self.check_cache
+
+ def ast_parse(self, source, filename='<unknown>', symbol='exec'):
+ """Parse code to an AST with the current compiler flags active."""
@fperez
IPython member
fperez added a line comment Sep 12, 2011

Indicate in the docstring that all arguments are the same as those passed to the builtin compile() call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@fperez
IPython member

Other than my tiny inline comment, this looks perfect. Once that's fixed, go ahead and merge. Thanks!

@takluyver takluyver merged commit ca3e756 into ipython:master Sep 12, 2011
@takluyver
IPython member

Rebased and merged. Thanks, Fernando.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment