File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -295,7 +295,14 @@ public Object run(VirtualFrame frame,
295
295
PTraceback exceptionTraceback = getTracebackNode .execute (frame , exception );
296
296
// n.b. a call to 'sys.exc_info' always creates a new traceback with the current
297
297
// frame and links (via 'tb_next') to the traceback of the exception
298
- PTraceback chainedTraceback = factory ().createTraceback (escapedFrame , exceptionTraceback );
298
+ PTraceback chainedTraceback ;
299
+ if (exceptionTraceback != null ) {
300
+ chainedTraceback = factory ().createTraceback (escapedFrame , exceptionTraceback );
301
+ } else {
302
+ // it's still possible that there is no traceback if, for example, the exception
303
+ // has been thrown and caught and did never escape
304
+ chainedTraceback = factory ().createTraceback (escapedFrame , currentException );
305
+ }
299
306
exception .setTraceback (chainedTraceback );
300
307
return factory ().createTuple (new Object []{getClassNode .execute (exception ), exception , chainedTraceback });
301
308
}
You can’t perform that action at this time.
0 commit comments