示例#1
0
        public static void PerformModuleReload(PythonContext context, PythonDictionary dict)
        {
            if (!context.HasModuleState(_fieldSizeLimitKey))
            {
                context.SetModuleState(_fieldSizeLimitKey, FieldSizeLimit);
            }

            if (!context.HasModuleState(_dialectRegistryKey))
            {
                context.SetModuleState(_dialectRegistryKey,
                                       new DialectRegistry());
            }
            InitModuleExceptions(context, dict);
        }
示例#2
0
 internal static void EnsureLocaleInitialized(PythonContext context)
 {
     if (!context.HasModuleState(_localeKey))
     {
         context.SetModuleState(_localeKey, new LocaleInfo(context));
     }
 }
示例#3
0
 public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict)
 {
     // set the lock count to zero on the 1st load, don't reset the lock count on reloads
     if (!context.HasModuleState(_lockCountKey))
     {
         context.SetModuleState(_lockCountKey, 0L);
     }
 }
示例#4
0
        public static void PerformModuleReload(PythonContext context, PythonDictionary dict)
        {
            if (!context.HasModuleState(_registry_key))
            {
                context.SetModuleState(_registry_key, new List <FunctionDescriptor>());
            }

            context.SetSystemStateValue("exitfunc", (Action <CodeContext>)_run_exitfuncs);
        }
示例#5
0
        private static int GetFieldSizeLimit(CodeContext /*!*/ context)
        {
            PythonContext ctx = PythonContext.GetContext(context);

            if (!ctx.HasModuleState(_fieldSizeLimitKey))
            {
                ctx.SetModuleState(_fieldSizeLimitKey, FieldSizeLimit);
            }

            return((int)ctx.GetModuleState(_fieldSizeLimitKey));
        }
示例#6
0
        /// <summary>
        /// Returns the dialects from the code context.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private static DialectRegistry GetDialects(CodeContext /*!*/ context)
        {
            PythonContext ctx = PythonContext.GetContext(context);

            if (!ctx.HasModuleState(_dialectRegistryKey))
            {
                ctx.SetModuleState(_dialectRegistryKey,
                                   new DialectRegistry());
            }

            return((DialectRegistry)ctx.GetModuleState(_dialectRegistryKey));
        }