summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-11-09 14:03:32 (GMT)
committerGitHub <noreply@github.com>2021-11-09 14:03:32 (GMT)
commit2819e98d1048238bf94dc2ba88ae2455d01861bc (patch)
tree3c6e0d26fd6dd869a17ac148299b824531c48174 /Lib
parentf4c03484da59049eb62a9bf7777b963e2267d187 (diff)
downloadcpython-2819e98d1048238bf94dc2ba88ae2455d01861bc.zip
cpython-2819e98d1048238bf94dc2ba88ae2455d01861bc.tar.gz
cpython-2819e98d1048238bf94dc2ba88ae2455d01861bc.tar.bz2
bpo-45764: improve error message when missing '(' after 'def' (GH-29484)
to achieve this, change the grammar to expect the '(' token after 'def' NAME. Automerge-Triggered-By: GH:pablogsal
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_syntax.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 014a30a..65d18e4 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -898,6 +898,17 @@ leading to spurious errors.
Traceback (most recent call last):
SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?
+
+Missing parens after function definition
+
+ >>> def f:
+ Traceback (most recent call last):
+ SyntaxError: expected '('
+
+ >>> async def f:
+ Traceback (most recent call last):
+ SyntaxError: expected '('
+
Custom error messages for try blocks that are not followed by except/finally
>>> try: