mirror of
https://github.com/python/cpython.git
synced 2025-08-25 03:04:55 +00:00
bpo-37122: Make co->co_argcount represent the total number of positonal arguments in the code object (GH-13726)
This commit is contained in:
parent
059b9ea5ac
commit
cd74e66a8c
14 changed files with 74 additions and 88 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue