another fix to make it work with Robert's signature optimisation
authorStefan Behnel <scoder@users.berlios.de>
Sun, 23 Sep 2007 20:12:36 +0000 (22:12 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 23 Sep 2007 20:12:36 +0000 (22:12 +0200)
Cython/Compiler/Nodes.py

index cd7ab4850ce66f3fc2f73731c3b99331114de271..029a85d1e4332d41356ed62b7af42b70c587350a 100644 (file)
@@ -851,13 +851,15 @@ class DefNode(FuncDefNode):
             if self.entry.signature is TypeSlots.pyfunction_signature:
                 if len(self.args) == 0:
                     self.entry.signature = TypeSlots.pyfunction_noargs
-                elif len(self.args) == 1 and self.args[0].default is None:
-                    self.entry.signature = TypeSlots.pyfunction_onearg
+                elif len(self.args) == 1:
+                    if self.args[0].default is None and not self.args[0].kw_only:
+                        self.entry.signature = TypeSlots.pyfunction_onearg
             elif self.entry.signature is TypeSlots.pymethod_signature:
                 if len(self.args) == 1:
                     self.entry.signature = TypeSlots.unaryfunc
-                elif len(self.args) == 2 and self.args[1].default is None:
-                    self.entry.signature = TypeSlots.ibinaryfunc
+                elif len(self.args) == 2:
+                    if self.args[1].default is None and not self.args[1].kw_only:
+                        self.entry.signature = TypeSlots.ibinaryfunc
         sig = self.entry.signature
         nfixed = sig.num_fixed_args()
         for i in range(nfixed):