[pypy-svn] r25464 - pypy/dist/pypy/objspace/flow

tismer at codespeak.net tismer at codespeak.net
Thu Apr 6 22:35:09 CEST 2006


Author: tismer
Date: Thu Apr  6 22:35:07 2006
New Revision: 25464

Modified:
   pypy/dist/pypy/objspace/flow/objspace.py
Log:
temporary, preparing "constant import into globals"

Modified: pypy/dist/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/objspace.py	(original)
+++ pypy/dist/pypy/objspace/flow/objspace.py	Thu Apr  6 22:35:07 2006
@@ -63,6 +63,9 @@
         #self.make_sys()
         # objects which should keep their SomeObjectness
         self.not_really_const = NOT_REALLY_CONST
+        # variables which might in turn turn into constants.
+        # purpose: allow for importing into globals.
+        self.maybe_const = {} # variable -> constant
 
     def enter_cache_building_mode(self):
         # when populating the caches, the flow space switches to
@@ -595,11 +598,15 @@
 
 def override():
     def getattr(self, w_obj, w_name):
+        # handling special things like sys
+        # (maybe this will vanish with a unique import logic)
         if w_obj in self.not_really_const:
             const_w = self.not_really_const[w_obj]
             if w_name not in const_w:
                 return self.do_operation_with_implicit_exceptions('getattr', w_obj, w_name)
+        # tracking variables which might be constants
         return self.regular_getattr(w_obj, w_name)
+
     FlowObjSpace.regular_getattr = FlowObjSpace.getattr
     FlowObjSpace.getattr = getattr
 



More information about the Pypy-commit mailing list