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

arigo at codespeak.net arigo at codespeak.net
Mon Apr 4 16:21:57 CEST 2005


Author: arigo
Date: Mon Apr  4 16:21:57 2005
New Revision: 10289

Modified:
   pypy/dist/pypy/interpreter/function.py
Log:
MethodType(...) 3rd argument is optional.


Modified: pypy/dist/pypy/interpreter/function.py
==============================================================================
--- pypy/dist/pypy/interpreter/function.py	(original)
+++ pypy/dist/pypy/interpreter/function.py	Mon Apr  4 16:21:57 2005
@@ -139,9 +139,9 @@
         self.space = space
         self.w_function = w_function
         self.w_instance = w_instance   # or None
-        self.w_class = w_class
+        self.w_class = w_class         # possibly space.w_None
         
-    def descr_method__new__(space, w_subtype, w_function, w_instance, w_class):
+    def descr_method__new__(space, w_subtype, w_function, w_instance, w_class=None):
         method = space.allocate_instance(Method, w_subtype)
         if space.is_w( w_instance, space.w_None ):
             w_instance = None
@@ -180,7 +180,9 @@
             # only allow binding to a more specific class than before
             #if w_cls == space.w_None:
             #    w_cls = space.type(w_obj)
-            if w_cls is not None and w_cls != space.w_None and not space.is_true(space.abstract_issubclass(w_cls, self.w_class)):
+            if (w_cls is not None and
+                not space_is_w(w_cls, space.w_None) and
+                not space.is_true(space.abstract_issubclass(w_cls, self.w_class))):
                 return space.wrap(self)   # subclass test failed
             return space.get(self.w_function, w_obj, w_cls)
 



More information about the pypy-svn mailing list