@@ -98,8 +98,11 @@ public PFrame executeWith(VirtualFrame frame, PFrame.Reference startFrameInfo, F
98
98
PFrame .Reference callerInfo = curFrameInfo .getCallerInfo ();
99
99
if (callerInfo == null ) {
100
100
Frame callerFrame = getCallerFrame (startFrameInfo , frameAccess , skipInternal , level );
101
- ensureMaterializeNode ().execute (frame , false , true , callerFrame );
102
- return PArguments .getCurrentFrameInfo (callerFrame ).getPyFrame ();
101
+ if (callerFrame != null ) {
102
+ ensureMaterializeNode ().execute (frame , false , true , callerFrame );
103
+ return PArguments .getCurrentFrameInfo (callerFrame ).getPyFrame ();
104
+ }
105
+ return null ;
103
106
} else if (!(skipInternal && PRootNode .isPythonInternal (callerInfo .getCallNode ().getRootNode ()))) {
104
107
i ++;
105
108
}
@@ -117,11 +120,14 @@ private PFrame.Reference walkLevels(VirtualFrame frame, PFrame.Reference startFr
117
120
PFrame .Reference callerInfo = currentFrame .getCallerInfo ();
118
121
if (cachedCallerFrameProfile .profile (callerInfo == null )) {
119
122
Frame callerFrame = getCallerFrame (startFrameInfo , frameAccess , skipInternal , level );
120
- // At this point, we must 'materialize' the frame. Actually, the Truffle frame is
121
- // never materialized but we ensure that a corresponding PFrame is created and that
122
- // the locals and arguments are synced.
123
- ensureMaterializeNode ().execute (frame , false , true , callerFrame );
124
- return PArguments .getCurrentFrameInfo (callerFrame );
123
+ if (callerFrame != null ) {
124
+ // At this point, we must 'materialize' the frame. Actually, the Truffle frame
125
+ // is never materialized but we ensure that a corresponding PFrame is created
126
+ // and that the locals and arguments are synced.
127
+ ensureMaterializeNode ().execute (frame , false , true , callerFrame );
128
+ return PArguments .getCurrentFrameInfo (callerFrame );
129
+ }
130
+ return PFrame .Reference .EMPTY ;
125
131
} else if (!(skipInternal && PRootNode .isPythonInternal (callerInfo .getCallNode ().getRootNode ()))) {
126
132
i ++;
127
133
}
0 commit comments