summaryrefslogtreecommitdiffstats
path: root/Lib/code.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-08-17 22:11:27 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-08-17 22:11:27 (GMT)
commit6cd6a82db93fa37a13d0b5312ce6510c4d6967de (patch)
treec43eca432a18a364fb1c004d4dfcfe904fa7cefd /Lib/code.py
parent10d72552495a1967af7174f6ed52eb3340799c76 (diff)
downloadcpython-6cd6a82db93fa37a13d0b5312ce6510c4d6967de.zip
cpython-6cd6a82db93fa37a13d0b5312ce6510c4d6967de.tar.gz
cpython-6cd6a82db93fa37a13d0b5312ce6510c4d6967de.tar.bz2
A fiddled version of the rest of Michael Hudson's SF patch
#449043 supporting __future__ in simulated shells which implements PEP 264.
Diffstat (limited to 'Lib/code.py')
-rw-r--r--Lib/code.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/code.py b/Lib/code.py
index d56681c..e2d5065 100644
--- a/Lib/code.py
+++ b/Lib/code.py
@@ -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 @@ class InteractiveInterpreter:
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 @@ class InteractiveInterpreter:
"""
try:
- code = compile_command(source, filename, symbol)
+ code = self.compile(source, filename, symbol)
except (OverflowError, SyntaxError, ValueError):
# Case 1
self.showsyntaxerror(filename)