bpo-37112: Allow compile to work on AST with positional only arguments with defaults (GH-13697)

This commit is contained in:
Pablo Galindo 2019-05-31 14:09:49 +01:00 committed by GitHub
parent ed222a74a0
commit 2f58a84104
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -123,7 +123,7 @@ validate_arguments(arguments_ty args)
&& !validate_expr(args->kwarg->annotation, Load)) {
return 0;
}
if (asdl_seq_LEN(args->defaults) > asdl_seq_LEN(args->args)) {
if (asdl_seq_LEN(args->defaults) > asdl_seq_LEN(args->posonlyargs) + asdl_seq_LEN(args->args)) {
PyErr_SetString(PyExc_ValueError, "more positional defaults than args on arguments");
return 0;
}