##// END OF EJS Templates
Fixes to input splitting to reduce the occurrences of spurious attribute...
fperez -
Show More
@@ -1,7 +1,7 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Magic functions for InteractiveShell.
2 """Magic functions for InteractiveShell.
3
3
4 $Id: Magic.py 2104 2007-02-20 10:25:51Z fperez $"""
4 $Id: Magic.py 2122 2007-03-01 02:27:11Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
@@ -210,6 +210,7 b' license. To use profiling, please install"python2.3-profiler" from non-free.""")'
210 except KeyError:
210 except KeyError:
211 continue
211 continue
212 else:
212 else:
213 #print 'oname_rest:', oname_rest # dbg
213 for part in oname_rest:
214 for part in oname_rest:
214 try:
215 try:
215 parent = obj
216 parent = obj
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 2014 2007-01-05 10:36:58Z fperez $
9 $Id: iplib.py 2122 2007-03-01 02:27:11Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -492,6 +492,15 b' class InteractiveShell(object,Magic):'
492 r'([\?\w\.]+\w*\s*)'
492 r'([\?\w\.]+\w*\s*)'
493 r'(\(?.*$)')
493 r'(\(?.*$)')
494
494
495 # A simpler regexp used as a fallback if the above doesn't work. This
496 # one is more conservative in how it partitions the input. This code
497 # can probably be cleaned up to do everything with just one regexp, but
498 # I'm afraid of breaking something; do it once the unit tests are in
499 # place.
500 self.line_split_fallback = re.compile(r'^(\s*)'
501 r'([\w\.]*)'
502 r'(.*)')
503
495 # Original re, keep around for a while in case changes break something
504 # Original re, keep around for a while in case changes break something
496 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
505 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
497 # r'(\s*[\?\w\.]+\w*\s*)'
506 # r'(\s*[\?\w\.]+\w*\s*)'
@@ -2017,17 +2026,14 b' want to merge them back into the new files.""" % locals()'
2017
2026
2018 lsplit = self.line_split.match(line)
2027 lsplit = self.line_split.match(line)
2019 if lsplit is None: # no regexp match returns None
2028 if lsplit is None: # no regexp match returns None
2020 try:
2029 lsplit = self.line_split_fallback.match(line)
2021 iFun,theRest = line.split(None,1)
2022 except ValueError:
2023 iFun,theRest = line,''
2024 pre = re.match('^(\s*)(.*)',line).groups()[0]
2025 else:
2026 pre,iFun,theRest = lsplit.groups()
2027
2030
2031 #pre,iFun,theRest = lsplit.groups() # dbg
2028 #print 'line:<%s>' % line # dbg
2032 #print 'line:<%s>' % line # dbg
2029 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2033 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2030 return pre,iFun.strip(),theRest
2034 #return pre,iFun.strip(),theRest # dbg
2035
2036 return lsplit.groups()
2031
2037
2032 def _prefilter(self, line, continue_prompt):
2038 def _prefilter(self, line, continue_prompt):
2033 """Calls different preprocessors, depending on the form of line."""
2039 """Calls different preprocessors, depending on the form of line."""
@@ -1,3 +1,9 b''
1 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (split_user_input): fix input splitting so we
4 don't attempt attribute accesses on things that can't possibly be
5 valid Python attributes. After a bug report by Alex Schmolck.
6
1 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
7 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
2
8
3 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
9 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
General Comments 0
You need to be logged in to leave comments. Login now