Skip to content

bpo-40334: Correct return value of func_type_comment #19833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Grammar/python.gram
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function_def_raw[stmt_ty]:
(params) ? params : CHECK(_PyPegen_empty_arguments(p)),
b, NULL, a, NEW_TYPE_COMMENT(p, tc), EXTRA)
) }
func_type_comment[PyObject*]:
func_type_comment[Token*]:
| NEWLINE t=TYPE_COMMENT &(NEWLINE INDENT) { t } # Must be followed by indented block
| invalid_double_type_comments
| TYPE_COMMENT
Expand Down
6 changes: 3 additions & 3 deletions Parser/pegen/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static stmt_ty return_stmt_rule(Parser *p);
static stmt_ty raise_stmt_rule(Parser *p);
static stmt_ty function_def_rule(Parser *p);
static stmt_ty function_def_raw_rule(Parser *p);
static PyObject* func_type_comment_rule(Parser *p);
static Token* func_type_comment_rule(Parser *p);
static arguments_ty params_rule(Parser *p);
static arguments_ty parameters_rule(Parser *p);
static asdl_seq* slash_no_default_rule(Parser *p);
Expand Down Expand Up @@ -3679,13 +3679,13 @@ function_def_raw_rule(Parser *p)
// | NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
// | invalid_double_type_comments
// | TYPE_COMMENT
static PyObject*
static Token*
func_type_comment_rule(Parser *p)
{
if (p->error_indicator) {
return NULL;
}
PyObject* res = NULL;
Token* res = NULL;
int mark = p->mark;
{ // NEWLINE TYPE_COMMENT &(NEWLINE INDENT)
void *newline_var;
Expand Down