@@ -735,6 +735,60 @@ All standard Python exceptions are available as global variables whose names are
735
735
:c:type: `PyObject\* `; they are all class objects. For completeness, here are all
736
736
the variables:
737
737
738
+ .. index ::
739
+ single: PyExc_BaseException
740
+ single: PyExc_Exception
741
+ single: PyExc_ArithmeticError
742
+ single: PyExc_AssertionError
743
+ single: PyExc_AttributeError
744
+ single: PyExc_BlockingIOError
745
+ single: PyExc_BrokenPipeError
746
+ single: PyExc_BufferError
747
+ single: PyExc_ChildProcessError
748
+ single: PyExc_ConnectionAbortedError
749
+ single: PyExc_ConnectionError
750
+ single: PyExc_ConnectionRefusedError
751
+ single: PyExc_ConnectionResetError
752
+ single: PyExc_EOFError
753
+ single: PyExc_FileExistsError
754
+ single: PyExc_FileNotFoundError
755
+ single: PyExc_FloatingPointError
756
+ single: PyExc_GeneratorExit
757
+ single: PyExc_ImportError
758
+ single: PyExc_IndentationError
759
+ single: PyExc_IndexError
760
+ single: PyExc_InterruptedError
761
+ single: PyExc_IsADirectoryError
762
+ single: PyExc_KeyError
763
+ single: PyExc_KeyboardInterrupt
764
+ single: PyExc_LookupError
765
+ single: PyExc_MemoryError
766
+ single: PyExc_NameError
767
+ single: PyExc_NotADirectoryError
768
+ single: PyExc_NotImplementedError
769
+ single: PyExc_OSError
770
+ single: PyExc_OverflowError
771
+ single: PyExc_PermissionError
772
+ single: PyExc_ProcessLookupError
773
+ single: PyExc_RecursionError
774
+ single: PyExc_ReferenceError
775
+ single: PyExc_RuntimeError
776
+ single: PyExc_StopAsyncIteration
777
+ single: PyExc_StopIteration
778
+ single: PyExc_SyntaxError
779
+ single: PyExc_SystemError
780
+ single: PyExc_SystemExit
781
+ single: PyExc_TabError
782
+ single: PyExc_TimeoutError
783
+ single: PyExc_TypeError
784
+ single: PyExc_UnboundLocalError
785
+ single: PyExc_UnicodeDecodeError
786
+ single: PyExc_UnicodeEncodeError
787
+ single: PyExc_UnicodeError
788
+ single: PyExc_UnicodeTranslateError
789
+ single: PyExc_ValueError
790
+ single: PyExc_ZeroDivisionError
791
+
738
792
+-----------------------------------------+---------------------------------+----------+
739
793
| C Name | Python Name | Notes |
740
794
+=========================================+=================================+==========+
@@ -744,8 +798,6 @@ the variables:
744
798
+-----------------------------------------+---------------------------------+----------+
745
799
| :c:data: `PyExc_ArithmeticError ` | :exc: `ArithmeticError ` | \( 1) |
746
800
+-----------------------------------------+---------------------------------+----------+
747
- | :c:data: `PyExc_LookupError ` | :exc: `LookupError ` | \( 1) |
748
- +-----------------------------------------+---------------------------------+----------+
749
801
| :c:data: `PyExc_AssertionError ` | :exc: `AssertionError ` | |
750
802
+-----------------------------------------+---------------------------------+----------+
751
803
| :c:data: `PyExc_AttributeError ` | :exc: `AttributeError ` | |
@@ -754,26 +806,32 @@ the variables:
754
806
+-----------------------------------------+---------------------------------+----------+
755
807
| :c:data: `PyExc_BrokenPipeError ` | :exc: `BrokenPipeError ` | |
756
808
+-----------------------------------------+---------------------------------+----------+
757
- | :c:data: `PyExc_ChildProcessError ` | :exc: `ChildProcessError ` | |
809
+ | :c:data: `PyExc_BufferError ` | :exc: `BufferError ` | |
758
810
+-----------------------------------------+---------------------------------+----------+
759
- | :c:data: `PyExc_ConnectionError ` | :exc: `ConnectionError ` | |
811
+ | :c:data: `PyExc_ChildProcessError ` | :exc: `ChildProcessError ` | |
760
812
+-----------------------------------------+---------------------------------+----------+
761
813
| :c:data: `PyExc_ConnectionAbortedError ` | :exc: `ConnectionAbortedError ` | |
762
814
+-----------------------------------------+---------------------------------+----------+
815
+ | :c:data: `PyExc_ConnectionError ` | :exc: `ConnectionError ` | |
816
+ +-----------------------------------------+---------------------------------+----------+
763
817
| :c:data: `PyExc_ConnectionRefusedError ` | :exc: `ConnectionRefusedError ` | |
764
818
+-----------------------------------------+---------------------------------+----------+
765
819
| :c:data: `PyExc_ConnectionResetError ` | :exc: `ConnectionResetError ` | |
766
820
+-----------------------------------------+---------------------------------+----------+
821
+ | :c:data: `PyExc_EOFError ` | :exc: `EOFError ` | |
822
+ +-----------------------------------------+---------------------------------+----------+
767
823
| :c:data: `PyExc_FileExistsError ` | :exc: `FileExistsError ` | |
768
824
+-----------------------------------------+---------------------------------+----------+
769
825
| :c:data: `PyExc_FileNotFoundError ` | :exc: `FileNotFoundError ` | |
770
826
+-----------------------------------------+---------------------------------+----------+
771
- | :c:data: `PyExc_EOFError ` | :exc: `EOFError ` | |
772
- +-----------------------------------------+---------------------------------+----------+
773
827
| :c:data: `PyExc_FloatingPointError ` | :exc: `FloatingPointError ` | |
774
828
+-----------------------------------------+---------------------------------+----------+
829
+ | :c:data: `PyExc_GeneratorExit ` | :exc: `GeneratorExit ` | |
830
+ +-----------------------------------------+---------------------------------+----------+
775
831
| :c:data: `PyExc_ImportError ` | :exc: `ImportError ` | |
776
832
+-----------------------------------------+---------------------------------+----------+
833
+ | :c:data: `PyExc_IndentationError ` | :exc: `IndentationError ` | |
834
+ +-----------------------------------------+---------------------------------+----------+
777
835
| :c:data: `PyExc_IndexError ` | :exc: `IndexError ` | |
778
836
+-----------------------------------------+---------------------------------+----------+
779
837
| :c:data: `PyExc_InterruptedError ` | :exc: `InterruptedError ` | |
@@ -784,6 +842,8 @@ the variables:
784
842
+-----------------------------------------+---------------------------------+----------+
785
843
| :c:data: `PyExc_KeyboardInterrupt ` | :exc: `KeyboardInterrupt ` | |
786
844
+-----------------------------------------+---------------------------------+----------+
845
+ | :c:data: `PyExc_LookupError ` | :exc: `LookupError ` | \( 1) |
846
+ +-----------------------------------------+---------------------------------+----------+
787
847
| :c:data: `PyExc_MemoryError ` | :exc: `MemoryError ` | |
788
848
+-----------------------------------------+---------------------------------+----------+
789
849
| :c:data: `PyExc_NameError ` | :exc: `NameError ` | |
@@ -806,16 +866,32 @@ the variables:
806
866
+-----------------------------------------+---------------------------------+----------+
807
867
| :c:data: `PyExc_RuntimeError ` | :exc: `RuntimeError ` | |
808
868
+-----------------------------------------+---------------------------------+----------+
869
+ | :c:data: `PyExc_StopAsyncIteration ` | :exc: `StopAsyncIteration ` | |
870
+ +-----------------------------------------+---------------------------------+----------+
871
+ | :c:data: `PyExc_StopIteration ` | :exc: `StopIteration ` | |
872
+ +-----------------------------------------+---------------------------------+----------+
809
873
| :c:data: `PyExc_SyntaxError ` | :exc: `SyntaxError ` | |
810
874
+-----------------------------------------+---------------------------------+----------+
811
875
| :c:data: `PyExc_SystemError ` | :exc: `SystemError ` | |
812
876
+-----------------------------------------+---------------------------------+----------+
813
- | :c:data: `PyExc_TimeoutError ` | :exc: `TimeoutError ` | |
814
- +-----------------------------------------+---------------------------------+----------+
815
877
| :c:data: `PyExc_SystemExit ` | :exc: `SystemExit ` | |
816
878
+-----------------------------------------+---------------------------------+----------+
879
+ | :c:data: `PyExc_TabError ` | :exc: `TabError ` | |
880
+ +-----------------------------------------+---------------------------------+----------+
881
+ | :c:data: `PyExc_TimeoutError ` | :exc: `TimeoutError ` | |
882
+ +-----------------------------------------+---------------------------------+----------+
817
883
| :c:data: `PyExc_TypeError ` | :exc: `TypeError ` | |
818
884
+-----------------------------------------+---------------------------------+----------+
885
+ | :c:data: `PyExc_UnboundLocalError ` | :exc: `UnboundLocalError ` | |
886
+ +-----------------------------------------+---------------------------------+----------+
887
+ | :c:data: `PyExc_UnicodeDecodeError ` | :exc: `UnicodeDecodeError ` | |
888
+ +-----------------------------------------+---------------------------------+----------+
889
+ | :c:data: `PyExc_UnicodeEncodeError ` | :exc: `UnicodeEncodeError ` | |
890
+ +-----------------------------------------+---------------------------------+----------+
891
+ | :c:data: `PyExc_UnicodeError ` | :exc: `UnicodeError ` | |
892
+ +-----------------------------------------+---------------------------------+----------+
893
+ | :c:data: `PyExc_UnicodeTranslateError ` | :exc: `UnicodeTranslateError ` | |
894
+ +-----------------------------------------+---------------------------------+----------+
819
895
| :c:data: `PyExc_ValueError ` | :exc: `ValueError ` | |
820
896
+-----------------------------------------+---------------------------------+----------+
821
897
| :c:data: `PyExc_ZeroDivisionError ` | :exc: `ZeroDivisionError ` | |
@@ -832,11 +908,15 @@ the variables:
832
908
and :c:data: `PyExc_TimeoutError ` were introduced following :pep: `3151 `.
833
909
834
910
.. versionadded :: 3.5
835
- :c:data: `PyExc_RecursionError `.
836
-
911
+ :c:data: `PyExc_StopAsyncIteration ` and :c:data: `PyExc_RecursionError `.
837
912
838
913
These are compatibility aliases to :c:data: `PyExc_OSError `:
839
914
915
+ .. index ::
916
+ single: PyExc_EnvironmentError
917
+ single: PyExc_IOError
918
+ single: PyExc_WindowsError
919
+
840
920
+-------------------------------------+----------+
841
921
| C Name | Notes |
842
922
+=====================================+==========+
@@ -850,52 +930,6 @@ These are compatibility aliases to :c:data:`PyExc_OSError`:
850
930
.. versionchanged :: 3.3
851
931
These aliases used to be separate exception types.
852
932
853
-
854
- .. index ::
855
- single: PyExc_BaseException
856
- single: PyExc_Exception
857
- single: PyExc_ArithmeticError
858
- single: PyExc_LookupError
859
- single: PyExc_AssertionError
860
- single: PyExc_AttributeError
861
- single: PyExc_BlockingIOError
862
- single: PyExc_BrokenPipeError
863
- single: PyExc_ConnectionError
864
- single: PyExc_ConnectionAbortedError
865
- single: PyExc_ConnectionRefusedError
866
- single: PyExc_ConnectionResetError
867
- single: PyExc_EOFError
868
- single: PyExc_FileExistsError
869
- single: PyExc_FileNotFoundError
870
- single: PyExc_FloatingPointError
871
- single: PyExc_ImportError
872
- single: PyExc_IndexError
873
- single: PyExc_InterruptedError
874
- single: PyExc_IsADirectoryError
875
- single: PyExc_KeyError
876
- single: PyExc_KeyboardInterrupt
877
- single: PyExc_MemoryError
878
- single: PyExc_NameError
879
- single: PyExc_NotADirectoryError
880
- single: PyExc_NotImplementedError
881
- single: PyExc_OSError
882
- single: PyExc_OverflowError
883
- single: PyExc_PermissionError
884
- single: PyExc_ProcessLookupError
885
- single: PyExc_RecursionError
886
- single: PyExc_ReferenceError
887
- single: PyExc_RuntimeError
888
- single: PyExc_SyntaxError
889
- single: PyExc_SystemError
890
- single: PyExc_SystemExit
891
- single: PyExc_TimeoutError
892
- single: PyExc_TypeError
893
- single: PyExc_ValueError
894
- single: PyExc_ZeroDivisionError
895
- single: PyExc_EnvironmentError
896
- single: PyExc_IOError
897
- single: PyExc_WindowsError
898
-
899
933
Notes:
900
934
901
935
(1)
@@ -907,3 +941,58 @@ Notes:
907
941
(3)
908
942
Only defined on Windows; protect code that uses this by testing that the
909
943
preprocessor macro ``MS_WINDOWS `` is defined.
944
+
945
+ Standard Warnings
946
+ =================
947
+
948
+ All standard Python warning categories are available as global variables whose
949
+ names are ``PyExc_ `` followed by the Python exception name. These have the type
950
+ :c:type: `PyObject\* `; they are all class objects. For completeness, here are all
951
+ the variables:
952
+
953
+ .. index ::
954
+ single: PyExc_Warning
955
+ single: PyExc_BytesWarning
956
+ single: PyExc_DepricationWarning
957
+ single: PyExc_FutureWarning
958
+ single: PyExc_ImportWarning
959
+ single: PyExc_PendingDeprecationWarning
960
+ single: PyExc_ResourceWarning
961
+ single: PyExc_RuntimeWarning
962
+ single: PyExc_SyntaxWarning
963
+ single: PyExc_UnicodeWarning
964
+ single: PyExc_UserWarning
965
+
966
+ +------------------------------------------+---------------------------------+----------+
967
+ | C Name | Python Name | Notes |
968
+ +==========================================+=================================+==========+
969
+ | :c:data: `PyExc_Warning ` | :exc: `Warning ` | \( 1) |
970
+ +------------------------------------------+---------------------------------+----------+
971
+ | :c:data: `PyExc_BytesWarning ` | :exc: `BytesWarning ` | |
972
+ +------------------------------------------+---------------------------------+----------+
973
+ | :c:data: `PyExc_DeprecationWarning ` | :exc: `DeprecationWarning ` | |
974
+ +------------------------------------------+---------------------------------+----------+
975
+ | :c:data: `PyExc_FutureWarning ` | :exc: `FutureWarning ` | |
976
+ +------------------------------------------+---------------------------------+----------+
977
+ | :c:data: `PyExc_ImportWarning ` | :exc: `ImportWarning ` | |
978
+ +------------------------------------------+---------------------------------+----------+
979
+ | :c:data: `PyExc_PendingDepricationWarning`| :exc:`PendingDeprecationWarning`| |
980
+ +------------------------------------------+---------------------------------+----------+
981
+ | :c:data: `PyExc_ResourceWarning ` | :exc: `ResourceWarning ` | |
982
+ +------------------------------------------+---------------------------------+----------+
983
+ | :c:data: `PyExc_RuntimeWarning ` | :exc: `RuntimeWarning ` | |
984
+ +------------------------------------------+---------------------------------+----------+
985
+ | :c:data: `PyExc_SyntaxWarning ` | :exc: `SyntaxWarning ` | |
986
+ +------------------------------------------+---------------------------------+----------+
987
+ | :c:data: `PyExc_UnicodeWarning ` | :exc: `UnicodeWarning ` | |
988
+ +------------------------------------------+---------------------------------+----------+
989
+ | :c:data: `PyExc_UserWarning ` | :exc: `UserWarning ` | |
990
+ +------------------------------------------+---------------------------------+----------+
991
+
992
+ .. versionadded :: 3.2
993
+ :c:data: `PyExc_ResourceWarning `.
994
+
995
+ Notes:
996
+
997
+ (1)
998
+ This is a base class for other standard warning categories.
0 commit comments