Fix C default arguments with -builtin and -fastunpack and -modernargs.
Problem occurred when there is just one (defaulted) parameter in the parameter list. Closes #1126
This commit is contained in:
parent
142d4062df
commit
18383340e9
4 changed files with 58 additions and 6 deletions
|
|
@ -19,7 +19,6 @@
|
|||
#include <stdlib.h>
|
||||
#include "pydoc.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
|
||||
#define PYSHADOW_MEMBER 0x2
|
||||
|
|
@ -2865,11 +2864,13 @@ public:
|
|||
int noargs = funpack && (tuple_required == 0 && tuple_arguments == 0);
|
||||
int onearg = funpack && (tuple_required == 1 && tuple_arguments == 1);
|
||||
|
||||
if (builtin && funpack && !overname && !builtin_ctor &&
|
||||
!(GetFlag(n, "feature:compactdefaultargs") && (tuple_arguments > tuple_required || varargs))) {
|
||||
String *argattr = NewStringf("%d", tuple_arguments);
|
||||
Setattr(n, "python:argcount", argattr);
|
||||
Delete(argattr);
|
||||
if (builtin && funpack && !overname && !builtin_ctor) {
|
||||
int compactdefargs = ParmList_is_compactdefargs(l);
|
||||
if (!(compactdefargs && (tuple_arguments > tuple_required || varargs))) {
|
||||
String *argattr = NewStringf("%d", tuple_arguments);
|
||||
Setattr(n, "python:argcount", argattr);
|
||||
Delete(argattr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate code for argument marshalling */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue