/// Replaces PyValue with an instance of PyType, if PyValue is not already an instance of PyType.
/// Often PyValue is a string and this method will replace it with a proper exception object.
/// Must not be called when an error is set.
/// </summary>
publicvoidNormalize()
{
IntPtrgs=PythonEngine.AcquireLock();
try
{
if(Exceptions.ErrorOccurred())thrownewInvalidOperationException("Cannot normalize when an error is set");
// If an error is set and this PythonException is unnormalized, the error will be cleared and the PythonException will be replaced by a different error.