[pypy-svn] r17626 - pypy/dist/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Sat Sep 17 20:39:12 CEST 2005


Author: arigo
Date: Sat Sep 17 20:39:11 2005
New Revision: 17626

Modified:
   pypy/dist/pypy/interpreter/interactive.py
Log:
* preserve the locals between two Ctrl-C-invoked interactive consoles
* the name 'locals' was getting in the way of calling the built-in
    function locals()  (nice exercice: figure out where this 'locals'
    dict entry comes from)


Modified: pypy/dist/pypy/interpreter/interactive.py
==============================================================================
--- pypy/dist/pypy/interpreter/interactive.py	(original)
+++ pypy/dist/pypy/interpreter/interactive.py	Sat Sep 17 20:39:11 2005
@@ -103,6 +103,7 @@
         #space.exec_("__pytrace__ = 0", self.w_globals, self.w_globals)
         space.setitem(self.w_globals, space.wrap('__pytrace__'),space.wrap(0))
         self.tracelevel = 0
+        self.console_locals = {}
 
     def enable_command_line_completer(self):
         try:
@@ -143,7 +144,9 @@
             print
             banner = ("Python %s on %s\n" % (sys.version, sys.platform) +
                       "*** Entering interpreter-level console ***")
-            local = self.__dict__.copy()
+            local = self.console_locals
+            local.update(self.__dict__)
+            del local['locals']
             for w_name in self.space.unpackiterable(self.w_globals):
                 local['w_' + self.space.str_w(w_name)] = (
                     self.space.getitem(self.w_globals, w_name))



More information about the Pypy-commit mailing list