[Python-checkins] CVS: python/dist/src/Mac/Tools/IDE PyInteractive.py,1.1,1.2

Jack Jansen jackjansen@users.sourceforge.net
Fri, 07 Sep 2001 03:11:33 -0700


Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE
In directory usw-pr-cvs1:/tmp/cvs-serv11839

Modified Files:
	PyInteractive.py 
Log Message:
Patch by Mark Day to allow from __future__ imports. Looks harmless
enough, but may have side-effects because it preallocates a single
codeop.Compiler() to compile all statements the user enters.

Just: please review and retract/modify if necessary.


Index: PyInteractive.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyInteractive.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyInteractive.py	1999/01/30 22:37:13	1.1
--- PyInteractive.py	2001/09/07 10:11:31	1.2
***************
*** 37,41 ****
--- 37,43 ----
  	
  	def __init__(self):
+ 		import codeop
  		self._pybuf = ""
+ 		self._compile = codeop.Compile()
  	
  	def executeline(self, stuff, out = None, env = None):
***************
*** 73,77 ****
  			
  			try:
! 				code = compile(self._pybuf, "<input>", "single")
  			except SyntaxError, err:
  				pass
--- 75,79 ----
  			
  			try:
! 				code = self._compile(self._pybuf, "<input>", "single")
  			except SyntaxError, err:
  				pass
***************
*** 85,94 ****
  			
  			try:
! 				code1 = compile(self._pybuf + "\n", "<input>", "single")
  			except SyntaxError, err1:
  				pass
  			
  			try:
! 				code2 = compile(self._pybuf + "\n\n", "<input>", "single")
  			except SyntaxError, err2:
  				pass
--- 87,96 ----
  			
  			try:
! 				code1 = self._compile(self._pybuf + "\n", "<input>", "single")
  			except SyntaxError, err1:
  				pass
  			
  			try:
! 				code2 = self._compile(self._pybuf + "\n\n", "<input>", "single")
  			except SyntaxError, err2:
  				pass