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

arigo at codespeak.net arigo at codespeak.net
Mon May 16 15:49:31 CEST 2005


Author: arigo
Date: Mon May 16 15:49:30 2005
New Revision: 12357

Modified:
   pypy/dist/pypy/objspace/std/objspace.py
Log:
Initialization order issue: must create old-style classes before they are seen
by the chain of calls  dict.fromkeys = classmethod(fromkeys)  ==>
callable(fromkeys)  ==>  isinstance()  ==>  _instance


Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py	(original)
+++ pypy/dist/pypy/objspace/std/objspace.py	Mon May 16 15:49:30 2005
@@ -81,6 +81,7 @@
         # dummy old-style classes types
         self.w_classobj = W_TypeObject(self, 'classobj', [self.w_object], {})
         self.w_instance = W_TypeObject(self, 'instance', [self.w_object], {})
+        self.setup_old_style_classes()
 
         # fix up a problem where multimethods apparently don't 
         # like to define this at interp-level 
@@ -93,8 +94,6 @@
                     return r
                 dict.fromkeys = classmethod(fromkeys)
         """) 
-        # old-style classes
-        self.setup_old_style_classes()
 
     def enable_old_style_classes_as_default_metaclass(self):
         self.setitem(self.builtin.w_dict, self.wrap('__metaclass__'), self.w_classobj)
@@ -112,6 +111,7 @@
         from pypy.module import classobjinterp
         # sanity check that this approach is working and is not too late
         assert not self.is_true(self.contains(self.builtin.w_dict,self.wrap('_classobj'))),"app-level code has seen dummy old style classes"
+        assert not self.is_true(self.contains(self.builtin.w_dict,self.wrap('_instance'))),"app-level code has seen dummy old style classes"
         w_setup = classobjinterp.initclassobj(self)
         w_classobj, w_instance, w_purify = self.unpackiterable(w_setup)
         self.call_function(w_purify)



More information about the Pypy-commit mailing list