10000 bpo-19225: Add a table of warning names and missed exception names in… · xiaolanpython/cpython@e8c7631 · GitHub
[go: up one dir, main page]

Skip to content

Commit e8c7631

Browse files
cocoatomoserhiy-storchaka
authored andcommitted
bpo-19225: Add a table of warning names and missed exception names in C API doc (python#881)
Move the `.. index` directive to more appropriate place.
1 parent 351adda commit e8c7631

File tree

2 files changed

+150
-56
lines changed

2 files changed

+150
-56
lines changed

Doc/c-api/exceptions.rst

Lines changed: 149 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,61 @@ All standard Python exceptions are available as global variables whose names are
750750
:c:type:`PyObject\*`; they are all class objects. For completeness, here are all
751751
the variables:
752752
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+
753808
+-----------------------------------------+---------------------------------+----------+
754809
| C Name | Python Name | Notes |
755810
+=========================================+=================================+==========+
@@ -759,8 +814,6 @@ the variables:
759814
+-----------------------------------------+---------------------------------+----------+
760815
| :c:data:`PyExc_ArithmeticError` | :exc:`ArithmeticError` | \(1) |
761816
+-----------------------------------------+---------------------------------+----------+
762-
| :c:data:`PyExc_LookupError` | :exc:`LookupError` | \(1) |
763-
+-----------------------------------------+---------------------------------+----------+
764817
| :c:data:`PyExc_AssertionError` | :exc:`AssertionError` | |
765818
+-----------------------------------------+---------------------------------+----------+
766819
| :c:data:`PyExc_AttributeError` | :exc:`AttributeError` | |
@@ -769,27 +822,31 @@ the variables:
769822
+-----------------------------------------+---------------------------------+----------+
770823
| :c:data:`PyExc_BrokenPipeError` | :exc:`BrokenPipeError` | |
771824
+-----------------------------------------+---------------------------------+----------+
772-
| :c:data:`PyExc_ChildProcessError` | :exc:`ChildProcessError` | |
825+
| :c:data:`PyExc_BufferError` | :exc:`BufferError` | |
773826
+-----------------------------------------+---------------------------------+----------+
774-
| :c:data:`PyExc_ConnectionError` | :exc:`ConnectionError` | |
827+
| :c:data:`PyExc_ChildProcessError` | :exc:`ChildProcessError` | |
775828
+-----------------------------------------+---------------------------------+----------+
776829
| :c:data:`PyExc_ConnectionAbortedError` | :exc:`ConnectionAbortedError` | |
777830
+-----------------------------------------+---------------------------------+----------+
831+
| :c:data:`PyExc_ConnectionError` | :exc:`ConnectionError` | |
832+
+-----------------------------------------+---------------------------------+----------+
778833
| :c:data:`PyExc_ConnectionRefusedError` | :exc:`ConnectionRefusedError` | |
779834
+-----------------------------------------+---------------------------------+----------+
780835
| :c:data:`PyExc_ConnectionResetError` | :exc:`ConnectionResetError` | |
781836
+-----------------------------------------+---------------------------------+----------+
837+
| :c:data:`PyExc_EOFError` | :exc:`EOFError` | |
838+
+-----------------------------------------+---------------------------------+----------+
782839
| :c:data:`PyExc_FileExistsError` | :exc:`FileExistsError` | |
783840
+-----------------------------------------+---------------------------------+----------+
784841
| :c:data:`PyExc_FileNotFoundError` | :exc:`FileNotFoundError` | |
785842
+-----------------------------------------+---------------------------------+----------+
786-
| :c:data:`PyExc_EOFError` | :exc:`EOFError` | |
787-
+-----------------------------------------+---------------------------------+----------+
788843
| :c:data:`PyExc_FloatingPointError` | :exc:`FloatingPointError` | |
789844
+-----------------------------------------+---------------------------------+----------+
845+
| :c:data:`PyExc_GeneratorExit` | :exc:`GeneratorExit` | |
846+
+-----------------------------------------+---------------------------------+----------+
790847
| :c:data:`PyExc_ImportError` | :exc:`ImportError` | |
791848
+-----------------------------------------+---------------------------------+----------+
792-
| :c:data:`PyExc_ModuleNotFoundError` | :exc:`ModuleNotFoundError` | |
849+
| :c:data:`PyExc_IndentationError` | :exc:`IndentationError` | |
793850
+-----------------------------------------+---------------------------------+----------+
794851
| :c:data:`PyExc_IndexError` | :exc:`IndexError` | |
795852
+-----------------------------------------+---------------------------------+----------+
@@ -801,8 +858,12 @@ the variables:
801858
+-----------------------------------------+---------------------------------+----------+
802859
| :c:data:`PyExc_KeyboardInterrupt` | :exc:`KeyboardInterrupt` | |
803860
+-----------------------------------------+---------------------------------+----------+
861+
| :c:data:`PyExc_LookupError` | :exc:`LookupError` | \(1) |
862+
+-----------------------------------------+---------------------------------+----------+
804863
| :c:data:`PyExc_MemoryError` | :exc:`MemoryError` | |
805864
+-----------------------------------------+---------------------------------+----------+
865+
| :c:data:`PyExc_ModuleNotFoundError` | :exc:`ModuleNotFoundError` | |
866+
+-----------------------------------------+---------------------------------+----------+
806867
| :c:data:`PyExc_NameError` | :exc:`NameError` | |
807868
+-----------------------------------------+---------------------------------+----------+
808869
| :c:data:`PyExc_NotADirectoryError` | :exc:`NotADirectoryError` | |
@@ -823,16 +884,32 @@ the variables:
823884
+-----------------------------------------+---------------------------------+----------+
824885
| :c:data:`PyExc_RuntimeError` | :exc:`RuntimeError` | |
825886
+-----------------------------------------+---------------------------------+----------+
887+
| :c:data:`PyExc_StopAsyncIteration` | :exc:`StopAsyncIteration` | |
888+
+-----------------------------------------+---------------------------------+----------+
889+
| :c:data:`PyExc_StopIteration` | :exc:`StopIteration` | |
890+
+-----------------------------------------+---------------------------------+----------+
826891
| :c:data:`PyExc_SyntaxError` | :exc:`SyntaxError` | |
827892
+-----------------------------------------+---------------------------------+----------+
828893
| :c:data:`PyExc_SystemError` | :exc:`SystemError` | |
829894
+-----------------------------------------+---------------------------------+----------+
830-
| :c:data:`PyExc_TimeoutError` | :exc:`TimeoutError` | |
831-
+-----------------------------------------+---------------------------------+----------+
832895
| :c:data:`PyExc_SystemExit` | :exc:`SystemExit` | |
833896
+-----------------------------------------+---------------------------------+----------+
897+
| :c:data:`PyExc_TabError` | :exc:`TabError` | |
898+
+-----------------------------------------+---------------------------------+----------+
899+
| :c:data:`PyExc_TimeoutError` | :exc:`TimeoutError` | |
900+
+-----------------------------------------+---------------------------------+----------+
834901
| :c:data:`PyExc_TypeError` | :exc:`TypeError` | |
835902
+-----------------------------------------+---------------------------------+----------+
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+
+-----------------------------------------+---------------------------------+----------+
836913
| :c:data:`PyExc_ValueError` | :exc:`ValueError` | |
837914
+-----------------------------------------+---------------------------------+----------+
838915
| :c:data:`PyExc_ZeroDivisionError` | :exc:`ZeroDivisionError` | |
@@ -849,11 +926,18 @@ the variables:
849926
and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`.
850927
851928
.. versionadded:: 3.5
852-
:c:data:`PyExc_RecursionError`.
929+
:c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`.
853930
931+
.. versionadded:: 3.6
932+
:c:data:`PyExc_ModuleNotFoundError`.
854933
855934
These are compatibility aliases to :c:data:`PyExc_OSError`:
856935
936+
.. index::
937+
single: PyExc_EnvironmentError
938+
single: PyExc_IOError
939+
single: PyExc_WindowsError
940+
857941
+-------------------------------------+----------+
858942
| C Name | Notes |
859943
+=====================================+==========+
@@ -867,52 +951,6 @@ These are compatibility aliases to :c:data:`PyExc_OSError`:
867951
.. versionchanged:: 3.3
868952
These aliases used to be separate exception types.
869953
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-
916954
Notes:
917955
918956
(1)
@@ -924,3 +962,58 @@ Notes:
924962
(3)
925963
Only defined on Windows; protect code that uses this by testing that the
926964
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.

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,7 @@ Jason Killen
777777
Jan Kim
778778
Taek Joo Kim
779779
Sam Kimbrel
780+
Tomohiko Kinebuchi
780781
James King
781782
W. Trevor King
782783
Paul Kippes

0 commit comments

Comments
 (0)
0