/// <summary> /// Helper to get the CLR exception associated w/ this Python exception /// creating it if one has not already been created. /// </summary> internal /*!*/ System.Exception GetClrException(Exception innerException = null) { if (_clrException != null) { return(_clrException); } string stringMessage = _message as string; if (String.IsNullOrEmpty(stringMessage)) { stringMessage = _type.Name; } System.Exception newExcep = _type._makeException(stringMessage, innerException); newExcep.SetPythonException(this); Interlocked.CompareExchange <System.Exception>(ref _clrException, newExcep, null); return(_clrException); }