Skip to content

Commit 9df56a1

Browse files
committed
avoid setting the special argument if we don't need it
1 parent 6cb9edc commit 9df56a1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinFunctions.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,10 @@ Object execCustomGlobalsGlobalLocals(Object source, PDict globals, @SuppressWarn
570570
PCode code = createAndCheckCode(source);
571571
Object[] args = PArguments.create();
572572
setCustomGlobals(globals, setBuiltins, args);
573-
setCustomLocals(args, globals);
573+
// here, we don't need to set any locals, since the {Write,Read,Delete}NameNodes will
574+
// fall back (like their CPython counterparts) to writing to the globals. We only need
575+
// to ensure that the `locals()` call still gives us the globals dict
576+
PArguments.setPFrame(args, factory().createPFrame(globals));
574577
return indirectCallNode.call(code.getRootCallTarget(), args);
575578
}
576579

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/control/TopLevelExceptionHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ private Object run(VirtualFrame frame) {
221221
PythonModule mainModule = pythonContext.getMainModule();
222222
PHashingCollection mainDict = mainModule.getDict();
223223
PArguments.setGlobals(arguments, mainModule);
224-
PArguments.setSpecialArgument(arguments, mainDict);
225224
PArguments.setPFrame(arguments, pythonContext.getCore().factory().createPFrame(mainDict));
226225
}
227226
return innerCallTarget.call(arguments);

0 commit comments

Comments
 (0)