Author: Antonio Cuni <[email protected]>
Branch: cpyext-refactor-methodobject
Changeset: r92816:8823f6116665
Date: 2017-10-21 02:28 +0200
http://bitbucket.org/pypy/pypy/changeset/8823f6116665/

Log:    XXX: this is just a test to see how much performance we loose if we
        go through the slow __args__ dance instead of using the fastcalls

diff --git a/pypy/module/cpyext/methodobject.py 
b/pypy/module/cpyext/methodobject.py
--- a/pypy/module/cpyext/methodobject.py
+++ b/pypy/module/cpyext/methodobject.py
@@ -103,7 +103,10 @@
     # METH_NOARGS
 
     # CCC I think we can condense descr_call and call into one, can't we?
-    def descr_call(self, space):
+    def descr_call(self, space, __args__):
+        if len(__args__.arguments_w) != 0:
+            raise oefmt(space.w_TypeError,
+                        "%s() takes no arguments", self.name)
         return self.call(space, None, None, None)
 
     def call(self, space, w_self, w_args, w_kw):
@@ -117,7 +120,11 @@
     # METH_O
 
     # CCC I think we can condense descr_call and call into one, can't we?
-    def descr_call(self, space, w_o):
+    def descr_call(self, space, __args__):
+        if len(__args__.arguments_w) != 1:
+            raise oefmt(space.w_TypeError,
+                        "%s() takes exactly one argument", self.name)
+        w_o = __args__.arguments_w[0]
         return self.call(space, None, w_o, None)
 
     def call(self, space, w_self, w_o, w_kw):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to