mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-20 03:11:17 +08:00
Add issue 'import * only allowed at module level'
This commit is contained in:
@@ -166,6 +166,10 @@ class ErrorFinder(Normalizer):
|
||||
elif name not in ALLOWED_FUTURES:
|
||||
message = "future feature %s is not defined" % name
|
||||
self._add_syntax_error(message, node)
|
||||
elif node.type == 'import_from':
|
||||
if node.is_star_import() and self._context.parent_context is not None:
|
||||
message = "import * only allowed at module level"
|
||||
self._add_syntax_error(message, node)
|
||||
elif node.type == 'import_as_names':
|
||||
if node.children[-1] == ',':
|
||||
# from foo import a,
|
||||
|
||||
Reference in New Issue
Block a user