[pypy-svn] r10815 - pypy/dist/pypy/objspace/std

pedronis at codespeak.net pedronis at codespeak.net
Mon Apr 18 15:55:52 CEST 2005


Author: pedronis
Date: Mon Apr 18 15:55:52 2005
New Revision: 10815

Modified:
   pypy/dist/pypy/objspace/std/dictobject.py
   pypy/dist/pypy/objspace/std/typeobject.py
Log:
avoid type pollution



Modified: pypy/dist/pypy/objspace/std/dictobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dictobject.py	(original)
+++ pypy/dist/pypy/objspace/std/dictobject.py	Mon Apr 18 15:55:52 2005
@@ -273,7 +273,7 @@
     try:
         w_currently_in_repr = statedict['Py_Repr']
     except KeyError:
-        w_currently_in_repr = statedict['Py_Repr'] = space.newdict(())
+        w_currently_in_repr = statedict['Py_Repr'] = space.newdict([])
 
     return dictstr(space, w_currently_in_repr, w_dict)
 

Modified: pypy/dist/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/typeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/typeobject.py	Mon Apr 18 15:55:52 2005
@@ -146,13 +146,14 @@
         try:
             return w_self.dict_w[attr]
         except KeyError:
-            if w_self.lazyloaders and attr in w_self.lazyloaders:
-                loader = w_self.lazyloaders[attr]
-                del w_self.lazyloaders[attr]
-                w_value = loader()
-                if w_value is not None:   # None means no such attribute
-                    w_self.dict_w[attr] = w_value
-                return w_value
+            if w_self.lazyloaders:
+                if attr in w_self.lazyloaders:
+                    loader = w_self.lazyloaders[attr]
+                    del w_self.lazyloaders[attr]
+                    w_value = loader()
+                    if w_value is not None:   # None means no such attribute
+                        w_self.dict_w[attr] = w_value
+                        return w_value
             return None
 
     def lookup(w_self, key):



More information about the Pypy-commit mailing list