diff Lib/code.py @ 19355:d5acff178ad5 legacy-trunk

A fiddled version of the rest of Michael Hudson's SF patch #449043 supporting __future__ in simulated shells which implements PEP 264.
author Tim Peters <tim.peters@gmail.com>
date Fri, 17 Aug 2001 22:11:27 +0000
parents 12c80b570d00
children 03f3ab0c7286
line wrap: on
line diff
--- a/Lib/code.py	Fri Aug 17 22:08:34 2001 +0000
+++ b/Lib/code.py	Fri Aug 17 22:11:27 2001 +0000
@@ -7,9 +7,9 @@
 
 import sys
 import traceback
-from codeop import compile_command
+from codeop import CommandCompiler, compile_command
 
-__all__ = ["InteractiveInterpreter","InteractiveConsole","interact",
+__all__ = ["InteractiveInterpreter", "InteractiveConsole", "interact",
            "compile_command"]
 
 def softspace(file, newvalue):
@@ -45,6 +45,7 @@
         if locals is None:
             locals = {"__name__": "__console__", "__doc__": None}
         self.locals = locals
+        self.compile = CommandCompiler()
 
     def runsource(self, source, filename="<input>", symbol="single"):
         """Compile and run some source in the interpreter.
@@ -71,7 +72,7 @@
 
         """
         try:
-            code = compile_command(source, filename, symbol)
+            code = self.compile(source, filename, symbol)
         except (OverflowError, SyntaxError, ValueError):
             # Case 1
             self.showsyntaxerror(filename)