mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-20 03:11:17 +08:00
Add issue 'nonlocal declaration not allowed at module level'
This commit is contained in:
@@ -313,6 +313,10 @@ class ErrorFinder(Normalizer):
|
||||
# f(+x=1)
|
||||
message = "keyword can't be an expression"
|
||||
self._add_syntax_error(message, first)
|
||||
elif node.type == 'nonlocal_stmt':
|
||||
if self._context.parent_context is None:
|
||||
message = "nonlocal declaration not allowed at module level"
|
||||
self._add_syntax_error(message, node)
|
||||
|
||||
yield
|
||||
|
||||
|
||||
Reference in New Issue
Block a user