[pypy-svn] r5028 - pypy/trunk/src/pypy/objspace/std

arigo at codespeak.net arigo at codespeak.net
Thu Jun 10 14:48:40 CEST 2004


Author: arigo
Date: Thu Jun 10 14:48:39 2004
New Revision: 5028

Modified:
   pypy/trunk/src/pypy/objspace/std/typetype.py
Log:
Make __new__ an unbound method of the metaclass, instead of a real class
method.  Looks like Python does the same in at least some cases, and this way
we don't need 'classmethod' to be available at this point.


Modified: pypy/trunk/src/pypy/objspace/std/typetype.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/typetype.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/typetype.py	Thu Jun 10 14:48:39 2004
@@ -15,7 +15,11 @@
         key = space.unwrap(w_key)
         assert isinstance(key, str)
         dict_w[key] = space.getitem(w_dict, w_key)
-    # XXX classmethod-ify w_dict['__new__']
+    # make '__new__' an unbound method on w_typetype
+    # XXX check if this is correct in all cases
+    if '__new__' in dict_w:
+        dict_w['__new__'] = space.get(dict_w['__new__'],
+                                      space.w_None, w_typetype)
     w_type = W_TypeObject(space, name, bases_w or [space.w_object], dict_w, None)
     return space.w_type.check_user_subclass(w_typetype, w_type)
 



More information about the Pypy-commit mailing list