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

Commit 8689209

Browse filesBrowse files
authored
bpo-39969: Remove ast.Param node class as is no longer used (GH-19020)
1 parent 61ac612 commit 8689209
Copy full SHA for 8689209

File tree

7 files changed

+27
-51
lines changed
Filter options

7 files changed

+27
-51
lines changed

‎Doc/whatsnew/3.9.rst

Copy file name to clipboardExpand all lines: Doc/whatsnew/3.9.rst
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,9 @@ Removed
664664
defining ``COUNT_ALLOCS`` macro.
665665
(Contributed by Victor Stinner in :issue:`39489`.)
666666

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

670671

671672
Porting to Python 3.9

‎Include/Python-ast.h

Copy file name to clipboardExpand all lines: Include/Python-ast.h
+2-2Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove ``ast.Param`` node class because it's no longer used. Patch by
2+
Batuhan Taskaya.

‎Parser/Python.asdl

Copy file name to clipboardExpand all lines: Parser/Python.asdl
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ module Python
9090
-- col_offset is the byte offset in the utf8 string the parser uses
9191
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
9292

93-
expr_context = Load | Store | Del | AugLoad | AugStore | Param
93+
expr_context = Load | Store | Del | AugLoad | AugStore
9494

9595
boolop = And | Or
9696

‎Python/Python-ast.c

Copy file name to clipboardExpand all lines: Python/Python-ast.c
-26Lines changed: 0 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Python/ast.c

Copy file name to clipboardExpand all lines: Python/ast.c
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ expr_context_name(expr_context_ty ctx)
7575
return "AugLoad";
7676
case AugStore:
7777
return "AugStore";
78-
case Param:
79-
return "Param";
8078
default:
8179
Py_UNREACHABLE();
8280
}

‎Python/compile.c

Copy file name to clipboardExpand all lines: Python/compile.c
+19-18Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3579,10 +3579,10 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
35793579
case AugStore:
35803580
break;
35813581
case Del: op = DELETE_DEREF; break;
3582-
case Param:
35833582
default:
3584-
PyErr_SetString(PyExc_SystemError,
3585-
"param invalid for deref variable");
3583+
PyErr_Format(PyExc_SystemError,
3584+
"expr_context kind %d should not be possible",
3585+
ctx);
35863586
return 0;
35873587
}
35883588
break;
@@ -3596,10 +3596,10 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
35963596
case AugLoad:
35973597
case AugStore:
35983598
break;
3599-
case Param:
36003599
default:
3601-
PyErr_SetString(PyExc_SystemError,
3602-
"param invalid for local variable");
3600+
PyErr_Format(PyExc_SystemError,
3601+
"expr_context kind %d should not be possible",
3602+
ctx);
36033603
return 0;
36043604
}
36053605
ADDOP_N(c, op, mangled, varnames);
@@ -3614,10 +3614,10 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
36143614
case AugLoad:
36153615
case AugStore:
36163616
break;
3617-
case Param:
36183617
default:
3619-
PyErr_SetString(PyExc_SystemError,
3620-
"param invalid for global variable");
3618+
PyErr_Format(PyExc_SystemError,
3619+
"expr_context kind %d should not be possible",
3620+
ctx);
36213621
return 0;
36223622
}
36233623
break;
@@ -3631,10 +3631,10 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx)
36313631
case AugLoad:
36323632
case AugStore:
36333633
break;
3634-
case Param:
36353634
default:
3636-
PyErr_SetString(PyExc_SystemError,
3637-
"param invalid for name variable");
3635+
PyErr_Format(PyExc_SystemError,
3636+
"expr_context kind %d should not be possible",
3637+
ctx);
36383638
return 0;
36393639
}
36403640
break;
@@ -5058,10 +5058,10 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
50585058
case Del:
50595059
ADDOP_NAME(c, DELETE_ATTR, e->v.Attribute.attr, names);
50605060
break;
5061-
case Param:
50625061
default:
5063-
PyErr_SetString(PyExc_SystemError,
5064-
"param invalid in attribute expression");
5062+
PyErr_Format(PyExc_SystemError,
5063+
"expr_context kind %d should not be possible",
5064+
e->v.Attribute.ctx);
50655065
return 0;
50665066
}
50675067
break;
@@ -5359,9 +5359,10 @@ compiler_subscript(struct compiler *c, expr_ty e)
53595359
case AugStore:/* fall through to Store */
53605360
case Store: op = STORE_SUBSCR; break;
53615361
case Del: op = DELETE_SUBSCR; break;
5362-
case Param:
5363-
PyErr_SetString(PyExc_SystemError,
5364-
"param invalid in subscript expression");
5362+
default:
5363+
PyErr_Format(PyExc_SystemError,
5364+
"expr_context kind %d should not be possible",
5365+
ctx);
53655366
return 0;
53665367
}
53675368
if (ctx == AugStore) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.