[pypy-svn] r9285 - pypy/branch/dist-interpapp/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Thu Feb 17 19:00:56 CET 2005


Author: arigo
Date: Thu Feb 17 19:00:56 2005
New Revision: 9285

Modified:
   pypy/branch/dist-interpapp/pypy/interpreter/baseobjspace.py
Log:
Oups!  applevel() uses space.exec_(), which cannot call 'setdefault', because 
this is implemented at app-level in stdobjspace...  Argh.



Modified: pypy/branch/dist-interpapp/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/branch/dist-interpapp/pypy/interpreter/baseobjspace.py	Thu Feb 17 19:00:56 2005
@@ -284,8 +284,9 @@
             statement = PyCode(self)._from_code(statement)
         if not isinstance(statement, PyCode):
             raise TypeError, 'space.exec_(): expected a string, code or PyCode object'
-        self.call_method(w_globals, 'setdefault',
-                         self.wrap('__builtins__'), self.wrap(self.builtin))
+        w_key = self.wrap('__builtins__')
+        if not self.is_true(self.contains(w_globals, w_key)):
+            self.setitem(w_globals, w_key, self.wrap(self.builtin))
         return statement.exec_code(self, w_globals, w_locals)
 
     def appexec(self, posargs_w, source): 



More information about the Pypy-commit mailing list