[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/sdpython/pythonnet/master/src/runtime/generictype.cs [Back]  [Original]

using System;

namespace Python.Runtime
{
    /// 
    /// Implements reflected generic types. Note that the Python behavior
    /// is the same for both generic type definitions and constructed open
    /// generic types. Both are essentially factories for creating closed
    /// types based on the required generic type parameters.
    /// 
    [Serializable]
    internal class GenericType : ClassBase
    {
        internal GenericType(Type tp) : base(tp)
        {
        }

        /// 
        /// Implements __new__ for reflected generic types.
        /// 
        public static IntPtr tp_new(IntPtr tp, IntPtr args, IntPtr kw)
        {
            Exceptions.SetError(Exceptions.TypeError, "cannot instantiate an open generic type");
            return IntPtr.Zero;
        }


        /// 
        /// Implements __call__ for reflected generic types.
        /// 
        public static IntPtr tp_call(IntPtr ob, IntPtr args, IntPtr kw)
        {
            Exceptions.SetError(Exceptions.TypeError, "object is not callable");
            return IntPtr.Zero;
        }
    }
}

Web Proxy Viewer  |  New URL  |  Original Page