Python.Runtime.Exceptions.Clear C# (CSharp) Method

Clear() public static method

Clear Method
Clear any exception that has been set in the Python runtime.
public static Clear ( ) : void
return void
        public static void Clear()
        {
            Runtime.PyErr_Clear();
        }

Usage Example

Example #1
0
        /// <summary>
        /// Given a sequence of MethodInfo and a sequence of type parameters,
        /// return the MethodInfo that represents the matching closed generic.
        /// If unsuccessful, returns null and may set a Python error.
        /// </summary>
        internal static MethodInfo MatchParameters(MethodInfo[] mi, Type[] tp)
        {
            if (tp == null)
            {
                return(null);
            }
            int count = tp.Length;

            foreach (MethodInfo t in mi)
            {
                if (!t.IsGenericMethodDefinition)
                {
                    continue;
                }
                Type[] args = t.GetGenericArguments();
                if (args.Length != count)
                {
                    continue;
                }
                try
                {
                    // MakeGenericMethod can throw ArgumentException if the type parameters do not obey the constraints.
                    MethodInfo method = t.MakeGenericMethod(tp);
                    Exceptions.Clear();
                    return(method);
                }
                catch (ArgumentException e)
                {
                    Exceptions.SetError(e);
                    // The error will remain set until cleared by a successful match.
                }
            }
            return(null);
        }
All Usage Examples Of Python.Runtime.Exceptions::Clear