Mercurial > cpython-lru_cache-weakref
diff Mac/Tools/IDE/PyInteractive.py @ 19794:95ea66122325 legacy-trunk
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.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Fri, 07 Sep 2001 10:11:31 +0000 |
| parents | a0b06891d286 |
| children | c3a096bfbd6b |
line wrap: on
line diff
--- a/Mac/Tools/IDE/PyInteractive.py Fri Sep 07 08:45:55 2001 +0000 +++ b/Mac/Tools/IDE/PyInteractive.py Fri Sep 07 10:11:31 2001 +0000 @@ -36,7 +36,9 @@ class PyInteractive: def __init__(self): + import codeop self._pybuf = "" + self._compile = codeop.Compile() def executeline(self, stuff, out = None, env = None): if env is None: @@ -72,7 +74,7 @@ return try: - code = compile(self._pybuf, "<input>", "single") + code = self._compile(self._pybuf, "<input>", "single") except SyntaxError, err: pass except: @@ -84,12 +86,12 @@ return try: - code1 = compile(self._pybuf + "\n", "<input>", "single") + code1 = self._compile(self._pybuf + "\n", "<input>", "single") except SyntaxError, err1: pass try: - code2 = compile(self._pybuf + "\n\n", "<input>", "single") + code2 = self._compile(self._pybuf + "\n\n", "<input>", "single") except SyntaxError, err2: pass
