##// END OF EJS Templates
* IPython/iplib.py (runsource): remove self.code_to_run_src attribute. I...
fperez -
r10:ec9735d7
parent child
Show More
@@ -4,7 +4,7
4 All the matplotlib support code was co-developed with John Hunter,
4 All the matplotlib support code was co-developed with John Hunter,
5 matplotlib's author.
5 matplotlib's author.
6
6
7 $Id: Shell.py 634 2005-07-17 01:56:45Z tzanko $"""
7 $Id: Shell.py 703 2005-08-16 17:34:44Z fperez $"""
8
8
9 #*****************************************************************************
9 #*****************************************************************************
10 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
10 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
@@ -312,7 +312,6 class MTInteractiveShell(InteractiveShell):
312 # Case 3
312 # Case 3
313 # Store code in self, so the execution thread can handle it
313 # Store code in self, so the execution thread can handle it
314 self.thread_ready.acquire()
314 self.thread_ready.acquire()
315 self.code_to_run_src = source
316 self.code_to_run = code
315 self.code_to_run = code
317 self.thread_ready.wait() # Wait until processed in timeout interval
316 self.thread_ready.wait() # Wait until processed in timeout interval
318 self.thread_ready.release()
317 self.thread_ready.release()
@@ -5,7 +5,7 General purpose utilities.
5 This is a grab-bag of stuff I find useful in most programs I write. Some of
5 This is a grab-bag of stuff I find useful in most programs I write. Some of
6 these things are also convenient when working at the command line.
6 these things are also convenient when working at the command line.
7
7
8 $Id: genutils.py 645 2005-07-19 01:59:26Z fperez $"""
8 $Id: genutils.py 703 2005-08-16 17:34:44Z fperez $"""
9
9
10 #*****************************************************************************
10 #*****************************************************************************
11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
@@ -14,6 +14,8 $Id: genutils.py 645 2005-07-19 01:59:26Z fperez $"""
14 # the file COPYING, distributed as part of this software.
14 # the file COPYING, distributed as part of this software.
15 #*****************************************************************************
15 #*****************************************************************************
16
16
17 from __future__ import generators # 2.2 compatibility
18
17 from IPython import Release
19 from IPython import Release
18 __author__ = '%s <%s>' % Release.authors['Fernando']
20 __author__ = '%s <%s>' % Release.authors['Fernando']
19 __license__ = Release.license
21 __license__ = Release.license
@@ -23,7 +25,6 __license__ = Release.license
23 import __main__
25 import __main__
24 import types,commands,time,sys,os,re,shutil
26 import types,commands,time,sys,os,re,shutil
25 import tempfile
27 import tempfile
26 import codecs
27 from IPython.Itpl import Itpl,itpl,printpl
28 from IPython.Itpl import Itpl,itpl,printpl
28 from IPython import DPyGetOpt
29 from IPython import DPyGetOpt
29
30
@@ -6,7 +6,7 Requires Python 2.1 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 638 2005-07-18 03:01:41Z fperez $
9 $Id: iplib.py 703 2005-08-16 17:34:44Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -623,7 +623,6 class InteractiveShell(code.InteractiveConsole, Logger, Magic):
623 # other situations. No need to use a Queue here, since it's a single
623 # other situations. No need to use a Queue here, since it's a single
624 # item which gets cleared once run.
624 # item which gets cleared once run.
625 self.code_to_run = None
625 self.code_to_run = None
626 self.code_to_run_src = '' # corresponding source
627
626
628 # Job manager (for jobs run as background threads)
627 # Job manager (for jobs run as background threads)
629 self.jobs = BackgroundJobManager()
628 self.jobs = BackgroundJobManager()
@@ -867,7 +866,7 class InteractiveShell(code.InteractiveConsole, Logger, Magic):
867 print 'Exception type :',etype
866 print 'Exception type :',etype
868 print 'Exception value:',value
867 print 'Exception value:',value
869 print 'Traceback :',tb
868 print 'Traceback :',tb
870 print 'Source code :',self.code_to_run_src
869 print 'Source code :','\n'.join(self.buffer)
871
870
872 if handler is None: handler = dummy_handler
871 if handler is None: handler = dummy_handler
873
872
@@ -1529,6 +1528,7 want to merge them back into the new files.""" % locals()
1529
1528
1530 The return value can be used to decide whether to use sys.ps1 or
1529 The return value can be used to decide whether to use sys.ps1 or
1531 sys.ps2 to prompt the next line."""
1530 sys.ps2 to prompt the next line."""
1531
1532 try:
1532 try:
1533 code = self.compile(source, filename, symbol)
1533 code = self.compile(source, filename, symbol)
1534 except (OverflowError, SyntaxError, ValueError):
1534 except (OverflowError, SyntaxError, ValueError):
@@ -1541,9 +1541,10 want to merge them back into the new files.""" % locals()
1541 return True
1541 return True
1542
1542
1543 # Case 3
1543 # Case 3
1544 # We store the code source and object so that threaded shells and
1544 # We store the code object so that threaded shells and
1545 # custom exception handlers can access all this info if needed.
1545 # custom exception handlers can access all this info if needed.
1546 self.code_to_run_src = source
1546 # The source corresponding to this can be obtained from the
1547 # buffer attribute as '\n'.join(self.buffer).
1547 self.code_to_run = code
1548 self.code_to_run = code
1548 # now actually execute the code object
1549 # now actually execute the code object
1549 if self.runcode(code) == 0:
1550 if self.runcode(code) == 0:
@@ -1589,7 +1590,6 want to merge them back into the new files.""" % locals()
1589 print
1590 print
1590 # Flush out code object which has been run (and source)
1591 # Flush out code object which has been run (and source)
1591 self.code_to_run = None
1592 self.code_to_run = None
1592 self.code_to_run_src = ''
1593 return outflag
1593 return outflag
1594
1594
1595 def raw_input(self, prompt=""):
1595 def raw_input(self, prompt=""):
@@ -1767,6 +1767,7 want to merge them back into the new files.""" % locals()
1767 pre=None,iFun=None,theRest=None):
1767 pre=None,iFun=None,theRest=None):
1768 """Execute the line in a shell, empty return value"""
1768 """Execute the line in a shell, empty return value"""
1769
1769
1770 #print 'line in :', `line` # dbg
1770 # Example of a special handler. Others follow a similar pattern.
1771 # Example of a special handler. Others follow a similar pattern.
1771 if continue_prompt: # multi-line statements
1772 if continue_prompt: # multi-line statements
1772 if iFun.startswith('!!'):
1773 if iFun.startswith('!!'):
@@ -1775,6 +1776,7 want to merge them back into the new files.""" % locals()
1775 else:
1776 else:
1776 cmd = ("%s %s" % (iFun[1:],theRest)).replace('"','\\"')
1777 cmd = ("%s %s" % (iFun[1:],theRest)).replace('"','\\"')
1777 line_out = '%s%s.system("%s")' % (pre,self.name,cmd)
1778 line_out = '%s%s.system("%s")' % (pre,self.name,cmd)
1779 #line_out = ('%s%s.system(' % (pre,self.name)) + repr(cmd) + ')'
1778 else: # single-line input
1780 else: # single-line input
1779 if line.startswith('!!'):
1781 if line.startswith('!!'):
1780 # rewrite iFun/theRest to properly hold the call to %sx and
1782 # rewrite iFun/theRest to properly hold the call to %sx and
@@ -1787,9 +1789,12 want to merge them back into the new files.""" % locals()
1787 else:
1789 else:
1788 cmd = esc_quotes(line[1:])
1790 cmd = esc_quotes(line[1:])
1789 line_out = '%s.system("%s")' % (self.name,cmd)
1791 line_out = '%s.system("%s")' % (self.name,cmd)
1792 #line_out = ('%s.system(' % self.name) + repr(cmd)+ ')'
1790 # update cache/log and return
1793 # update cache/log and return
1791 self.log(line_out,continue_prompt)
1794 self.log(line_out,continue_prompt)
1792 self.update_cache(line_out) # readline cache gets normal line
1795 self.update_cache(line_out) # readline cache gets normal line
1796 #print 'line out r:', `line_out` # dbg
1797 #print 'line out s:', line_out # dbg
1793 return line_out
1798 return line_out
1794
1799
1795 def handle_magic(self, line, continue_prompt=None,
1800 def handle_magic(self, line, continue_prompt=None,
@@ -60,7 +60,7 You can implement other color schemes easily, the syntax is fairly
60 self-explanatory. Please send back new schemes you develop to the author for
60 self-explanatory. Please send back new schemes you develop to the author for
61 possible inclusion in future releases.
61 possible inclusion in future releases.
62
62
63 $Id: ultraTB.py 636 2005-07-17 03:11:11Z fperez $"""
63 $Id: ultraTB.py 703 2005-08-16 17:34:44Z fperez $"""
64
64
65 #*****************************************************************************
65 #*****************************************************************************
66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
@@ -639,7 +639,8 class VerboseTB(TBTools):
639 exception = ['%s%s%s: %s' % (Colors.excName, etype_str,
639 exception = ['%s%s%s: %s' % (Colors.excName, etype_str,
640 ColorsNormal, evalue_str)]
640 ColorsNormal, evalue_str)]
641 if type(evalue) is types.InstanceType:
641 if type(evalue) is types.InstanceType:
642 for name in dir(evalue):
642 names = [w for w in dir(evalue) if isinstance(w, basestring)]
643 for name in names:
643 value = text_repr(getattr(evalue, name))
644 value = text_repr(getattr(evalue, name))
644 exception.append('\n%s%s = %s' % (indent, name, value))
645 exception.append('\n%s%s = %s' % (indent, name, value))
645 # return all our info assembled as a single string
646 # return all our info assembled as a single string
@@ -1,3 +1,26
1 2005-08-16 Fernando Perez <fperez@colorado.edu>
2
3 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
4 contains non-string attribute. Closes
5 http://www.scipy.net/roundup/ipython/issue38.
6
7 2005-08-14 Fernando Perez <fperez@colorado.edu>
8
9 * tools/ipsvnc: Minor improvements, to add changeset info.
10
11 2005-08-12 Fernando Perez <fperez@colorado.edu>
12
13 * IPython/iplib.py (runsource): remove self.code_to_run_src
14 attribute. I realized this is nothing more than
15 '\n'.join(self.buffer), and having the same data in two different
16 places is just asking for synchronization bugs. This may impact
17 people who have custom exception handlers, so I need to warn
18 ipython-dev about it (F. Mantegazza may use them).
19
20 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
21
22 * IPython/genutils.py: fix 2.2 compatibility (generators)
23
1 2005-07-18 Fernando Perez <fperez@colorado.edu>
24 2005-07-18 Fernando Perez <fperez@colorado.edu>
2
25
3 * IPython/genutils.py (get_home_dir): fix to help users with
26 * IPython/genutils.py (get_home_dir): fix to help users with
General Comments 0
You need to be logged in to leave comments. Login now