From 97a624f360f001267d7255ec3e7506e75b8eca05 Mon Sep 17 00:00:00 2001 From: Alec Woods Date: Sun, 13 Jan 2019 10:49:58 -0500 Subject: [PATCH] Fix a bug where anonymous arguments were misnumbered when used in constructors --- Source/Modules/python.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 572013ab8..85da53973 100755 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -2153,7 +2153,7 @@ public: * Generate parameter list for Python functions or methods, * reuse make_autodocParmList() to do so. * ------------------------------------------------------------ */ - String *make_pyParmList(Node *n, bool in_class, bool is_calling, int kw) { + String *make_pyParmList(Node *n, bool in_class, bool is_calling, int kw, bool has_self_for_count = false) { /* Get the original function for a defaultargs copy, * see default_arguments() in parser.y. */ Node *nn = Getattr(n, "defaultargs"); @@ -2186,7 +2186,7 @@ public: bool funcanno = py3 ? true : false; String *params = NewString(""); - String *_params = make_autodocParmList(n, false, (in_class? 2 : 1), is_calling, funcanno); + String *_params = make_autodocParmList(n, false, ((in_class || has_self_for_count)? 2 : 1), is_calling, funcanno); if (in_class) { Printf(params, "self"); @@ -4785,7 +4785,7 @@ public: String *parms = make_pyParmList(n, true, false, allow_kwargs); /* Pass 'self' only if using director */ - String *callParms = make_pyParmList(n, false, true, allow_kwargs); + String *callParms = make_pyParmList(n, false, true, allow_kwargs, true); if (use_director) { Insert(callParms, 0, "_self, ");