Skip to content

Commit 47606c2

Browse files
committed
Add preventive measure to check for null python traceback for clr bubbled exceptions
1 parent 8836d3d commit 47606c2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/runtime/PythonException.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ private static Exception FromPyErr(BorrowedReference typeRef, BorrowedReference
187187
if (exception is not null)
188188
{
189189
// Return ClrBubbledExceptions when they are bubbled from Python -> C# -> Python -> C# -> ...
190-
if (exception is ClrBubbledException)
190+
// or when the traceback is not available, so we fall back to the original behavior
191+
if (exception is ClrBubbledException || traceback is null)
191192
{
192193
return exception;
193194
}

0 commit comments

Comments
 (0)