summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-06-01 18:08:04 +0100
committerGitHub <noreply@github.com>2019-06-01 18:08:04 +0100
commitcd74e66a8c420be675fd2fbf3fe708ac02ee9f21 (patch)
tree12f985512507967c339019c4c21b4a613cd6c61b /Python/compile.c
parent059b9ea5ac98f432e41b05d1fa5aab4ffa22df4d (diff)
downloadcpython-git-cd74e66a8c420be675fd2fbf3fe708ac02ee9f21.tar.gz
bpo-37122: Make co->co_argcount represent the total number of positonal arguments in the code object (GH-13726)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/compile.c b/Python/compile.c
index f6ec929b3c..9e4a2094ac 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -5764,7 +5764,7 @@ makecode(struct compiler *c, struct assembler *a)
Py_ssize_t nlocals;
int nlocals_int;
int flags;
- int argcount, posonlyargcount, kwonlyargcount, maxdepth;
+ int posorkeywordargcount, posonlyargcount, kwonlyargcount, maxdepth;
consts = consts_dict_keys_inorder(c->u->u_consts);
names = dict_keys_inorder(c->u->u_names, 0);
@@ -5808,15 +5808,15 @@ makecode(struct compiler *c, struct assembler *a)
goto error;
}
- argcount = Py_SAFE_DOWNCAST(c->u->u_argcount, Py_ssize_t, int);
posonlyargcount = Py_SAFE_DOWNCAST(c->u->u_posonlyargcount, Py_ssize_t, int);
+ posorkeywordargcount = Py_SAFE_DOWNCAST(c->u->u_argcount, Py_ssize_t, int);
kwonlyargcount = Py_SAFE_DOWNCAST(c->u->u_kwonlyargcount, Py_ssize_t, int);
maxdepth = stackdepth(c);
if (maxdepth < 0) {
goto error;
}
- co = PyCode_New(argcount, posonlyargcount, kwonlyargcount,
- nlocals_int, maxdepth, flags,
+ co = PyCode_New(posonlyargcount+posorkeywordargcount, posonlyargcount,
+ kwonlyargcount, nlocals_int, maxdepth, flags,
bytecode, consts, names, varnames,
freevars, cellvars,
c->c_filename, c->u->u_name,