Skip to content

Commit 86ea860

Browse files
committed
Handle all possible return types of GetDictNode
1 parent bb7777f commit 86ea860

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,16 @@ private PDict getSysDict() {
249249
return (PDict) getDictNode.execute(getContext().getCore().lookupBuiltinModule("sys"));
250250
}
251251

252-
private PDict getGlobalsDict(Object globals) {
252+
private Object getGlobalsDict(Object globals) {
253253
if (globals instanceof PDict) {
254-
return (PDict) globals;
254+
return globals;
255255
}
256256
if (getDictNode == null) {
257257
CompilerDirectives.transferToInterpreterAndInvalidate();
258258
reportPolymorphicSpecialize();
259259
getDictNode = insert(GetDictNode.create());
260260
}
261-
return (PDict) getDictNode.execute(globals);
261+
return getDictNode.execute(globals);
262262
}
263263

264264
private PFrame getCallerFrame(VirtualFrame frame, int stackLevel) {
@@ -710,7 +710,7 @@ private void setupContext(VirtualFrame frame, int stackLevel, String[] filename,
710710
lineno[0] = 1;
711711
} else {
712712
globals = getGlobalsDict(f.getGlobals());
713-
if (globals == null) {
713+
if (globals == null || globals instanceof PNone) {
714714
globals = getSysDict();
715715
}
716716
lineno[0] = f.getLine();

0 commit comments

Comments
 (0)