From 39dd141a4ba68bbb38fd00a65cdcff711acdafb5 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 1 Jun 2021 14:07:05 +0300 Subject: bpo-44273: Improve syntax error message for assigning to "..." (GH-26477) Use "ellipsis" instead of "Ellipsis" in syntax error messages to eliminate confusion with built-in variable Ellipsis. --- Lib/test/test_syntax.py | 2 +- Parser/pegen.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index cc189ef..c000028 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -93,7 +93,7 @@ SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='? >>> ... = 1 Traceback (most recent call last): -SyntaxError: cannot assign to Ellipsis here. Maybe you meant '==' instead of '='? +SyntaxError: cannot assign to ellipsis here. Maybe you meant '==' instead of '='? >>> `1` = 1 Traceback (most recent call last): diff --git a/Parser/pegen.c b/Parser/pegen.c index 548a647..aac7e36 100644 --- a/Parser/pegen.c +++ b/Parser/pegen.c @@ -217,7 +217,7 @@ _PyPegen_get_expr_name(expr_ty e) return "True"; } if (value == Py_Ellipsis) { - return "Ellipsis"; + return "ellipsis"; } return "literal"; } -- cgit v0.12