bpo-34084: Fix setting an error message for the "Barry as BDFL" easter egg. (GH-8262) (GH-8423)
(cherry picked from commit aba24ff3601ddc86b85e01880a8be596fb799287)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 9b9d63c..c4ec5ac 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1348,6 +1348,10 @@
msg = "unexpected indent";
else if (err->token == DEDENT)
msg = "unexpected unindent";
+ else if (err->expected == NOTEQUAL) {
+ errtype = PyExc_SyntaxError;
+ msg = "with Barry as BDFL, use '<>' instead of '!='";
+ }
else {
errtype = PyExc_SyntaxError;
msg = "invalid syntax";