File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ internal CLRObject(Object ob, IntPtr tp) : base()
3232 inst = ob ;
3333
3434 // Fix the BaseException args slot if wrapping a CLR exception
35- Exceptions . SetArgs ( py ) ;
35+ Exceptions . SetArgsAndCause ( py ) ;
3636 }
3737
3838
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ internal static void Shutdown()
144144 /// </summary>
145145 /// <param name="e">A CLR exception</param>
146146 /// <param name="ob">The python object wrapping </param>
147- internal static void SetArgs ( IntPtr ob )
147+ internal static void SetArgsAndCause ( IntPtr ob )
148148 {
149149 var e = ExceptionClassObject . ToException ( ob ) ;
150150 if ( e == null )
@@ -163,6 +163,15 @@ internal static void SetArgs(IntPtr ob)
163163 }
164164
165165 Marshal . WriteIntPtr ( ob , ExceptionOffset . args , args ) ;
166+
167+ #if ! ( PYTHON25 || PYTHON26 || PYTHON27 )
168+ if ( e . InnerException != null )
169+ {
170+ IntPtr cause = CLRObject . GetInstHandle ( e . InnerException ) ;
171+ Runtime . XIncref ( cause ) ;
172+ Marshal . WriteIntPtr ( ob , ExceptionOffset . cause , cause ) ;
173+ }
174+ #endif
166175 }
167176
168177 /// <summary>
You can’t perform that action at this time.
0 commit comments