Make get_module_names return top-level async functions when all_scopes=False.

This commit is contained in:
forest93 committed 2019-04-11 23:38:55 +08:00
1 parent c801e24afc
commit 1e12e1e318
2 files changed
+23 -4

No files matched your search

+3
View File
@@ -190,6 +190,9 @@ def get_module_names(module, all_scopes):
# but that would be a big change that could break type inference, whereas for now
# this discrepancy looks like only a problem for "get_module_names".
parent_scope = parent_scope.parent
# async functions have an extra wrapper. Strip it.
if parent_scope and parent_scope.type == 'async_stmt':
parent_scope = parent_scope.parent
return parent_scope in (module, None)
names = [n for n in names if is_module_scope_name(n)]