We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b7989e commit e85675eCopy full SHA for e85675e
src/execnet/gateway.py
@@ -172,14 +172,15 @@ def _find_non_builtin_globals(source, codeobj):
172
173
import builtins as __builtin__
174
175
- vars = dict.fromkeys(codeobj.co_varnames)
176
- return [
177
- node.id
178
- for node in ast.walk(ast.parse(source))
179
- if isinstance(node, ast.Name)
180
- and node.id not in vars
181
- and node.id not in __builtin__.__dict__
182
- ]
+ vars = set(codeobj.co_varnames)
+ vars.update(__builtin__.__dict__)
+
+ res = []
+ for node in ast.walk(ast.parse(source)):
+ if isinstance(node, ast.Name) and node.id not in vars:
+ vars.add(node.id)
+ res.append(node.id)
183
+ return res
184
185
186
def _source_of_function(function):
0 commit comments