[3.10] bpo-44273: Improve syntax error message for assigning to "..." (GH-26477) (GH-26478)
June 3, 2021
9:22 p.m.
https://github.com/python/cpython/commit/3283bf4519139cf62ba04a76930f84ca1e7da910
commit: 3283bf4519139cf62ba04a76930f84ca1e7da910
branch: 3.10
author: Pablo Galindo <Pablogsal@gmail.com>
committer: pablogsal <Pablogsal@gmail.com>
date: 2021-06-03T22:22:28+01:00
summary:
[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 <storchaka@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
files:
M Lib/test/test_syntax.py
M Parser/pegen.c
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index cc189ef0f54b52..c000028e5f1aaa 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -93,7 +93,7 @@
>>> ... = 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 548a64788dec4b..aac7e368a799f8 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";
}
1865
Age (days ago)
1865
Last active (days ago)
0 comments
1 participants
participants (1)
-
pablogsal