Exemple #1
0
        public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict)
        {
            context.EnsureModuleException("ArgumentError", dict, "ArgumentError", "_ctypes");

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

            dict["_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.EnsureModuleException(
                    "COMError",
                    PythonExceptions.Exception,
                    typeof(_COMError),
                    dict,
                    "COMError",
                    "_ctypes",
                    "Raised when a COM method call failed.",
                    (msg, _) => new COMException(msg)
                    );

                context.SetModuleState(_conversion_mode, PythonTuple.MakeTuple("mbcs", "ignore"));
            }
            else
            {
                context.SetModuleState(_conversion_mode, PythonTuple.MakeTuple("ascii", "strict"));
            }
        }
Exemple #2
0
 private static void InitModuleExceptions(PythonContext context, PythonDictionary dict)
 {
     Warning           = context.EnsureModuleException("sqlite.Warning", PythonExceptions.StandardError, dict, "Warning", "_sqlite3");
     Error             = context.EnsureModuleException("sqlite.Error", PythonExceptions.StandardError, dict, "Error", "_sqlite3");
     InterfaceError    = context.EnsureModuleException("sqlite.InterfaceError", Error, dict, "InterfaceError", "_sqlite3");
     DatabaseError     = context.EnsureModuleException("sqlite.DatabaseError", Error, dict, "DatabaseError", "_sqlite3");
     DataError         = context.EnsureModuleException("sqlite.DataError", DatabaseError, dict, "DataError", "_sqlite3");
     OperationalError  = context.EnsureModuleException("sqlite.OperationalError", DatabaseError, dict, "OperationalError", "_sqlite3");
     IntegrityError    = context.EnsureModuleException("sqlite.IntegrityError", DatabaseError, dict, "IntegrityError", "_sqlite3");
     InternalError     = context.EnsureModuleException("sqlite.InternalError", DatabaseError, dict, "InternalError", "_sqlite3");
     ProgrammingError  = context.EnsureModuleException("sqlite.ProgrammingError", DatabaseError, dict, "ProgrammingError", "_sqlite3");
     NotSupportedError = context.EnsureModuleException("sqlite.NotSupportedError", DatabaseError, dict, "NotSupportedError", "_sqlite3");
 }
Exemple #3
0
        public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict)
        {
            var socket      = context.GetBuiltinModule("socket");
            var socketError = PythonSocket.GetSocketError(context, socket.__dict__);

            context.EnsureModuleException("SSLError", socketError, dict, "SSLError", "ssl");
        }
 /// <summary>
 /// Initialize exception
 /// </summary>
 /// <param name="context"></param>
 /// <param name="dict"></param>
 private static void InitModuleExceptions(PythonContext context, PythonDictionary dict)
 {
     GenericImporterError = context.EnsureModuleException(
         "genericimporter.GenericImporterError",
         PythonExceptions.ImportError,
         typeof(PythonExceptions.BaseException),
         dict, "GenericImporterError", "genericimporter",
         msg => new ImportException(msg));
 }
Exemple #5
0
        public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict)
        {
            var exception = context.EnsureModuleException("pyexpaterror", dict, "ExpatError", "xml.parsers.expat");

            dict["error"]      = exception;
            dict["ExpatError"] = exception;

            context.GetOrCreateModuleState(_errorsKey, () => {
                dict.Add("errors", new PyExpatErrors());
                return(dict);
            });
        }
Exemple #6
0
        public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict)
        {
            var sslError = context.EnsureModuleException("SSLError", PythonSocket.error, dict, "SSLError", "ssl");

            context.EnsureModuleException("SSLZeroReturnError", sslError, dict, "SSLZeroReturnError", "ssl");
            context.EnsureModuleException("SSLWantWriteError", sslError, dict, "SSLWantWriteError", "ssl");
            context.EnsureModuleException("SSLSyscallError", sslError, dict, "SSLSyscallError", "ssl");
            context.EnsureModuleException("SSLEOFError", sslError, dict, "SSLEOFError", "ssl");
            context.EnsureModuleException("SSLWantReadError", sslError, dict, "SSLWantReadError", "ssl");
        }
Exemple #7
0
 public static void PerformModuleReload(PythonContext/*!*/ context, PythonDictionary/*!*/ dict) {            
     var socket = context.GetBuiltinModule("_socket");
     var socketError = PythonSocket.GetSocketError(context, socket.__dict__);
     
     var sslError = context.EnsureModuleException("SSLError", socketError, dict, "SSLError", "ssl");
     context.EnsureModuleException("SSLZeroReturnError", sslError, dict, "SSLZeroReturnError", "ssl");
     context.EnsureModuleException("SSLWantWriteError", sslError, dict, "SSLWantWriteError", "ssl");
     context.EnsureModuleException("SSLSyscallError", sslError, dict, "SSLSyscallError", "ssl");
     context.EnsureModuleException("SSLEOFError", sslError, dict, "SSLEOFError", "ssl");
     context.EnsureModuleException("SSLWantReadError", sslError, dict, "SSLWantReadError", "ssl");
 }
Exemple #8
0
 public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict)
 {
     context.SetModuleState(_stackSizeKey, 0);
     context.EnsureModuleException("threaderror", dict, "error", "thread");
 }
Exemple #9
0
 private static void InitModuleExceptions(PythonContext context,
                                          PythonDictionary dict)
 {
     Error = context.EnsureModuleException("csv.Error",
                                           PythonExceptions.StandardError, dict, "Error", "_csv");
 }
Exemple #10
0
 public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict)
 {
     context.EnsureModuleException("audiooperror", dict, "error", "audioop");
 }
Exemple #11
0
 public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict)
 {
     context.EnsureModuleException(_ErrorKey, dict, "Error", "binascii");
     context.EnsureModuleException(_IncompleteKey, dict, "Incomplete", "binascii");
 }
Exemple #12
0
 public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict)
 {
     context.EnsureModuleException(_mmapErrorKey, PythonExceptions.OSError, dict, "error", "mmap");
 }
Exemple #13
0
 public static void PerformModuleReload(PythonContext /*!*/ context, PythonDictionary /*!*/ dict)
 {
     EnsureLocaleInitialized(context);
     context.EnsureModuleException("_localeerror", dict, "Error", "_locale");
 }
Exemple #14
0
 public static void PerformModuleReload(PythonContext context, PythonDictionary dict)
 {
     error = context.EnsureModuleException("zlib.error", PythonExceptions.Exception, dict, "error", "zlib");
 }