[pypy-svn] r5332 - pypy/trunk/src/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Fri Jun 25 20:27:01 CEST 2004


Author: arigo
Date: Fri Jun 25 20:26:56 2004
New Revision: 5332

Modified:
   pypy/trunk/src/pypy/interpreter/interactive.py
Log:
Confusion enabler.  If we go to the interp-level prompt with Ctrl-C and set 
some wrapped objects in w_xxx variables, then upon leaving the objects are 
visible back at app-level under the name xxx.

So you can e.g. say w_s = space.wrap(space) and see your own object space 
under the name s at app-level.

Although you cannot do much apart from crashing PyPy by using it.


Modified: pypy/trunk/src/pypy/interpreter/interactive.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/interactive.py	(original)
+++ pypy/trunk/src/pypy/interpreter/interactive.py	Fri Jun 25 20:26:56 2004
@@ -39,6 +39,12 @@
                 local['w_' + self.space.unwrap(w_name)] = (
                     self.space.getitem(self.w_globals, w_name))
             code.interact(banner=banner, local=local)
+            # copy back 'w_' names
+            for name in local:
+                if name.startswith('w_'):
+                    self.space.setitem(self.w_globals,
+                                       self.space.wrap(name[2:]),
+                                       local[name])
             print '*** Leaving interpreter-level console ***'
             raise
 



More information about the Pypy-commit mailing list