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

mwh at codespeak.net mwh at codespeak.net
Tue Aug 8 17:26:37 CEST 2006


Author: mwh
Date: Tue Aug  8 17:26:36 2006
New Revision: 31171

Modified:
   pypy/dist/pypy/interpreter/function.py
Log:
delay creating a Function's __dict__ until it's asked for.


Modified: pypy/dist/pypy/interpreter/function.py
==============================================================================
--- pypy/dist/pypy/interpreter/function.py	(original)
+++ pypy/dist/pypy/interpreter/function.py	Tue Aug  8 17:26:36 2006
@@ -25,7 +25,7 @@
         self.w_func_globals = w_globals  # the globals dictionary
         self.closure   = closure    # normally, list of Cell instances or None
         self.defs_w    = defs_w     # list of w_default's
-        self.w_func_dict = space.newdict([])
+        self.w_func_dict = None # filled out below if needed
         self.w_module = None
 
     def __repr__(self):
@@ -120,6 +120,8 @@
             stkargs.valuestack = None
 
     def getdict(self):
+        if self.w_func_dict is None:
+            self.w_func_dict = self.space.newdict([])
         return self.w_func_dict
 
     def setdict(self, space, w_dict):



More information about the Pypy-commit mailing list