From 760d2970bd2b4727515003ed1a6f413990bfbef9 2007-09-04 15:10:37 From: vivainio Date: 2007-09-04 15:10:37 Subject: [PATCH] %time allows IPython syntax --- diff --git a/IPython/Magic.py b/IPython/Magic.py index 04d2b64..1eebdf3 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Magic functions for InteractiveShell. -$Id: Magic.py 2675 2007-08-27 17:51:15Z vivainio $""" +$Id: Magic.py 2705 2007-09-04 15:10:37Z vivainio $""" #***************************************************************************** # Copyright (C) 2001 Janko Hauser and @@ -1659,12 +1659,15 @@ Currently the magic system has the following functions:\n""" """ # fail immediately if the given expression can't be compiled + + expr = self.shell.prefilter(parameter_s,False) + try: mode = 'eval' - code = compile(parameter_s,'',mode) + code = compile(expr,'',mode) except SyntaxError: mode = 'exec' - code = compile(parameter_s,'',mode) + code = compile(expr,'',mode) # skew measurement as little as possible glob = self.shell.user_ns clk = clock2 diff --git a/doc/ChangeLog b/doc/ChangeLog index 6b0af9b..2c7136f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2007-09-03 Ville Vainio + + * Magic.py: %time now passes expression through prefilter, + allowing IPython syntax. + 2007-09-01 Ville Vainio * ipmaker.py: Always show full traceback when newstyle config fails