bpo-37112: Allow compile to work on AST with positional only arguments with defaults (GH-13697)
diff --git a/Python/ast.c b/Python/ast.c
index 183b08d..b775522 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -123,7 +123,7 @@
&& !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;
}