Skip to content

bpo-39969: Remove ast.Param node class #19020

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 2 commits into from
Mar 15, 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
5 changes: 3 additions & 2 deletions Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,9 @@ Removed
defining ``COUNT_ALLOCS`` macro.
(Contributed by Victor Stinner in :issue:`39489`.)

* The ``ast.Suite`` node class has been removed due to no longer being needed.
(Contributed by Batuhan Taskaya in :issue:`39639`.)
* The ``ast.Suite`` and ``ast.Param`` node classes has been removed due to no
longer being needed.
(Contributed by Batuhan Taskaya in :issue:`39639` and :issue:`39969`.)


Porting to Python 3.9
Expand Down
4 changes: 2 additions & 2 deletions Include/Python-ast.h

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove ``ast.Param`` node class because it's no longer used. Patch by
Batuhan Taskaya.
2 changes: 1 addition & 1 deletion Parser/Python.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module Python
-- col_offset is the byte offset in the utf8 string the parser uses
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)

expr_context = Load | Store | Del | AugLoad | AugStore | Param
expr_context = Load | Store | Del | AugLoad | AugStore

boolop = And | Or

Expand Down
26 changes: 0 additions & 26 deletions Python/Python-ast.c

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

2 changes: 0 additions & 2 deletions Python/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ expr_context_name(expr_context_ty ctx)
return "AugLoad";
case AugStore:
return "AugStore";
case Param:
return "Param";
default:
Py_UNREACHABLE();
}
Expand Down
37 changes: 19 additions & 18 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3579,10 +3579,10 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
case AugStore:
break;
case Del: op = DELETE_DEREF; break;
case Param:
default:
PyErr_SetString(PyExc_SystemError,
"param invalid for deref variable");
PyErr_Format(PyExc_SystemError,
"expr_context kind %d should not be possible",
ctx);
return 0;
}
break;
Expand All @@ -3596,10 +3596,10 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
case AugLoad:
case AugStore:
break;
case Param:
default:
PyErr_SetString(PyExc_SystemError,
"param invalid for local variable");
PyErr_Format(PyExc_SystemError,
"expr_context kind %d should not be possible",
ctx);
return 0;
}
ADDOP_N(c, op, mangled, varnames);
Expand All @@ -3614,10 +3614,10 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
case AugLoad:
case AugStore:
break;
case Param:
default:
PyErr_SetString(PyExc_SystemError,
"param invalid for global variable");
PyErr_Format(PyExc_SystemError,
"expr_context kind %d should not be possible",
ctx);
return 0;
}
break;
Expand All @@ -3631,10 +3631,10 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
case AugLoad:
case AugStore:
break;
case Param:
default:
PyErr_SetString(PyExc_SystemError,
"param invalid for name variable");
PyErr_Format(PyExc_SystemError,
"expr_context kind %d should not be possible",
ctx);
return 0;
}
break;
Expand Down Expand Up @@ -5058,10 +5058,10 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
case Del:
ADDOP_NAME(c, DELETE_ATTR, e->v.Attribute.attr, names);
break;
case Param:
default:
PyErr_SetString(PyExc_SystemError,
"param invalid in attribute expression");
PyErr_Format(PyExc_SystemError,
"expr_context kind %d should not be possible",
e->v.Attribute.ctx);
return 0;
}
break;
Expand Down Expand Up @@ -5359,9 +5359,10 @@ compiler_subscript(struct compiler *c, expr_ty e)
case AugStore:/* fall through to Store */
case Store: op = STORE_SUBSCR; break;
case Del: op = DELETE_SUBSCR; break;
case Param:
PyErr_SetString(PyExc_SystemError,
"param invalid in subscript expression");
default:
PyErr_Format(PyExc_SystemError,
"expr_context kind %d should not be possible",
ctx);
return 0;
}
if (ctx == AugStore) {
Expand Down