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 6a606d1 commit 2ae6b8eCopy full SHA for 2ae6b8e
src/execnet/gateway.py
@@ -169,14 +169,15 @@ def _find_non_builtin_globals(source, codeobj):
169
import ast
170
import builtins
171
172
- vars = dict.fromkeys(codeobj.co_varnames)
173
- return [
174
- node.id
175
- for node in ast.walk(ast.parse(source))
176
- if isinstance(node, ast.Name)
177
- and node.id not in vars
178
- and node.id not in builtins.__dict__
179
- ]
+ vars = set(codeobj.co_varnames)
+ vars.update(builtins.__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)
180
+ return res
181
182
183
def _source_of_function(function):
0 commit comments