[pypy-svn] rev 2394 - pypy/trunk/src/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Tue Dec 16 17:07:12 CET 2003


Author: arigo
Date: Tue Dec 16 17:07:11 2003
New Revision: 2394

Modified:
   pypy/trunk/src/pypy/interpreter/extmodule.py
Log:
The interpreter starts up much faster now.

Modified: pypy/trunk/src/pypy/interpreter/extmodule.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/extmodule.py	(original)
+++ pypy/trunk/src/pypy/interpreter/extmodule.py	Tue Dec 16 17:07:11 2003
@@ -18,6 +18,7 @@
         
         # to build the dictionary of the module we get all the objects
         # accessible as 'self.xxx'. Methods are bound.
+        contents = {}
         for cls in self.__class__.__mro__:
             for name in cls.__dict__:
                 # ignore names in '_xyz'
@@ -31,9 +32,11 @@
 
                     # ignore tricky class-attrs we can't send from interp to app-level 
                     if name in ('__metaclass__','__module__',):
-                        continue  
-                    space.call_method(self.w_dict, 'setdefault', 
-                                      space.wrap(name), space.wrap(value))
+                        continue
+                    contents.setdefault(space.wrap(name), space.wrap(value))
+        w_contents = space.newdict(contents.items())
+        space.call_method(w_contents, 'update', self.w_dict)
+        self.w_dict = w_contents
         gateway.export_values(space, self.__dict__, self.w_dict)
 
     __metaclass__ = InitializedClass


More information about the Pypy-commit mailing list