Skip to content

bpo-39176: Fix wrong term 'named assignment' #17777

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
Jan 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
4 changes: 2 additions & 2 deletions Lib/test/test_named_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_named_expression_invalid_04(self):
def test_named_expression_invalid_06(self):
code = """((a, b) := (1, 2))"""

with self.assertRaisesRegex(SyntaxError, "cannot use named assignment with tuple"):
with self.assertRaisesRegex(SyntaxError, "cannot use assignment expressions with tuple"):
exec(code, {}, {})

def test_named_expression_invalid_07(self):
Expand Down Expand Up @@ -90,7 +90,7 @@ def test_named_expression_invalid_15(self):
code = """(lambda: x := 1)"""

with self.assertRaisesRegex(SyntaxError,
"cannot use named assignment with lambda"):
"cannot use assignment expressions with lambda"):
exec(code, {}, {})

def test_named_expression_invalid_16(self):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

>>> (True := 1)
Traceback (most recent call last):
SyntaxError: cannot use named assignment with True
SyntaxError: cannot use assignment expressions with True

>>> obj.__debug__ = 1
Traceback (most recent call last):
Expand Down
2 changes: 1 addition & 1 deletion Python/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,7 @@ ast_for_namedexpr(struct compiling *c, const node *n)
if (target->kind != Name_kind) {
const char *expr_name = get_expr_name(target);
if (expr_name != NULL) {
ast_error(c, n, "cannot use named assignment with %s", expr_name);
ast_error(c, n, "cannot use assignment expressions with %s", expr_name);
}
return NULL;
}
Expand Down