PageRenderTime 79ms CodeModel.GetById 15ms app.highlight 57ms RepoModel.GetById 1ms app.codeStats 0ms

/IronPython_Main/Languages/IronPython/IronPython/Runtime/Exceptions/PythonExceptions.Generated.cs

#
C# | 1001 lines | 860 code | 120 blank | 21 comment | 151 complexity | 10c0ee6c760795b48bc27bf7ed98fdd5 MD5 | raw file
   1/* ****************************************************************************
   2 *
   3 * Copyright (c) Microsoft Corporation. 
   4 *
   5 * This source code is subject to terms and conditions of the Apache License, Version 2.0. A 
   6 * copy of the license can be found in the License.html file at the root of this distribution. If 
   7 * you cannot locate the  Apache License, Version 2.0, please send an email to 
   8 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
   9 * by the terms of the Apache License, Version 2.0.
  10 *
  11 * You must not remove this notice, or any other, from this software.
  12 *
  13 *
  14 * ***************************************************************************/
  15
  16using System;
  17using System.Collections.Generic;
  18using System.ComponentModel;
  19using System.IO;
  20using System.Runtime.InteropServices;
  21using System.Text;
  22
  23using Microsoft.Scripting;
  24using Microsoft.Scripting.Runtime;
  25
  26using IronPython.Runtime.Operations;
  27using IronPython.Runtime.Types;
  28using Microsoft.Scripting.Utils;
  29
  30// This generated code is updated by the generate_exceptions.py script.
  31namespace IronPython.Runtime.Exceptions {
  32    public static partial class PythonExceptions {
  33        private static object _pythonExceptionsLock = new object();
  34
  35        #region Generated Python New-Style Exceptions
  36
  37        // *** BEGIN GENERATED CODE ***
  38        // generated by function: newstyle_gen from: generate_exceptions.py
  39
  40        [MultiRuntimeAware]
  41        private static PythonType GeneratorExitStorage;
  42        public static PythonType GeneratorExit {
  43            get {
  44                if (GeneratorExitStorage == null) {
  45                    lock (_pythonExceptionsLock) {
  46                        GeneratorExitStorage = CreateSubType(DynamicHelpers.GetPythonTypeFromType(typeof(BaseException)), "GeneratorExit", msg => new GeneratorExitException(msg));
  47                    }
  48                }
  49                return GeneratorExitStorage;
  50            }
  51        }
  52
  53        [MultiRuntimeAware]
  54        private static PythonType SystemExitStorage;
  55        public static PythonType SystemExit {
  56            get {
  57                if (SystemExitStorage == null) {
  58                    lock (_pythonExceptionsLock) {
  59                        SystemExitStorage = CreateSubType(DynamicHelpers.GetPythonTypeFromType(typeof(BaseException)), typeof(_SystemExit), msg => new SystemExitException(msg));
  60                    }
  61                }
  62                return SystemExitStorage;
  63            }
  64        }
  65
  66        [PythonType("SystemExit"), PythonHidden, DynamicBaseTypeAttribute, Serializable]
  67        public partial class _SystemExit : BaseException {
  68            private object _code;
  69
  70            public _SystemExit() : base(SystemExit) { }
  71            public _SystemExit(PythonType type) : base(type) { }
  72
  73            public new static object __new__(PythonType cls, params object[] args) {
  74                return Activator.CreateInstance(cls.UnderlyingSystemType, cls);
  75            }
  76
  77            public object code {
  78                get { return _code; }
  79                set { _code = value; }
  80            }
  81
  82        }
  83
  84        [MultiRuntimeAware]
  85        private static PythonType KeyboardInterruptStorage;
  86        public static PythonType KeyboardInterrupt {
  87            get {
  88                if (KeyboardInterruptStorage == null) {
  89                    lock (_pythonExceptionsLock) {
  90                        KeyboardInterruptStorage = CreateSubType(DynamicHelpers.GetPythonTypeFromType(typeof(BaseException)), "KeyboardInterrupt", msg => new KeyboardInterruptException(msg));
  91                    }
  92                }
  93                return KeyboardInterruptStorage;
  94            }
  95        }
  96
  97        [MultiRuntimeAware]
  98        private static PythonType ExceptionStorage;
  99        public static PythonType Exception {
 100            get {
 101                if (ExceptionStorage == null) {
 102                    lock (_pythonExceptionsLock) {
 103                        ExceptionStorage = CreateSubType(DynamicHelpers.GetPythonTypeFromType(typeof(BaseException)), "Exception", msg => new PythonException(msg));
 104                    }
 105                }
 106                return ExceptionStorage;
 107            }
 108        }
 109
 110        [MultiRuntimeAware]
 111        private static PythonType StopIterationStorage;
 112        public static PythonType StopIteration {
 113            get {
 114                if (StopIterationStorage == null) {
 115                    lock (_pythonExceptionsLock) {
 116                        StopIterationStorage = CreateSubType(Exception, "StopIteration", msg => new StopIterationException(msg));
 117                    }
 118                }
 119                return StopIterationStorage;
 120            }
 121        }
 122
 123        [MultiRuntimeAware]
 124        private static PythonType StandardErrorStorage;
 125        public static PythonType StandardError {
 126            get {
 127                if (StandardErrorStorage == null) {
 128                    lock (_pythonExceptionsLock) {
 129                        StandardErrorStorage = CreateSubType(Exception, "StandardError", msg => new ApplicationException(msg));
 130                    }
 131                }
 132                return StandardErrorStorage;
 133            }
 134        }
 135
 136        [MultiRuntimeAware]
 137        private static PythonType BufferErrorStorage;
 138        public static PythonType BufferError {
 139            get {
 140                if (BufferErrorStorage == null) {
 141                    lock (_pythonExceptionsLock) {
 142                        BufferErrorStorage = CreateSubType(StandardError, "BufferError", msg => new BufferException(msg));
 143                    }
 144                }
 145                return BufferErrorStorage;
 146            }
 147        }
 148
 149        [MultiRuntimeAware]
 150        private static PythonType ArithmeticErrorStorage;
 151        public static PythonType ArithmeticError {
 152            get {
 153                if (ArithmeticErrorStorage == null) {
 154                    lock (_pythonExceptionsLock) {
 155                        ArithmeticErrorStorage = CreateSubType(StandardError, "ArithmeticError", msg => new ArithmeticException(msg));
 156                    }
 157                }
 158                return ArithmeticErrorStorage;
 159            }
 160        }
 161
 162        [MultiRuntimeAware]
 163        private static PythonType FloatingPointErrorStorage;
 164        public static PythonType FloatingPointError {
 165            get {
 166                if (FloatingPointErrorStorage == null) {
 167                    lock (_pythonExceptionsLock) {
 168                        FloatingPointErrorStorage = CreateSubType(ArithmeticError, "FloatingPointError", msg => new FloatingPointException(msg));
 169                    }
 170                }
 171                return FloatingPointErrorStorage;
 172            }
 173        }
 174
 175        [MultiRuntimeAware]
 176        private static PythonType OverflowErrorStorage;
 177        public static PythonType OverflowError {
 178            get {
 179                if (OverflowErrorStorage == null) {
 180                    lock (_pythonExceptionsLock) {
 181                        OverflowErrorStorage = CreateSubType(ArithmeticError, "OverflowError", msg => new OverflowException(msg));
 182                    }
 183                }
 184                return OverflowErrorStorage;
 185            }
 186        }
 187
 188        [MultiRuntimeAware]
 189        private static PythonType ZeroDivisionErrorStorage;
 190        public static PythonType ZeroDivisionError {
 191            get {
 192                if (ZeroDivisionErrorStorage == null) {
 193                    lock (_pythonExceptionsLock) {
 194                        ZeroDivisionErrorStorage = CreateSubType(ArithmeticError, "ZeroDivisionError", msg => new DivideByZeroException(msg));
 195                    }
 196                }
 197                return ZeroDivisionErrorStorage;
 198            }
 199        }
 200
 201        [MultiRuntimeAware]
 202        private static PythonType AssertionErrorStorage;
 203        public static PythonType AssertionError {
 204            get {
 205                if (AssertionErrorStorage == null) {
 206                    lock (_pythonExceptionsLock) {
 207                        AssertionErrorStorage = CreateSubType(StandardError, "AssertionError", msg => new AssertionException(msg));
 208                    }
 209                }
 210                return AssertionErrorStorage;
 211            }
 212        }
 213
 214        [MultiRuntimeAware]
 215        private static PythonType AttributeErrorStorage;
 216        public static PythonType AttributeError {
 217            get {
 218                if (AttributeErrorStorage == null) {
 219                    lock (_pythonExceptionsLock) {
 220                        AttributeErrorStorage = CreateSubType(StandardError, "AttributeError", msg => new AttributeErrorException(msg));
 221                    }
 222                }
 223                return AttributeErrorStorage;
 224            }
 225        }
 226
 227        [MultiRuntimeAware]
 228        private static PythonType EnvironmentErrorStorage;
 229        public static PythonType EnvironmentError {
 230            get {
 231                if (EnvironmentErrorStorage == null) {
 232                    lock (_pythonExceptionsLock) {
 233                        EnvironmentErrorStorage = CreateSubType(StandardError, typeof(_EnvironmentError), msg => new ExternalException(msg));
 234                    }
 235                }
 236                return EnvironmentErrorStorage;
 237            }
 238        }
 239
 240        [PythonType("EnvironmentError"), PythonHidden, DynamicBaseTypeAttribute, Serializable]
 241        public partial class _EnvironmentError : BaseException {
 242            private object _errno;
 243            private object _strerror;
 244            private object _filename;
 245
 246            public _EnvironmentError() : base(EnvironmentError) { }
 247            public _EnvironmentError(PythonType type) : base(type) { }
 248
 249            public new static object __new__(PythonType cls, params object[] args) {
 250                return Activator.CreateInstance(cls.UnderlyingSystemType, cls);
 251            }
 252
 253            public object errno {
 254                get { return _errno; }
 255                set { _errno = value; }
 256            }
 257
 258            public object strerror {
 259                get { return _strerror; }
 260                set { _strerror = value; }
 261            }
 262
 263            public object filename {
 264                get { return _filename; }
 265                set { _filename = value; }
 266            }
 267
 268        }
 269
 270        [MultiRuntimeAware]
 271        private static PythonType IOErrorStorage;
 272        public static PythonType IOError {
 273            get {
 274                if (IOErrorStorage == null) {
 275                    lock (_pythonExceptionsLock) {
 276                        IOErrorStorage = CreateSubType(EnvironmentError, "IOError", msg => new IOException(msg));
 277                    }
 278                }
 279                return IOErrorStorage;
 280            }
 281        }
 282
 283        [MultiRuntimeAware]
 284        private static PythonType OSErrorStorage;
 285        public static PythonType OSError {
 286            get {
 287                if (OSErrorStorage == null) {
 288                    lock (_pythonExceptionsLock) {
 289                        OSErrorStorage = CreateSubType(EnvironmentError, "OSError", msg => new OSException(msg));
 290                    }
 291                }
 292                return OSErrorStorage;
 293            }
 294        }
 295
 296        [MultiRuntimeAware]
 297        private static PythonType WindowsErrorStorage;
 298        public static PythonType WindowsError {
 299            get {
 300                if (WindowsErrorStorage == null) {
 301                    lock (_pythonExceptionsLock) {
 302                        WindowsErrorStorage = CreateSubType(OSError, typeof(_WindowsError), msg => new Win32Exception(msg));
 303                    }
 304                }
 305                return WindowsErrorStorage;
 306            }
 307        }
 308
 309        [PythonType("WindowsError"), PythonHidden, DynamicBaseTypeAttribute, Serializable]
 310        public partial class _WindowsError : _EnvironmentError {
 311            private object _winerror;
 312
 313            public _WindowsError() : base(WindowsError) { }
 314            public _WindowsError(PythonType type) : base(type) { }
 315
 316            public new static object __new__(PythonType cls, params object[] args) {
 317                return Activator.CreateInstance(cls.UnderlyingSystemType, cls);
 318            }
 319
 320            public object winerror {
 321                get { return _winerror; }
 322                set { _winerror = value; }
 323            }
 324
 325        }
 326
 327        [MultiRuntimeAware]
 328        private static PythonType EOFErrorStorage;
 329        public static PythonType EOFError {
 330            get {
 331                if (EOFErrorStorage == null) {
 332                    lock (_pythonExceptionsLock) {
 333                        EOFErrorStorage = CreateSubType(StandardError, "EOFError", msg => new EndOfStreamException(msg));
 334                    }
 335                }
 336                return EOFErrorStorage;
 337            }
 338        }
 339
 340        [MultiRuntimeAware]
 341        private static PythonType ImportErrorStorage;
 342        public static PythonType ImportError {
 343            get {
 344                if (ImportErrorStorage == null) {
 345                    lock (_pythonExceptionsLock) {
 346                        ImportErrorStorage = CreateSubType(StandardError, "ImportError", msg => new ImportException(msg));
 347                    }
 348                }
 349                return ImportErrorStorage;
 350            }
 351        }
 352
 353        [MultiRuntimeAware]
 354        private static PythonType LookupErrorStorage;
 355        public static PythonType LookupError {
 356            get {
 357                if (LookupErrorStorage == null) {
 358                    lock (_pythonExceptionsLock) {
 359                        LookupErrorStorage = CreateSubType(StandardError, "LookupError", msg => new LookupException(msg));
 360                    }
 361                }
 362                return LookupErrorStorage;
 363            }
 364        }
 365
 366        [MultiRuntimeAware]
 367        private static PythonType IndexErrorStorage;
 368        public static PythonType IndexError {
 369            get {
 370                if (IndexErrorStorage == null) {
 371                    lock (_pythonExceptionsLock) {
 372                        IndexErrorStorage = CreateSubType(LookupError, "IndexError", msg => new IndexOutOfRangeException(msg));
 373                    }
 374                }
 375                return IndexErrorStorage;
 376            }
 377        }
 378
 379        [MultiRuntimeAware]
 380        private static PythonType KeyErrorStorage;
 381        public static PythonType KeyError {
 382            get {
 383                if (KeyErrorStorage == null) {
 384                    lock (_pythonExceptionsLock) {
 385                        KeyErrorStorage = CreateSubType(LookupError, "KeyError", msg => new KeyNotFoundException(msg));
 386                    }
 387                }
 388                return KeyErrorStorage;
 389            }
 390        }
 391
 392        [MultiRuntimeAware]
 393        private static PythonType MemoryErrorStorage;
 394        public static PythonType MemoryError {
 395            get {
 396                if (MemoryErrorStorage == null) {
 397                    lock (_pythonExceptionsLock) {
 398                        MemoryErrorStorage = CreateSubType(StandardError, "MemoryError", msg => new OutOfMemoryException(msg));
 399                    }
 400                }
 401                return MemoryErrorStorage;
 402            }
 403        }
 404
 405        [MultiRuntimeAware]
 406        private static PythonType NameErrorStorage;
 407        public static PythonType NameError {
 408            get {
 409                if (NameErrorStorage == null) {
 410                    lock (_pythonExceptionsLock) {
 411                        NameErrorStorage = CreateSubType(StandardError, "NameError", msg => new UnboundNameException(msg));
 412                    }
 413                }
 414                return NameErrorStorage;
 415            }
 416        }
 417
 418        [MultiRuntimeAware]
 419        private static PythonType UnboundLocalErrorStorage;
 420        public static PythonType UnboundLocalError {
 421            get {
 422                if (UnboundLocalErrorStorage == null) {
 423                    lock (_pythonExceptionsLock) {
 424                        UnboundLocalErrorStorage = CreateSubType(NameError, "UnboundLocalError", msg => new UnboundLocalException(msg));
 425                    }
 426                }
 427                return UnboundLocalErrorStorage;
 428            }
 429        }
 430
 431        [MultiRuntimeAware]
 432        private static PythonType ReferenceErrorStorage;
 433        public static PythonType ReferenceError {
 434            get {
 435                if (ReferenceErrorStorage == null) {
 436                    lock (_pythonExceptionsLock) {
 437                        ReferenceErrorStorage = CreateSubType(StandardError, "ReferenceError", msg => new ReferenceException(msg));
 438                    }
 439                }
 440                return ReferenceErrorStorage;
 441            }
 442        }
 443
 444        [MultiRuntimeAware]
 445        private static PythonType RuntimeErrorStorage;
 446        public static PythonType RuntimeError {
 447            get {
 448                if (RuntimeErrorStorage == null) {
 449                    lock (_pythonExceptionsLock) {
 450                        RuntimeErrorStorage = CreateSubType(StandardError, "RuntimeError", msg => new RuntimeException(msg));
 451                    }
 452                }
 453                return RuntimeErrorStorage;
 454            }
 455        }
 456
 457        [MultiRuntimeAware]
 458        private static PythonType NotImplementedErrorStorage;
 459        public static PythonType NotImplementedError {
 460            get {
 461                if (NotImplementedErrorStorage == null) {
 462                    lock (_pythonExceptionsLock) {
 463                        NotImplementedErrorStorage = CreateSubType(RuntimeError, "NotImplementedError", msg => new NotImplementedException(msg));
 464                    }
 465                }
 466                return NotImplementedErrorStorage;
 467            }
 468        }
 469
 470        [MultiRuntimeAware]
 471        private static PythonType SyntaxErrorStorage;
 472        public static PythonType SyntaxError {
 473            get {
 474                if (SyntaxErrorStorage == null) {
 475                    lock (_pythonExceptionsLock) {
 476                        SyntaxErrorStorage = CreateSubType(StandardError, typeof(_SyntaxError), msg => new SyntaxErrorException(msg));
 477                    }
 478                }
 479                return SyntaxErrorStorage;
 480            }
 481        }
 482
 483        [PythonType("SyntaxError"), PythonHidden, DynamicBaseTypeAttribute, Serializable]
 484        public partial class _SyntaxError : BaseException {
 485            private object _text;
 486            private object _print_file_and_line;
 487            private object _filename;
 488            private object _lineno;
 489            private object _offset;
 490            private object _msg;
 491
 492            public _SyntaxError() : base(SyntaxError) { }
 493            public _SyntaxError(PythonType type) : base(type) { }
 494
 495            public new static object __new__(PythonType cls, params object[] args) {
 496                return Activator.CreateInstance(cls.UnderlyingSystemType, cls);
 497            }
 498
 499            public object text {
 500                get { return _text; }
 501                set { _text = value; }
 502            }
 503
 504            public object print_file_and_line {
 505                get { return _print_file_and_line; }
 506                set { _print_file_and_line = value; }
 507            }
 508
 509            public object filename {
 510                get { return _filename; }
 511                set { _filename = value; }
 512            }
 513
 514            public object lineno {
 515                get { return _lineno; }
 516                set { _lineno = value; }
 517            }
 518
 519            public object offset {
 520                get { return _offset; }
 521                set { _offset = value; }
 522            }
 523
 524            public object msg {
 525                get { return _msg; }
 526                set { _msg = value; }
 527            }
 528
 529        }
 530
 531        [MultiRuntimeAware]
 532        private static PythonType IndentationErrorStorage;
 533        public static PythonType IndentationError {
 534            get {
 535                if (IndentationErrorStorage == null) {
 536                    lock (_pythonExceptionsLock) {
 537                        IndentationErrorStorage = CreateSubType(SyntaxError, "IndentationError", msg => new IndentationException(msg));
 538                    }
 539                }
 540                return IndentationErrorStorage;
 541            }
 542        }
 543
 544        [MultiRuntimeAware]
 545        private static PythonType TabErrorStorage;
 546        public static PythonType TabError {
 547            get {
 548                if (TabErrorStorage == null) {
 549                    lock (_pythonExceptionsLock) {
 550                        TabErrorStorage = CreateSubType(IndentationError, "TabError", msg => new TabException(msg));
 551                    }
 552                }
 553                return TabErrorStorage;
 554            }
 555        }
 556
 557        [MultiRuntimeAware]
 558        private static PythonType SystemErrorStorage;
 559        public static PythonType SystemError {
 560            get {
 561                if (SystemErrorStorage == null) {
 562                    lock (_pythonExceptionsLock) {
 563                        SystemErrorStorage = CreateSubType(StandardError, "SystemError", msg => new SystemException(msg));
 564                    }
 565                }
 566                return SystemErrorStorage;
 567            }
 568        }
 569
 570        [MultiRuntimeAware]
 571        private static PythonType TypeErrorStorage;
 572        public static PythonType TypeError {
 573            get {
 574                if (TypeErrorStorage == null) {
 575                    lock (_pythonExceptionsLock) {
 576                        TypeErrorStorage = CreateSubType(StandardError, "TypeError", msg => new TypeErrorException(msg));
 577                    }
 578                }
 579                return TypeErrorStorage;
 580            }
 581        }
 582
 583        [MultiRuntimeAware]
 584        private static PythonType ValueErrorStorage;
 585        public static PythonType ValueError {
 586            get {
 587                if (ValueErrorStorage == null) {
 588                    lock (_pythonExceptionsLock) {
 589                        ValueErrorStorage = CreateSubType(StandardError, "ValueError", msg => new ValueErrorException(msg));
 590                    }
 591                }
 592                return ValueErrorStorage;
 593            }
 594        }
 595
 596        [MultiRuntimeAware]
 597        private static PythonType UnicodeErrorStorage;
 598        public static PythonType UnicodeError {
 599            get {
 600                if (UnicodeErrorStorage == null) {
 601                    lock (_pythonExceptionsLock) {
 602                        UnicodeErrorStorage = CreateSubType(ValueError, "UnicodeError", msg => new UnicodeException(msg));
 603                    }
 604                }
 605                return UnicodeErrorStorage;
 606            }
 607        }
 608
 609        [MultiRuntimeAware]
 610        private static PythonType UnicodeDecodeErrorStorage;
 611        public static PythonType UnicodeDecodeError {
 612            get {
 613                if (UnicodeDecodeErrorStorage == null) {
 614                    lock (_pythonExceptionsLock) {
 615                        UnicodeDecodeErrorStorage = CreateSubType(UnicodeError, typeof(_UnicodeDecodeError), msg => new DecoderFallbackException(msg));
 616                    }
 617                }
 618                return UnicodeDecodeErrorStorage;
 619            }
 620        }
 621
 622        [PythonType("UnicodeDecodeError"), PythonHidden, DynamicBaseTypeAttribute, Serializable]
 623        public partial class _UnicodeDecodeError : BaseException {
 624            private object _start;
 625            private object _reason;
 626            private object _object;
 627            private object _end;
 628            private object _encoding;
 629
 630            public _UnicodeDecodeError() : base(UnicodeDecodeError) { }
 631            public _UnicodeDecodeError(PythonType type) : base(type) { }
 632
 633            public new static object __new__(PythonType cls, params object[] args) {
 634                return Activator.CreateInstance(cls.UnderlyingSystemType, cls);
 635            }
 636
 637            public void __init__(object encoding, object @object, object start, object end, object reason) {
 638                _encoding = encoding;
 639                _object = @object;
 640                _start = start;
 641                _end = end;
 642                _reason = reason;
 643                args = PythonTuple.MakeTuple(encoding, @object, start, end, reason);
 644            }
 645
 646            public override void __init__(params object[] args) {
 647                if (args == null || args.Length != 5) {
 648                    throw PythonOps.TypeError("__init__ takes exactly 5 arguments ({0} given)", args.Length);
 649                }
 650                __init__(encoding, @object, start, end, reason);
 651            }
 652
 653            public object start {
 654                get { return _start; }
 655                set { _start = value; }
 656            }
 657
 658            public object reason {
 659                get { return _reason; }
 660                set { _reason = value; }
 661            }
 662
 663            public object @object {
 664                get { return _object; }
 665                set { _object = value; }
 666            }
 667
 668            public object end {
 669                get { return _end; }
 670                set { _end = value; }
 671            }
 672
 673            public object encoding {
 674                get { return _encoding; }
 675                set { _encoding = value; }
 676            }
 677
 678        }
 679
 680        [MultiRuntimeAware]
 681        private static PythonType UnicodeEncodeErrorStorage;
 682        public static PythonType UnicodeEncodeError {
 683            get {
 684                if (UnicodeEncodeErrorStorage == null) {
 685                    lock (_pythonExceptionsLock) {
 686                        UnicodeEncodeErrorStorage = CreateSubType(UnicodeError, typeof(_UnicodeEncodeError), msg => new EncoderFallbackException(msg));
 687                    }
 688                }
 689                return UnicodeEncodeErrorStorage;
 690            }
 691        }
 692
 693        [PythonType("UnicodeEncodeError"), PythonHidden, DynamicBaseTypeAttribute, Serializable]
 694        public partial class _UnicodeEncodeError : BaseException {
 695            private object _start;
 696            private object _reason;
 697            private object _object;
 698            private object _end;
 699            private object _encoding;
 700
 701            public _UnicodeEncodeError() : base(UnicodeEncodeError) { }
 702            public _UnicodeEncodeError(PythonType type) : base(type) { }
 703
 704            public new static object __new__(PythonType cls, params object[] args) {
 705                return Activator.CreateInstance(cls.UnderlyingSystemType, cls);
 706            }
 707
 708            public void __init__(object encoding, object @object, object start, object end, object reason) {
 709                _encoding = encoding;
 710                _object = @object;
 711                _start = start;
 712                _end = end;
 713                _reason = reason;
 714                args = PythonTuple.MakeTuple(encoding, @object, start, end, reason);
 715            }
 716
 717            public override void __init__(params object[] args) {
 718                if (args == null || args.Length != 5) {
 719                    throw PythonOps.TypeError("__init__ takes exactly 5 arguments ({0} given)", args.Length);
 720                }
 721                __init__(encoding, @object, start, end, reason);
 722            }
 723
 724            public object start {
 725                get { return _start; }
 726                set { _start = value; }
 727            }
 728
 729            public object reason {
 730                get { return _reason; }
 731                set { _reason = value; }
 732            }
 733
 734            public object @object {
 735                get { return _object; }
 736                set { _object = value; }
 737            }
 738
 739            public object end {
 740                get { return _end; }
 741                set { _end = value; }
 742            }
 743
 744            public object encoding {
 745                get { return _encoding; }
 746                set { _encoding = value; }
 747            }
 748
 749        }
 750
 751        [MultiRuntimeAware]
 752        private static PythonType UnicodeTranslateErrorStorage;
 753        public static PythonType UnicodeTranslateError {
 754            get {
 755                if (UnicodeTranslateErrorStorage == null) {
 756                    lock (_pythonExceptionsLock) {
 757                        UnicodeTranslateErrorStorage = CreateSubType(UnicodeError, typeof(_UnicodeTranslateError), msg => new UnicodeTranslateException(msg));
 758                    }
 759                }
 760                return UnicodeTranslateErrorStorage;
 761            }
 762        }
 763
 764        [PythonType("UnicodeTranslateError"), PythonHidden, DynamicBaseTypeAttribute, Serializable]
 765        public partial class _UnicodeTranslateError : BaseException {
 766            private object _start;
 767            private object _reason;
 768            private object _object;
 769            private object _end;
 770            private object _encoding;
 771
 772            public _UnicodeTranslateError() : base(UnicodeTranslateError) { }
 773            public _UnicodeTranslateError(PythonType type) : base(type) { }
 774
 775            public new static object __new__(PythonType cls, params object[] args) {
 776                return Activator.CreateInstance(cls.UnderlyingSystemType, cls);
 777            }
 778
 779            public object start {
 780                get { return _start; }
 781                set { _start = value; }
 782            }
 783
 784            public object reason {
 785                get { return _reason; }
 786                set { _reason = value; }
 787            }
 788
 789            public object @object {
 790                get { return _object; }
 791                set { _object = value; }
 792            }
 793
 794            public object end {
 795                get { return _end; }
 796                set { _end = value; }
 797            }
 798
 799            public object encoding {
 800                get { return _encoding; }
 801                set { _encoding = value; }
 802            }
 803
 804        }
 805
 806        [MultiRuntimeAware]
 807        private static PythonType WarningStorage;
 808        public static PythonType Warning {
 809            get {
 810                if (WarningStorage == null) {
 811                    lock (_pythonExceptionsLock) {
 812                        WarningStorage = CreateSubType(Exception, "Warning", msg => new WarningException(msg));
 813                    }
 814                }
 815                return WarningStorage;
 816            }
 817        }
 818
 819        [MultiRuntimeAware]
 820        private static PythonType DeprecationWarningStorage;
 821        public static PythonType DeprecationWarning {
 822            get {
 823                if (DeprecationWarningStorage == null) {
 824                    lock (_pythonExceptionsLock) {
 825                        DeprecationWarningStorage = CreateSubType(Warning, "DeprecationWarning", msg => new DeprecationWarningException(msg));
 826                    }
 827                }
 828                return DeprecationWarningStorage;
 829            }
 830        }
 831
 832        [MultiRuntimeAware]
 833        private static PythonType PendingDeprecationWarningStorage;
 834        public static PythonType PendingDeprecationWarning {
 835            get {
 836                if (PendingDeprecationWarningStorage == null) {
 837                    lock (_pythonExceptionsLock) {
 838                        PendingDeprecationWarningStorage = CreateSubType(Warning, "PendingDeprecationWarning", msg => new PendingDeprecationWarningException(msg));
 839                    }
 840                }
 841                return PendingDeprecationWarningStorage;
 842            }
 843        }
 844
 845        [MultiRuntimeAware]
 846        private static PythonType RuntimeWarningStorage;
 847        public static PythonType RuntimeWarning {
 848            get {
 849                if (RuntimeWarningStorage == null) {
 850                    lock (_pythonExceptionsLock) {
 851                        RuntimeWarningStorage = CreateSubType(Warning, "RuntimeWarning", msg => new RuntimeWarningException(msg));
 852                    }
 853                }
 854                return RuntimeWarningStorage;
 855            }
 856        }
 857
 858        [MultiRuntimeAware]
 859        private static PythonType SyntaxWarningStorage;
 860        public static PythonType SyntaxWarning {
 861            get {
 862                if (SyntaxWarningStorage == null) {
 863                    lock (_pythonExceptionsLock) {
 864                        SyntaxWarningStorage = CreateSubType(Warning, "SyntaxWarning", msg => new SyntaxWarningException(msg));
 865                    }
 866                }
 867                return SyntaxWarningStorage;
 868            }
 869        }
 870
 871        [MultiRuntimeAware]
 872        private static PythonType UserWarningStorage;
 873        public static PythonType UserWarning {
 874            get {
 875                if (UserWarningStorage == null) {
 876                    lock (_pythonExceptionsLock) {
 877                        UserWarningStorage = CreateSubType(Warning, "UserWarning", msg => new UserWarningException(msg));
 878                    }
 879                }
 880                return UserWarningStorage;
 881            }
 882        }
 883
 884        [MultiRuntimeAware]
 885        private static PythonType FutureWarningStorage;
 886        public static PythonType FutureWarning {
 887            get {
 888                if (FutureWarningStorage == null) {
 889                    lock (_pythonExceptionsLock) {
 890                        FutureWarningStorage = CreateSubType(Warning, "FutureWarning", msg => new FutureWarningException(msg));
 891                    }
 892                }
 893                return FutureWarningStorage;
 894            }
 895        }
 896
 897        [MultiRuntimeAware]
 898        private static PythonType ImportWarningStorage;
 899        public static PythonType ImportWarning {
 900            get {
 901                if (ImportWarningStorage == null) {
 902                    lock (_pythonExceptionsLock) {
 903                        ImportWarningStorage = CreateSubType(Warning, "ImportWarning", msg => new ImportWarningException(msg));
 904                    }
 905                }
 906                return ImportWarningStorage;
 907            }
 908        }
 909
 910        [MultiRuntimeAware]
 911        private static PythonType UnicodeWarningStorage;
 912        public static PythonType UnicodeWarning {
 913            get {
 914                if (UnicodeWarningStorage == null) {
 915                    lock (_pythonExceptionsLock) {
 916                        UnicodeWarningStorage = CreateSubType(Warning, "UnicodeWarning", msg => new UnicodeWarningException(msg));
 917                    }
 918                }
 919                return UnicodeWarningStorage;
 920            }
 921        }
 922
 923        [MultiRuntimeAware]
 924        private static PythonType BytesWarningStorage;
 925        public static PythonType BytesWarning {
 926            get {
 927                if (BytesWarningStorage == null) {
 928                    lock (_pythonExceptionsLock) {
 929                        BytesWarningStorage = CreateSubType(Warning, "BytesWarning", msg => new BytesWarningException(msg));
 930                    }
 931                }
 932                return BytesWarningStorage;
 933            }
 934        }
 935
 936
 937        // *** END GENERATED CODE ***
 938
 939        #endregion
 940
 941        #region Generated ToPython Exception Helper
 942
 943        // *** BEGIN GENERATED CODE ***
 944        // generated by function: gen_topython_helper from: generate_exceptions.py
 945
 946        private static BaseException/*!*/ ToPythonHelper(System.Exception clrException) {
 947            if (clrException is BytesWarningException) return new PythonExceptions.BaseException(PythonExceptions.BytesWarning);
 948            if (clrException is DecoderFallbackException) return new PythonExceptions._UnicodeDecodeError();
 949            if (clrException is DeprecationWarningException) return new PythonExceptions.BaseException(PythonExceptions.DeprecationWarning);
 950            if (clrException is DivideByZeroException) return new PythonExceptions.BaseException(PythonExceptions.ZeroDivisionError);
 951            if (clrException is EncoderFallbackException) return new PythonExceptions._UnicodeEncodeError();
 952            if (clrException is EndOfStreamException) return new PythonExceptions.BaseException(PythonExceptions.EOFError);
 953            if (clrException is FutureWarningException) return new PythonExceptions.BaseException(PythonExceptions.FutureWarning);
 954            if (clrException is ImportWarningException) return new PythonExceptions.BaseException(PythonExceptions.ImportWarning);
 955            if (clrException is MissingMemberException) return new PythonExceptions.BaseException(PythonExceptions.AttributeError);
 956            if (clrException is OverflowException) return new PythonExceptions.BaseException(PythonExceptions.OverflowError);
 957            if (clrException is PendingDeprecationWarningException) return new PythonExceptions.BaseException(PythonExceptions.PendingDeprecationWarning);
 958            if (clrException is RuntimeWarningException) return new PythonExceptions.BaseException(PythonExceptions.RuntimeWarning);
 959            if (clrException is SyntaxWarningException) return new PythonExceptions.BaseException(PythonExceptions.SyntaxWarning);
 960            if (clrException is TabException) return new PythonExceptions._SyntaxError(PythonExceptions.TabError);
 961            if (clrException is UnicodeWarningException) return new PythonExceptions.BaseException(PythonExceptions.UnicodeWarning);
 962            if (clrException is UserWarningException) return new PythonExceptions.BaseException(PythonExceptions.UserWarning);
 963            if (clrException is Win32Exception) return new PythonExceptions._WindowsError();
 964            if (clrException is ArgumentException) return new PythonExceptions.BaseException(PythonExceptions.ValueError);
 965            if (clrException is ArithmeticException) return new PythonExceptions.BaseException(PythonExceptions.ArithmeticError);
 966            if (clrException is ExternalException) return new PythonExceptions._EnvironmentError();
 967            if (clrException is IOException) return new PythonExceptions._EnvironmentError(PythonExceptions.IOError);
 968            if (clrException is IndentationException) return new PythonExceptions._SyntaxError(PythonExceptions.IndentationError);
 969            if (clrException is IndexOutOfRangeException) return new PythonExceptions.BaseException(PythonExceptions.IndexError);
 970            if (clrException is KeyNotFoundException) return new PythonExceptions.BaseException(PythonExceptions.KeyError);
 971            if (clrException is NotImplementedException) return new PythonExceptions.BaseException(PythonExceptions.NotImplementedError);
 972            if (clrException is OSException) return new PythonExceptions._EnvironmentError(PythonExceptions.OSError);
 973            if (clrException is OutOfMemoryException) return new PythonExceptions.BaseException(PythonExceptions.MemoryError);
 974            if (clrException is UnboundLocalException) return new PythonExceptions.BaseException(PythonExceptions.UnboundLocalError);
 975            if (clrException is UnicodeTranslateException) return new PythonExceptions._UnicodeTranslateError();
 976            if (clrException is WarningException) return new PythonExceptions.BaseException(PythonExceptions.Warning);
 977            if (clrException is ApplicationException) return new PythonExceptions.BaseException(PythonExceptions.StandardError);
 978            if (clrException is ArgumentTypeException) return new PythonExceptions.BaseException(PythonExceptions.TypeError);
 979            if (clrException is AssertionException) return new PythonExceptions.BaseException(PythonExceptions.AssertionError);
 980            if (clrException is BufferException) return new PythonExceptions.BaseException(PythonExceptions.BufferError);
 981            if (clrException is FloatingPointException) return new PythonExceptions.BaseException(PythonExceptions.FloatingPointError);
 982            if (clrException is GeneratorExitException) return new PythonExceptions.BaseException(PythonExceptions.GeneratorExit);
 983            if (clrException is ImportException) return new PythonExceptions.BaseException(PythonExceptions.ImportError);
 984            if (clrException is KeyboardInterruptException) return new PythonExceptions.BaseException(PythonExceptions.KeyboardInterrupt);
 985            if (clrException is LookupException) return new PythonExceptions.BaseException(PythonExceptions.LookupError);
 986            if (clrException is PythonException) return new PythonExceptions.BaseException(PythonExceptions.Exception);
 987            if (clrException is ReferenceException) return new PythonExceptions.BaseException(PythonExceptions.ReferenceError);
 988            if (clrException is RuntimeException) return new PythonExceptions.BaseException(PythonExceptions.RuntimeError);
 989            if (clrException is StopIterationException) return new PythonExceptions.BaseException(PythonExceptions.StopIteration);
 990            if (clrException is SyntaxErrorException) return new PythonExceptions._SyntaxError();
 991            if (clrException is SystemException) return new PythonExceptions.BaseException(PythonExceptions.SystemError);
 992            if (clrException is SystemExitException) return new PythonExceptions._SystemExit();
 993            if (clrException is UnboundNameException) return new PythonExceptions.BaseException(PythonExceptions.NameError);
 994            return new BaseException(Exception);
 995        }
 996
 997        // *** END GENERATED CODE ***
 998
 999        #endregion
1000    }
1001}