Exemplo n.º 1
0
 public static object Call(CodeContext /*!*/ context, TypeGroup /*!*/ self, [ParamDictionary] PythonDictionary kwArgs, params object[] args)
 {
     return(PythonCalls.CallWithKeywordArgs(
                context,
                DynamicHelpers.GetPythonTypeFromType(self.GetNonGenericType()),
                args ?? ArrayUtils.EmptyObjects,
                kwArgs ?? new PythonDictionary()
                ));
 }
Exemplo n.º 2
0
        internal static object CallWorker(CodeContext /*!*/ context, PythonType dt, KwCallInfo args)
        {
            object[] clsArgs   = ArrayUtils.Insert <object>(dt, args.Arguments);
            object   newObject = PythonCalls.CallWithKeywordArgs(context,
                                                                 GetTypeNew(context, dt),
                                                                 clsArgs,
                                                                 args.Names);

            if (newObject == null)
            {
                return(null);
            }

            if (ShouldInvokeInit(dt, DynamicHelpers.GetPythonType(newObject), args.Arguments.Length))
            {
                PythonCalls.CallWithKeywordArgs(context, GetInitMethod(context, dt, newObject), args.Arguments, args.Names);

                AddFinalizer(context, dt, newObject);
            }

            return(newObject);
        }