Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-123881: make compiler add the .generic_base base class without constructing AST nodes #123883

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 15 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Revert "add action helper for ClassDef"
This reverts commit 031c697.
  • Loading branch information
iritkatriel committed Sep 9, 2024
commit 0e52c0fe92155e6c76f88dbc63bd139a3147c116
5 changes: 4 additions & 1 deletion 5 Grammar/python.gram
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ class_def[stmt_ty]:
class_def_raw[stmt_ty]:
| invalid_class_def_raw
| 'class' a=NAME t=[type_params] b=['(' z=[arguments] ')' { z }] ':' c=block {
_PyPegen_class_def(a, b, c, t, EXTRA) }
_PyAST_ClassDef(a->v.Name.id,
(b) ? ((expr_ty) b)->v.Call.args : NULL,
(b) ? ((expr_ty) b)->v.Call.keywords : NULL,
c, NULL, t, EXTRA) }

# Function definitions
# --------------------
Expand Down
16 changes: 0 additions & 16 deletions 16 Parser/action_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,22 +746,6 @@ _PyPegen_function_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty f
function_def->end_lineno, function_def->end_col_offset, p->arena);
}

/* Construct a ClassDef */
stmt_ty
_PyPegen_class_def(expr_ty a, arguments_ty b, asdl_stmt_seq *c, asdl_type_param_seq *t,
int lineno, int col_offset, int end_lineno, int end_col_offset,
PyArena *arena)
{
identifier name = a->v.Name.id;
asdl_expr_seq *bases = (b) ? ((expr_ty) b)->v.Call.args : NULL;
asdl_keyword_seq *keywords = (b) ? ((expr_ty) b)->v.Call.keywords : NULL;
asdl_stmt_seq *body = c;
asdl_expr_seq *decorator_list = NULL;
asdl_type_param_seq *type_params = t;
return _PyAST_ClassDef(name, bases, keywords, body, decorator_list, type_params,
lineno, col_offset, end_lineno, end_col_offset, arena);
}

/* Construct a ClassDef equivalent to class_def, but with decorators */
stmt_ty
_PyPegen_class_def_decorators(Parser *p, asdl_expr_seq *decorators, stmt_ty class_def)
Expand Down
2 changes: 1 addition & 1 deletion 2 Parser/parser.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions 2 Parser/pegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,6 @@ expr_ty _PyPegen_formatted_value(Parser *, expr_ty, Token *, ResultTokenWithMeta
int, int, int, int, PyArena *);
AugOperator *_PyPegen_augoperator(Parser*, operator_ty type);
stmt_ty _PyPegen_function_def_decorators(Parser *, asdl_expr_seq *, stmt_ty);
stmt_ty _PyPegen_class_def(expr_ty, arguments_ty, asdl_stmt_seq *,
asdl_type_param_seq *, int, int, int, int, PyArena *);
stmt_ty _PyPegen_class_def_decorators(Parser *, asdl_expr_seq *, stmt_ty);
KeywordOrStarred *_PyPegen_keyword_or_starred(Parser *, void *, int);
asdl_expr_seq *_PyPegen_seq_extract_starred_exprs(Parser *, asdl_seq *);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.