From 55eb49a4ab8043b665c6a2bbbc51ccb5e481c68c Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 28 Dec 2008 16:50:18 +0100 Subject: [PATCH] avoid minor redundancy in generated code --- Cython/Compiler/Nodes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 89e12f5c..573ff938 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2174,8 +2174,10 @@ class DefNode(FuncDefNode): code.putln('}') code.putln('if (unlikely(kw_args > 0)) {') - # non-positional kw args left in dict: default args, **kwargs or error - if self.star_arg: + # non-positional/-required kw args left in dict: default args, **kwargs or error + if max_positional_args == 0: + pos_arg_count = "0" + elif self.star_arg: code.putln("const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(%s) < %d) ? PyTuple_GET_SIZE(%s) : %d;" % ( Naming.args_cname, max_positional_args, Naming.args_cname, max_positional_args)) -- 2.26.2