From: Pablo Galindo Date: Thu, 3 Jun 2021 21:22:28 +0000 (+0100) Subject: [3.10] bpo-44273: Improve syntax error message for assigning to "..." (GH-26477)... X-Git-Tag: v3.10.0b3~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3283bf4519139cf62ba04a76930f84ca1e7da910;p=thirdparty%2FPython%2Fcpython.git [3.10] bpo-44273: Improve syntax error message for assigning to "..." (GH-26477) (GH-26478) Use "ellipsis" instead of "Ellipsis" in syntax error messages to eliminate confusion with built-in variable Ellipsis. (cherry picked from commit 39dd141) Co-authored-by: Serhiy Storchaka Co-authored-by: Serhiy Storchaka --- diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index cc189ef0f54b..c000028e5f1a 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 548a64788dec..aac7e368a799 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"; }