From f9dea4e0ee5c363d22180a82d4d8b7e0cba8640e 2005-12-30 23:57:07 From: fperez Date: 2005-12-30 23:57:07 Subject: [PATCH] fix handling of aliases/system calls for multiline input --- diff --git a/IPython/Release.py b/IPython/Release.py index 2495e0a..dc075d5 100644 --- a/IPython/Release.py +++ b/IPython/Release.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Release data for the IPython project. -$Id: Release.py 981 2005-12-30 15:43:43Z fperez $""" +$Id: Release.py 982 2005-12-30 23:57:07Z fperez $""" #***************************************************************************** # Copyright (C) 2001-2005 Fernando Perez @@ -22,9 +22,9 @@ name = 'ipython' # because bdist_rpm does not accept dashes (an RPM) convention, and # bdist_deb does not accept underscores (a Debian convention). -version = '0.7.0.rc2' +version = '0.7.0.rc3' -revision = '$Revision: 981 $' +revision = '$Revision: 982 $' description = "An enhanced interactive Python shell." diff --git a/IPython/iplib.py b/IPython/iplib.py index 564a85a..c15a124 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -6,7 +6,7 @@ Requires Python 2.1 or newer. This file contains all the classes and helper functions specific to IPython. -$Id: iplib.py 978 2005-12-30 02:37:15Z fperez $ +$Id: iplib.py 982 2005-12-30 23:57:07Z fperez $ """ #***************************************************************************** @@ -1598,6 +1598,8 @@ want to merge them back into the new files.""" % locals() # interactive loop, since that one is only seen by keyboard input. We # need this done correctly even for code run via runlines (which uses # push). + + print 'push line: <%s>' % line # dbg self.autoindent_update(line) self.buffer.append(line) @@ -1812,7 +1814,9 @@ want to merge them back into the new files.""" % locals() pre=None,iFun=None,theRest=None): """Handle alias input lines. """ - line_out = 'ipalias("%s %s")' % (iFun,esc_quotes(theRest)) + # pre is needed, because it carries the leading whitespace. Otherwise + # aliases won't work in indented sections. + line_out = '%sipalias("%s %s")' % (pre,iFun,esc_quotes(theRest)) self.log(line_out,continue_prompt) return line_out @@ -1828,7 +1832,7 @@ want to merge them back into the new files.""" % locals() return pre else: cmd = ("%s %s" % (iFun[1:],theRest)) - line_out = 'ipsystem(r"""%s"""[:-1])' % (cmd + "_") + line_out = '%sipsystem(r"""%s"""[:-1])' % (pre,cmd + "_") else: # single-line input if line.startswith('!!'): # rewrite iFun/theRest to properly hold the call to %sx and @@ -1840,7 +1844,7 @@ want to merge them back into the new files.""" % locals() continue_prompt,pre,iFun,theRest) else: cmd=line[1:] - line_out = 'ipsystem(r"""%s"""[:-1])' % (cmd +"_") + line_out = '%sipsystem(r"""%s"""[:-1])' % (pre,cmd +"_") # update cache/log and return self.log(line_out,continue_prompt) return line_out diff --git a/doc/ChangeLog b/doc/ChangeLog index 910302f..4c7ec9a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,9 @@ 2005-12-30 Fernando Perez + * IPython/iplib.py (handle_shell_escape): fix bug where both + aliases and system accesses where broken for indented code (such + as loops). + * IPython/genutils.py (shell): fix small but critical bug for win32 system access. diff --git a/doc/new_design.lyx b/doc/new_design.lyx index cb4a3a3..6d503c6 100644 --- a/doc/new_design.lyx +++ b/doc/new_design.lyx @@ -106,6 +106,19 @@ Things that should be done for the current series, before starting major Fix any bugs reported at the online bug tracker. \layout Itemize +History bug: I often see that, under certain circumstances, the input history + is incorrect. + The problem is that so far, I've failed to find a simple way to reproduce + it consistently, so I can't easily track it down. + It seems to me that it happens when output is generated multiple times + for the same input (for i in range(10): i will do it). + But even this isn't reliable... + Ultimately the right solution for this is to cleanly separate the dataflow + for input/output history management; right now that happens all over the + place, which makes the code impossible to debug, and almost guaranteed + to be buggy in the first place. +\layout Itemize + \series bold Redesign the output traps.