From 4eedb50290c0466f8f5737fa588a231c2e6d77d5 2013-05-17 16:48:11
From: Thomas Kluyver <takowl@gmail.com>
Date: 2013-05-17 16:48:11
Subject: [PATCH] Use new input transformation API in %%time

This avoids the perils of 'multiline specials', where valid Python syntax
unexpectedly gets turned into IPython magic commands.

Closes gh-3334

---

diff --git a/IPython/core/magics/execution.py b/IPython/core/magics/execution.py
index 195d75c..ccc1a2b 100644
--- a/IPython/core/magics/execution.py
+++ b/IPython/core/magics/execution.py
@@ -959,9 +959,9 @@ python-profiler package from non-free.""")
             raise UsageError("Can't use statement directly after '%%time'!")
         
         if cell:
-            expr = self.shell.prefilter(cell,False)
+            expr = self.shell.input_transformer_manager.transform_cell(cell)
         else:
-            expr = self.shell.prefilter(line,False)
+            expr = self.shell.input_transformer_manager.transform_cell(line)
 
         # Minimum time above which parse time will be reported
         tp_min = 0.1