Skip to content

Commit 6b97598

Browse files
bpo-39988: Remove ast.AugLoad and ast.AugStore node classes. (GH-19038)
1 parent dab8423 commit 6b97598

File tree

7 files changed

+53
-179
lines changed

7 files changed

+53
-179
lines changed

Doc/whatsnew/3.9.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,9 +678,10 @@ Removed
678678
defining ``COUNT_ALLOCS`` macro.
679679
(Contributed by Victor Stinner in :issue:`39489`.)
680680

681-
* The ``ast.Suite`` and ``ast.Param`` node classes has been removed due to no
682-
longer being needed.
683-
(Contributed by Batuhan Taskaya in :issue:`39639` and :issue:`39969`.)
681+
* The ``ast.Suite``, ``ast.Param``, ``ast.AugLoad`` and ``ast.AugStore``
682+
node classes have been removed due to no longer being needed.
683+
(Contributed by Batuhan Taskaya in :issue:`39639` and :issue:`39969`
684+
and Serhiy Storchaka in :issue:`39988`.)
684685

685686

686687
Porting to Python 3.9

Include/Python-ast.h

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Removed ``ast.AugLoad`` and ``ast.AugStore`` node classes because they are
2+
no longer used.

Parser/Python.asdl

Lines 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
93+
expr_context = Load | Store | Del
9494

9595
boolop = And | Or
9696

Python/Python-ast.c

Lines changed: 1 addition & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/ast.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ expr_context_name(expr_context_ty ctx)
7171
return "Store";
7272
case Del:
7373
return "Del";
74-
case AugLoad:
75-
return "AugLoad";
76-
case AugStore:
77-
return "AugStore";
7874
default:
7975
Py_UNREACHABLE();
8076
}
@@ -1099,14 +1095,7 @@ set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n)
10991095
{
11001096
asdl_seq *s = NULL;
11011097

1102-
/* The ast defines augmented store and load contexts, but the
1103-
implementation here doesn't actually use them. The code may be
1104-
a little more complex than necessary as a result. It also means
1105-
that expressions in an augmented assignment have a Store context.
1106-
Consider restructuring so that augmented assignment uses
1107-
set_context(), too.
1108-
*/
1109-
assert(ctx != AugStore && ctx != AugLoad);
1098+
/* Expressions in an augmented assignment have a Store context. */
11101099

11111100
switch (e->kind) {
11121101
case Attribute_kind:

0 commit comments

Comments
 (0)