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