From a5f91b6c223061061763acef372f45a650d44834 2013-02-05 15:47:46 From: Bussonnier Matthias Date: 2013-02-05 15:47:46 Subject: [PATCH] Merge pull request #2883 from takluyver/i2879 Don't call ast.fix_missing_locations unless the AST could have been modified Should close gh-2879, and give a tiny improvement in performance. --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 554bcde..661a6b5 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -2695,7 +2695,9 @@ class InteractiveShell(SingletonConfigurable): warn("AST transformer %r threw an error. It will be unregistered." % transformer) self.ast_transformers.remove(transformer) - return ast.fix_missing_locations(node) + if self.ast_transformers: + ast.fix_missing_locations(node) + return node def run_ast_nodes(self, nodelist, cell_name, interactivity='last_expr',