Example #1
0
        public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
            if (!context.HasModuleState(_defaultTimeoutKey)) {
                context.SetModuleState(_defaultTimeoutKey, null);
            }

            context.SetModuleState(_defaultBufsizeKey, DefaultBufferSize);

            PythonType socketErr = GetSocketError(context, dict);
            context.EnsureModuleException("socketherror", socketErr, dict, "herror", "socket");
            context.EnsureModuleException("socketgaierror", socketErr, dict, "gaierror", "socket");
            context.EnsureModuleException("sockettimeout", socketErr, dict, "timeout", "socket");
        }
Example #2
0
        public static void PerformModuleReload(PythonContext/*!*/ context, IAttributesCollection/*!*/ dict) {
            if (!context.HasModuleState(_defaultTimeoutKey)) {
                context.SetModuleState(_defaultTimeoutKey, null);
            }

            context.SetModuleState(_defaultBufsizeKey, DefaultBufferSize);

            context.EnsureModuleException("sslerror", dict, "sslerror", "socket");
            PythonType socketErr = context.EnsureModuleException("socketerror", PythonExceptions.IOError, dict, "error", "socket");
            context.EnsureModuleException("socketherror", socketErr, dict, "herror", "socket");
            context.EnsureModuleException("socketgaierror", socketErr, dict, "gaierror", "socket");
            context.EnsureModuleException("sockettimeout", socketErr, dict, "timeout", "socket");
        }
Example #3
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);
        }
Example #4
0
        public static void PerformModuleReload(PythonContext context, PythonDictionary dict) {
            if (!context.HasModuleState(_zip_directory_cache_key))
                context.SetModuleState(_zip_directory_cache_key, new PythonDictionary());

            dict["_zip_directory_cache"] = context.GetModuleState(_zip_directory_cache_key);
            InitModuleExceptions(context, dict);
        }
Example #5
0
        public static void PerformModuleReload(PythonContext context, PythonDictionary dict)
        {
            if (!context.HasModuleState(_zip_directory_cache_key))
            {
                context.SetModuleState(_zip_directory_cache_key, new PythonDictionary());
            }

            dict["_zip_directory_cache"] = context.GetModuleState(_zip_directory_cache_key);
            InitModuleExceptions(context, dict);
        }
Example #6
0
        public static void PerformModuleReload(PythonContext/*!*/ context, IAttributesCollection/*!*/ dict) {

            context.EnsureModuleException("ArgumentError", dict, "ArgumentError", "_ctypes");
            context.EnsureModuleException("COMError", dict, "COMError", "_ctypes");

            // TODO: Provide an implementation which is coordinated with our _refCountTable
            context.SystemState.__dict__["getrefcount"] = null;
            PythonDictionary pointerTypeCache = new PythonDictionary();
            dict[SymbolTable.StringToId("_pointer_type_cache")] = pointerTypeCache;
            context.SetModuleState(_pointerTypeCacheKey, pointerTypeCache);

            if (Environment.OSVersion.Platform == PlatformID.Win32NT ||
                Environment.OSVersion.Platform == PlatformID.Win32S ||
                Environment.OSVersion.Platform == PlatformID.Win32Windows ||
                Environment.OSVersion.Platform == PlatformID.WinCE) {
                context.SetModuleState(_conversion_mode, PythonTuple.MakeTuple("mbcs", "ignore"));
            } else {
                context.SetModuleState(_conversion_mode, PythonTuple.MakeTuple("ascii", "strict"));
            }
        }
Example #7
0
 public static void PerformModuleReload(PythonContext/*!*/ context, IAttributesCollection/*!*/ dict) {
     dict.Add(SymbolTable.StringToId(_keyDefaultAction), "default");
     dict.Add(SymbolTable.StringToId(_keyOnceRegistry), new PythonDictionary());
     dict.Add(SymbolTable.StringToId(_keyFilters), new List() {
         // Default filters
         PythonTuple.MakeTuple("ignore", null, PythonExceptions.PendingDeprecationWarning, null, 0),
         PythonTuple.MakeTuple("ignore", null, PythonExceptions.ImportWarning, null, 0),
         PythonTuple.MakeTuple("ignore", null, PythonExceptions.BytesWarning, null, 0)
     });
     context.SetModuleState(_keyFields, dict);
 }
Example #8
0
 public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
     context.SetModuleState(_stackSizeKey, 0);
     context.EnsureModuleException("threaderror", dict, "error", "thread");
 }
Example #9
0
 public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
     PythonSignalState pss = new PythonSignalState(context);
     context.SetModuleState(_PythonSignalStateKey, pss);
     NativeSignal.SetConsoleCtrlHandler(pss.WinAllSignalsHandlerDelegate, true);
 }
Example #10
0
 public static void PerformModuleReload(PythonContext/*!*/ context, IAttributesCollection/*!*/ 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);
     }
 }
Example #11
0
        public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
            context.NewObject = (BuiltinFunction)dict["__newobj__"];
            context.PythonReconstructor = (BuiltinFunction)dict["_reconstructor"];

            PythonDictionary dispatchTable = new PythonDictionary();
            dispatchTable[TypeCache.Complex64] = dict["pickle_complex"];

            context.SetModuleState(_dispatchTableKey, dict["dispatch_table"] = dispatchTable);
            context.SetModuleState(_extensionRegistryKey, dict["_extension_registry"] = new PythonDictionary());
            context.SetModuleState(_invertedRegistryKey, dict["_inverted_registry"] = new PythonDictionary());
            context.SetModuleState(_extensionCacheKey, dict["_extension_cache"] = new PythonDictionary());
        }
Example #12
0
 internal static void EnsureLocaleInitialized(PythonContext context) {
     if (!context.HasModuleState(_localeKey)) {
         context.SetModuleState(_localeKey, new LocaleInfo(context));
     }
 }
Example #13
0
 public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {            
     context.SetModuleState(_threadholdKey, PythonTuple.MakeTuple(64 * 1024, 256 * 1024, 1024 * 1024));
 }
        protected override void ExecuteInternal()
        {
            pythonContext = HostingHelpers.GetLanguageContext(Engine) as PythonContext;

            if (pythonContext != null)
            {
                foreach( var expose in exposeBuffer)
                {
                    pythonContext.BuiltinModuleDict[expose.Key] = expose.Value;
                }

                pythonContext.SetModuleState(typeof (ScriptEngine), Engine);
                base.ExecuteInternal();
            }
        }
Example #15
0
 public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {
     context.SetModuleState(_PythonSignalStateKey, MakeSignalState(context));
 }