From 34ffd60deac0499e5a5a8799d5f57a518007f014 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 2 Jul 2025 16:00:27 +0200 Subject: [PATCH 01/10] Add `.. c:var::` declarations for C exception types --- Doc/c-api/exceptions.rst | 457 ++++++++++++++++++++------------------- Doc/conf.py | 69 ------ 2 files changed, 232 insertions(+), 294 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index a750cda3e2d474..02919c8bc0d2c4 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -990,176 +990,180 @@ All standard Python exceptions are available as global variables whose names are :c:expr:`PyObject*`; they are all class objects. For completeness, here are all the variables: -.. index:: - single: PyExc_BaseException (C var) - single: PyExc_BaseExceptionGroup (C var) - single: PyExc_Exception (C var) - single: PyExc_ArithmeticError (C var) - single: PyExc_AssertionError (C var) - single: PyExc_AttributeError (C var) - single: PyExc_BlockingIOError (C var) - single: PyExc_BrokenPipeError (C var) - single: PyExc_BufferError (C var) - single: PyExc_ChildProcessError (C var) - single: PyExc_ConnectionAbortedError (C var) - single: PyExc_ConnectionError (C var) - single: PyExc_ConnectionRefusedError (C var) - single: PyExc_ConnectionResetError (C var) - single: PyExc_EOFError (C var) - single: PyExc_FileExistsError (C var) - single: PyExc_FileNotFoundError (C var) - single: PyExc_FloatingPointError (C var) - single: PyExc_GeneratorExit (C var) - single: PyExc_ImportError (C var) - single: PyExc_IndentationError (C var) - single: PyExc_IndexError (C var) - single: PyExc_InterruptedError (C var) - single: PyExc_IsADirectoryError (C var) - single: PyExc_KeyError (C var) - single: PyExc_KeyboardInterrupt (C var) - single: PyExc_LookupError (C var) - single: PyExc_MemoryError (C var) - single: PyExc_ModuleNotFoundError (C var) - single: PyExc_NameError (C var) - single: PyExc_NotADirectoryError (C var) - single: PyExc_NotImplementedError (C var) - single: PyExc_OSError (C var) - single: PyExc_OverflowError (C var) - single: PyExc_PermissionError (C var) - single: PyExc_ProcessLookupError (C var) - single: PyExc_PythonFinalizationError (C var) - single: PyExc_RecursionError (C var) - single: PyExc_ReferenceError (C var) - single: PyExc_RuntimeError (C var) - single: PyExc_StopAsyncIteration (C var) - single: PyExc_StopIteration (C var) - single: PyExc_SyntaxError (C var) - single: PyExc_SystemError (C var) - single: PyExc_SystemExit (C var) - single: PyExc_TabError (C var) - single: PyExc_TimeoutError (C var) - single: PyExc_TypeError (C var) - single: PyExc_UnboundLocalError (C var) - single: PyExc_UnicodeDecodeError (C var) - single: PyExc_UnicodeEncodeError (C var) - single: PyExc_UnicodeError (C var) - single: PyExc_UnicodeTranslateError (C var) - single: PyExc_ValueError (C var) - single: PyExc_ZeroDivisionError (C var) - -+-----------------------------------------+---------------------------------+----------+ -| C Name | Python Name | Notes | -+=========================================+=================================+==========+ -| :c:data:`PyExc_BaseException` | :exc:`BaseException` | [1]_ | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_BaseExceptionGroup` | :exc:`BaseExceptionGroup` | [1]_ | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_Exception` | :exc:`Exception` | [1]_ | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ArithmeticError` | :exc:`ArithmeticError` | [1]_ | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_AssertionError` | :exc:`AssertionError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_AttributeError` | :exc:`AttributeError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_BlockingIOError` | :exc:`BlockingIOError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_BrokenPipeError` | :exc:`BrokenPipeError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_BufferError` | :exc:`BufferError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ChildProcessError` | :exc:`ChildProcessError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ConnectionAbortedError` | :exc:`ConnectionAbortedError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ConnectionError` | :exc:`ConnectionError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ConnectionRefusedError` | :exc:`ConnectionRefusedError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ConnectionResetError` | :exc:`ConnectionResetError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_EOFError` | :exc:`EOFError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_FileExistsError` | :exc:`FileExistsError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_FileNotFoundError` | :exc:`FileNotFoundError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_FloatingPointError` | :exc:`FloatingPointError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_GeneratorExit` | :exc:`GeneratorExit` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ImportError` | :exc:`ImportError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_IndentationError` | :exc:`IndentationError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_IndexError` | :exc:`IndexError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_InterruptedError` | :exc:`InterruptedError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_IsADirectoryError` | :exc:`IsADirectoryError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_KeyError` | :exc:`KeyError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_KeyboardInterrupt` | :exc:`KeyboardInterrupt` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_LookupError` | :exc:`LookupError` | [1]_ | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_MemoryError` | :exc:`MemoryError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ModuleNotFoundError` | :exc:`ModuleNotFoundError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_NameError` | :exc:`NameError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_NotADirectoryError` | :exc:`NotADirectoryError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_NotImplementedError` | :exc:`NotImplementedError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_OSError` | :exc:`OSError` | [1]_ | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_OverflowError` | :exc:`OverflowError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_PermissionError` | :exc:`PermissionError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ProcessLookupError` | :exc:`ProcessLookupError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_PythonFinalizationError` | :exc:`PythonFinalizationError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_RecursionError` | :exc:`RecursionError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ReferenceError` | :exc:`ReferenceError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_RuntimeError` | :exc:`RuntimeError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_StopAsyncIteration` | :exc:`StopAsyncIteration` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_StopIteration` | :exc:`StopIteration` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_SyntaxError` | :exc:`SyntaxError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_SystemError` | :exc:`SystemError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_SystemExit` | :exc:`SystemExit` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_TabError` | :exc:`TabError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_TimeoutError` | :exc:`TimeoutError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_TypeError` | :exc:`TypeError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_UnboundLocalError` | :exc:`UnboundLocalError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_UnicodeDecodeError` | :exc:`UnicodeDecodeError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_UnicodeEncodeError` | :exc:`UnicodeEncodeError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_UnicodeError` | :exc:`UnicodeError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_UnicodeTranslateError` | :exc:`UnicodeTranslateError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ValueError` | :exc:`ValueError` | | -+-----------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ZeroDivisionError` | :exc:`ZeroDivisionError` | | -+-----------------------------------------+---------------------------------+----------+ +.. list-table:: + :align: left + :widths: auto + :header-rows: 1 + + * * C name + * Python name + * Notes + * * .. c:var:: PyObject *PyExc_BaseException + * :exc:`BaseException` + * [1]_ + * * .. c:var:: PyObject *PyExc_BaseExceptionGroup + * :exc:`BaseExceptionGroup` + * [1]_ + * * .. c:var:: PyObject *PyExc_Exception + * :exc:`Exception` + * [1]_ + * * .. c:var:: PyObject *PyExc_ArithmeticError + * :exc:`ArithmeticError` + * [1]_ + * * .. c:var:: PyObject *PyExc_AssertionError + * :exc:`AssertionError` + * + * * .. c:var:: PyObject *PyExc_AttributeError + * :exc:`AttributeError` + * + * * .. c:var:: PyObject *PyExc_BlockingIOError + * :exc:`BlockingIOError` + * + * * .. c:var:: PyObject *PyExc_BrokenPipeError + * :exc:`BrokenPipeError` + * + * * .. c:var:: PyObject *PyExc_BufferError + * :exc:`BufferError` + * + * * .. c:var:: PyObject *PyExc_ChildProcessError + * :exc:`ChildProcessError` + * + * * .. c:var:: PyObject *PyExc_ConnectionAbortedError + * :exc:`ConnectionAbortedError` + * + * * .. c:var:: PyObject *PyExc_ConnectionError + * :exc:`ConnectionError` + * + * * .. c:var:: PyObject *PyExc_ConnectionRefusedError + * :exc:`ConnectionRefusedError` + * + * * .. c:var:: PyObject *PyExc_ConnectionResetError + * :exc:`ConnectionResetError` + * + * * .. c:var:: PyObject *PyExc_EOFError + * :exc:`EOFError` + * + * * .. c:var:: PyObject *PyExc_FileExistsError + * :exc:`FileExistsError` + * + * * .. c:var:: PyObject *PyExc_FileNotFoundError + * :exc:`FileNotFoundError` + * + * * .. c:var:: PyObject *PyExc_FloatingPointError + * :exc:`FloatingPointError` + * + * * .. c:var:: PyObject *PyExc_GeneratorExit + * :exc:`GeneratorExit` + * + * * .. c:var:: PyObject *PyExc_ImportError + * :exc:`ImportError` + * + * * .. c:var:: PyObject *PyExc_IndentationError + * :exc:`IndentationError` + * + * * .. c:var:: PyObject *PyExc_IndexError + * :exc:`IndexError` + * + * * .. c:var:: PyObject *PyExc_InterruptedError + * :exc:`InterruptedError` + * + * * .. c:var:: PyObject *PyExc_IsADirectoryError + * :exc:`IsADirectoryError` + * + * * .. c:var:: PyObject *PyExc_KeyError + * :exc:`KeyError` + * + * * .. c:var:: PyObject *PyExc_KeyboardInterrupt + * :exc:`KeyboardInterrupt` + * + * * .. c:var:: PyObject *PyExc_LookupError + * :exc:`LookupError` + * [1]_ + * * .. c:var:: PyObject *PyExc_MemoryError + * :exc:`MemoryError` + * + * * .. c:var:: PyObject *PyExc_ModuleNotFoundError + * :exc:`ModuleNotFoundError` + * + * * .. c:var:: PyObject *PyExc_NameError + * :exc:`NameError` + * + * * .. c:var:: PyObject *PyExc_NotADirectoryError + * :exc:`NotADirectoryError` + * + * * .. c:var:: PyObject *PyExc_NotImplementedError + * :exc:`NotImplementedError` + * + * * .. c:var:: PyObject *PyExc_OSError + * :exc:`OSError` + * [1]_ + * * .. c:var:: PyObject *PyExc_OverflowError + * :exc:`OverflowError` + * + * * .. c:var:: PyObject *PyExc_PermissionError + * :exc:`PermissionError` + * + * * .. c:var:: PyObject *PyExc_ProcessLookupError + * :exc:`ProcessLookupError` + * + * * .. c:var:: PyObject *PyExc_PythonFinalizationError + * :exc:`PythonFinalizationError` + * + * * .. c:var:: PyObject *PyExc_RecursionError + * :exc:`RecursionError` + * + * * .. c:var:: PyObject *PyExc_ReferenceError + * :exc:`ReferenceError` + * + * * .. c:var:: PyObject *PyExc_RuntimeError + * :exc:`RuntimeError` + * + * * .. c:var:: PyObject *PyExc_StopAsyncIteration + * :exc:`StopAsyncIteration` + * + * * .. c:var:: PyObject *PyExc_StopIteration + * :exc:`StopIteration` + * + * * .. c:var:: PyObject *PyExc_SyntaxError + * :exc:`SyntaxError` + * + * * .. c:var:: PyObject *PyExc_SystemError + * :exc:`SystemError` + * + * * .. c:var:: PyObject *PyExc_SystemExit + * :exc:`SystemExit` + * + * * .. c:var:: PyObject *PyExc_TabError + * :exc:`TabError` + * + * * .. c:var:: PyObject *PyExc_TimeoutError + * :exc:`TimeoutError` + * + * * .. c:var:: PyObject *PyExc_TypeError + * :exc:`TypeError` + * + * * .. c:var:: PyObject *PyExc_UnboundLocalError + * :exc:`UnboundLocalError` + * + * * .. c:var:: PyObject *PyExc_UnicodeDecodeError + * :exc:`UnicodeDecodeError` + * + * * .. c:var:: PyObject *PyExc_UnicodeEncodeError + * :exc:`UnicodeEncodeError` + * + * * .. c:var:: PyObject *PyExc_UnicodeError + * :exc:`UnicodeError` + * + * * .. c:var:: PyObject *PyExc_UnicodeTranslateError + * :exc:`UnicodeTranslateError` + * + * * .. c:var:: PyObject *PyExc_ValueError + * :exc:`ValueError` + * + * * .. c:var:: PyObject *PyExc_ZeroDivisionError + * :exc:`ZeroDivisionError` + * + .. versionadded:: 3.3 :c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, @@ -1182,20 +1186,20 @@ the variables: These are compatibility aliases to :c:data:`PyExc_OSError`: -.. index:: - single: PyExc_EnvironmentError (C var) - single: PyExc_IOError (C var) - single: PyExc_WindowsError (C var) - -+-------------------------------------+----------+ -| C Name | Notes | -+=====================================+==========+ -| :c:data:`!PyExc_EnvironmentError` | | -+-------------------------------------+----------+ -| :c:data:`!PyExc_IOError` | | -+-------------------------------------+----------+ -| :c:data:`!PyExc_WindowsError` | [2]_ | -+-------------------------------------+----------+ + +.. list-table:: + :widths: auto + :align: left + :header-rows: 1 + + * * C name + * Notes + * * .. c:var:: PyObject *PyExc_EnvironmentError + * + * * .. c:var:: PyObject *PyExc_IOError + * + * * .. c:var:: PyObject *PyExc_WindowsError + * [2]_ .. versionchanged:: 3.3 These aliases used to be separate exception types. @@ -1219,47 +1223,50 @@ names are ``PyExc_`` followed by the Python exception name. These have the type :c:expr:`PyObject*`; they are all class objects. For completeness, here are all the variables: -.. index:: - single: PyExc_Warning (C var) - single: PyExc_BytesWarning (C var) - single: PyExc_DeprecationWarning (C var) - single: PyExc_EncodingWarning (C var) - single: PyExc_FutureWarning (C var) - single: PyExc_ImportWarning (C var) - single: PyExc_PendingDeprecationWarning (C var) - single: PyExc_ResourceWarning (C var) - single: PyExc_RuntimeWarning (C var) - single: PyExc_SyntaxWarning (C var) - single: PyExc_UnicodeWarning (C var) - single: PyExc_UserWarning (C var) - -+------------------------------------------+---------------------------------+----------+ -| C Name | Python Name | Notes | -+==========================================+=================================+==========+ -| :c:data:`PyExc_Warning` | :exc:`Warning` | [3]_ | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_BytesWarning` | :exc:`BytesWarning` | | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_DeprecationWarning` | :exc:`DeprecationWarning` | | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_EncodingWarning` | :exc:`EncodingWarning` | | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_FutureWarning` | :exc:`FutureWarning` | | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ImportWarning` | :exc:`ImportWarning` | | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_PendingDeprecationWarning`| :exc:`PendingDeprecationWarning`| | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_ResourceWarning` | :exc:`ResourceWarning` | | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_RuntimeWarning` | :exc:`RuntimeWarning` | | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_SyntaxWarning` | :exc:`SyntaxWarning` | | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_UnicodeWarning` | :exc:`UnicodeWarning` | | -+------------------------------------------+---------------------------------+----------+ -| :c:data:`PyExc_UserWarning` | :exc:`UserWarning` | | -+------------------------------------------+---------------------------------+----------+ +.. list-table:: + :widths: auto + :align: left + :header-rows: 1 + + * * C name + * Python name + * Notes + * * .. c:var:: PyObject *PyExc_Warning + * :exc:`Warning` + * [3]_ + * * .. c:var:: PyObject *PyExc_BytesWarning + * :exc:`BytesWarning` + * + * * .. c:var:: PyObject *PyExc_DeprecationWarning + * :exc:`DeprecationWarning` + * + * * .. c:var:: PyObject *PyExc_EncodingWarning + * :exc:`EncodingWarning` + * + * * .. c:var:: PyObject *PyExc_FutureWarning + * :exc:`FutureWarning` + * + * * .. c:var:: PyObject *PyExc_ImportWarning + * :exc:`ImportWarning` + * + * * .. c:var:: PyObject *PyExc_PendingDeprecationWarning + * :exc:`PendingDeprecationWarning` + * + * * .. c:var:: PyObject *PyExc_ResourceWarning + * :exc:`ResourceWarning` + * + * * .. c:var:: PyObject *PyExc_RuntimeWarning + * :exc:`RuntimeWarning` + * + * * .. c:var:: PyObject *PyExc_SyntaxWarning + * :exc:`SyntaxWarning` + * + * * .. c:var:: PyObject *PyExc_UnicodeWarning + * :exc:`UnicodeWarning` + * + * * .. c:var:: PyObject *PyExc_UserWarning + * :exc:`UserWarning` + * .. versionadded:: 3.2 :c:data:`PyExc_ResourceWarning`. diff --git a/Doc/conf.py b/Doc/conf.py index 161c2986441edd..0a7702e826d07e 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -233,75 +233,6 @@ # Temporary undocumented names. # In future this list must be empty. nitpick_ignore += [ - # C API: Standard Python exception classes - ('c:data', 'PyExc_ArithmeticError'), - ('c:data', 'PyExc_AssertionError'), - ('c:data', 'PyExc_AttributeError'), - ('c:data', 'PyExc_BaseException'), - ('c:data', 'PyExc_BaseExceptionGroup'), - ('c:data', 'PyExc_BlockingIOError'), - ('c:data', 'PyExc_BrokenPipeError'), - ('c:data', 'PyExc_BufferError'), - ('c:data', 'PyExc_ChildProcessError'), - ('c:data', 'PyExc_ConnectionAbortedError'), - ('c:data', 'PyExc_ConnectionError'), - ('c:data', 'PyExc_ConnectionRefusedError'), - ('c:data', 'PyExc_ConnectionResetError'), - ('c:data', 'PyExc_EOFError'), - ('c:data', 'PyExc_Exception'), - ('c:data', 'PyExc_FileExistsError'), - ('c:data', 'PyExc_FileNotFoundError'), - ('c:data', 'PyExc_FloatingPointError'), - ('c:data', 'PyExc_GeneratorExit'), - ('c:data', 'PyExc_ImportError'), - ('c:data', 'PyExc_IndentationError'), - ('c:data', 'PyExc_IndexError'), - ('c:data', 'PyExc_InterruptedError'), - ('c:data', 'PyExc_IsADirectoryError'), - ('c:data', 'PyExc_KeyboardInterrupt'), - ('c:data', 'PyExc_KeyError'), - ('c:data', 'PyExc_LookupError'), - ('c:data', 'PyExc_MemoryError'), - ('c:data', 'PyExc_ModuleNotFoundError'), - ('c:data', 'PyExc_NameError'), - ('c:data', 'PyExc_NotADirectoryError'), - ('c:data', 'PyExc_NotImplementedError'), - ('c:data', 'PyExc_OSError'), - ('c:data', 'PyExc_OverflowError'), - ('c:data', 'PyExc_PermissionError'), - ('c:data', 'PyExc_ProcessLookupError'), - ('c:data', 'PyExc_PythonFinalizationError'), - ('c:data', 'PyExc_RecursionError'), - ('c:data', 'PyExc_ReferenceError'), - ('c:data', 'PyExc_RuntimeError'), - ('c:data', 'PyExc_StopAsyncIteration'), - ('c:data', 'PyExc_StopIteration'), - ('c:data', 'PyExc_SyntaxError'), - ('c:data', 'PyExc_SystemError'), - ('c:data', 'PyExc_SystemExit'), - ('c:data', 'PyExc_TabError'), - ('c:data', 'PyExc_TimeoutError'), - ('c:data', 'PyExc_TypeError'), - ('c:data', 'PyExc_UnboundLocalError'), - ('c:data', 'PyExc_UnicodeDecodeError'), - ('c:data', 'PyExc_UnicodeEncodeError'), - ('c:data', 'PyExc_UnicodeError'), - ('c:data', 'PyExc_UnicodeTranslateError'), - ('c:data', 'PyExc_ValueError'), - ('c:data', 'PyExc_ZeroDivisionError'), - # C API: Standard Python warning classes - ('c:data', 'PyExc_BytesWarning'), - ('c:data', 'PyExc_DeprecationWarning'), - ('c:data', 'PyExc_EncodingWarning'), - ('c:data', 'PyExc_FutureWarning'), - ('c:data', 'PyExc_ImportWarning'), - ('c:data', 'PyExc_PendingDeprecationWarning'), - ('c:data', 'PyExc_ResourceWarning'), - ('c:data', 'PyExc_RuntimeWarning'), - ('c:data', 'PyExc_SyntaxWarning'), - ('c:data', 'PyExc_UnicodeWarning'), - ('c:data', 'PyExc_UserWarning'), - ('c:data', 'PyExc_Warning'), # Undocumented public C macros ('c:macro', 'Py_BUILD_ASSERT'), ('c:macro', 'Py_BUILD_ASSERT_EXPR'), From bb7948424a30d6499f4dc633c3087a08f1545a7c Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 2 Jul 2025 17:17:35 +0200 Subject: [PATCH 02/10] Merge the 3 tables --- Doc/c-api/exceptions.rst | 118 ++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 70 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 02919c8bc0d2c4..2a3fe9f5476827 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -980,15 +980,17 @@ these are the C equivalent to :func:`reprlib.recursive_repr`. invocation of :c:func:`Py_ReprEnter` that returns zero. +.. _standardwarningcategories: .. _standardexceptions: -Standard Exceptions -=================== +Exception and warning types +=========================== + +All standard Python exceptions and warning categories are available as global +variables whose names are ``PyExc_`` followed by the Python exception name. +These have the type :c:expr:`PyObject*`; they are all class objects. -All standard Python exceptions are available as global variables whose names are -``PyExc_`` followed by the Python exception name. These have the type -:c:expr:`PyObject*`; they are all class objects. For completeness, here are all -the variables: +For completeness, here are all the variables: .. list-table:: :align: left @@ -1164,76 +1166,19 @@ the variables: * :exc:`ZeroDivisionError` * - -.. versionadded:: 3.3 - :c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, - :c:data:`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, - :c:data:`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, - :c:data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, - :c:data:`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, - :c:data:`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, - :c:data:`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` - and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`. - -.. versionadded:: 3.5 - :c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`. - -.. versionadded:: 3.6 - :c:data:`PyExc_ModuleNotFoundError`. - -.. versionadded:: 3.11 - :c:data:`PyExc_BaseExceptionGroup`. - -These are compatibility aliases to :c:data:`PyExc_OSError`: - - -.. list-table:: - :widths: auto - :align: left - :header-rows: 1 - - * * C name - * Notes * * .. c:var:: PyObject *PyExc_EnvironmentError - * + * :exc:`OSError` + * [3]_ * * .. c:var:: PyObject *PyExc_IOError - * + * :exc:`OSError` + * [3]_ * * .. c:var:: PyObject *PyExc_WindowsError - * [2]_ - -.. versionchanged:: 3.3 - These aliases used to be separate exception types. - -Notes: - -.. [1] - This is a base class for other standard exceptions. - -.. [2] - Only defined on Windows; protect code that uses this by testing that the - preprocessor macro ``MS_WINDOWS`` is defined. - -.. _standardwarningcategories: - -Standard Warning Categories -=========================== - -All standard Python warning categories are available as global variables whose -names are ``PyExc_`` followed by the Python exception name. These have the type -:c:expr:`PyObject*`; they are all class objects. For completeness, here are all -the variables: - -.. list-table:: - :widths: auto - :align: left - :header-rows: 1 + * :exc:`OSError` + * [2]_ [3]_ - * * C name - * Python name - * Notes * * .. c:var:: PyObject *PyExc_Warning * :exc:`Warning` - * [3]_ + * [4]_ * * .. c:var:: PyObject *PyExc_BytesWarning * :exc:`BytesWarning` * @@ -1268,13 +1213,46 @@ the variables: * :exc:`UserWarning` * + .. versionadded:: 3.2 :c:data:`PyExc_ResourceWarning`. +.. versionadded:: 3.3 + :c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, + :c:data:`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, + :c:data:`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, + :c:data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, + :c:data:`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, + :c:data:`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, + :c:data:`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` + and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`. + +.. versionadded:: 3.5 + :c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`. + +.. versionadded:: 3.6 + :c:data:`PyExc_ModuleNotFoundError`. + .. versionadded:: 3.10 :c:data:`PyExc_EncodingWarning`. +.. versionadded:: 3.11 + :c:data:`PyExc_BaseExceptionGroup`. + Notes: +.. [1] + This is a base class for other standard exceptions. + +.. [2] + Only defined on Windows; protect code that uses this by testing that the + preprocessor macro ``MS_WINDOWS`` is defined. + .. [3] + This are compatibility alias to :c:data:`PyExc_OSError`. + + .. versionchanged:: 3.3 + These aliases used to be separate exception types. + +.. [4] This is a base class for other standard warning categories. From 9a42d1d898e0a29978cc3214442a5b8152189780 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 2 Jul 2025 17:21:58 +0200 Subject: [PATCH 03/10] Name the notes --- Doc/c-api/exceptions.rst | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 2a3fe9f5476827..6bc05b850266fc 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -1002,16 +1002,16 @@ For completeness, here are all the variables: * Notes * * .. c:var:: PyObject *PyExc_BaseException * :exc:`BaseException` - * [1]_ + * [base]_ * * .. c:var:: PyObject *PyExc_BaseExceptionGroup * :exc:`BaseExceptionGroup` - * [1]_ + * [base]_ * * .. c:var:: PyObject *PyExc_Exception * :exc:`Exception` - * [1]_ + * [base]_ * * .. c:var:: PyObject *PyExc_ArithmeticError * :exc:`ArithmeticError` - * [1]_ + * [base]_ * * .. c:var:: PyObject *PyExc_AssertionError * :exc:`AssertionError` * @@ -1080,7 +1080,7 @@ For completeness, here are all the variables: * * * .. c:var:: PyObject *PyExc_LookupError * :exc:`LookupError` - * [1]_ + * [base]_ * * .. c:var:: PyObject *PyExc_MemoryError * :exc:`MemoryError` * @@ -1098,7 +1098,7 @@ For completeness, here are all the variables: * * * .. c:var:: PyObject *PyExc_OSError * :exc:`OSError` - * [1]_ + * [base]_ * * .. c:var:: PyObject *PyExc_OverflowError * :exc:`OverflowError` * @@ -1168,17 +1168,17 @@ For completeness, here are all the variables: * * .. c:var:: PyObject *PyExc_EnvironmentError * :exc:`OSError` - * [3]_ + * [oserror]_ * * .. c:var:: PyObject *PyExc_IOError * :exc:`OSError` - * [3]_ + * [oserror]_ * * .. c:var:: PyObject *PyExc_WindowsError * :exc:`OSError` - * [2]_ [3]_ + * [oserror]_ [win]_ * * .. c:var:: PyObject *PyExc_Warning * :exc:`Warning` - * [4]_ + * [base]_ * * .. c:var:: PyObject *PyExc_BytesWarning * :exc:`BytesWarning` * @@ -1241,18 +1241,15 @@ For completeness, here are all the variables: Notes: -.. [1] - This is a base class for other standard exceptions. +.. [base] + This is a base class for other standard exceptions or warning categories. -.. [2] +.. [win] Only defined on Windows; protect code that uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined. -.. [3] - This are compatibility alias to :c:data:`PyExc_OSError`. +.. [oserror] + This is a compatibility alias to :c:data:`PyExc_OSError`. .. versionchanged:: 3.3 These aliases used to be separate exception types. - -.. [4] - This is a base class for other standard warning categories. From 64d57e16546fc51ded4ff0363ae783993b7add22 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 2 Jul 2025 17:23:42 +0200 Subject: [PATCH 04/10] Remove the "base class" note This info wasn't kept updated, and is of questionable value --- Doc/c-api/exceptions.rst | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 6bc05b850266fc..993fa07a505158 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -1002,16 +1002,16 @@ For completeness, here are all the variables: * Notes * * .. c:var:: PyObject *PyExc_BaseException * :exc:`BaseException` - * [base]_ + * * * .. c:var:: PyObject *PyExc_BaseExceptionGroup * :exc:`BaseExceptionGroup` - * [base]_ + * * * .. c:var:: PyObject *PyExc_Exception * :exc:`Exception` - * [base]_ + * * * .. c:var:: PyObject *PyExc_ArithmeticError * :exc:`ArithmeticError` - * [base]_ + * * * .. c:var:: PyObject *PyExc_AssertionError * :exc:`AssertionError` * @@ -1080,7 +1080,7 @@ For completeness, here are all the variables: * * * .. c:var:: PyObject *PyExc_LookupError * :exc:`LookupError` - * [base]_ + * * * .. c:var:: PyObject *PyExc_MemoryError * :exc:`MemoryError` * @@ -1098,7 +1098,7 @@ For completeness, here are all the variables: * * * .. c:var:: PyObject *PyExc_OSError * :exc:`OSError` - * [base]_ + * * * .. c:var:: PyObject *PyExc_OverflowError * :exc:`OverflowError` * @@ -1178,7 +1178,7 @@ For completeness, here are all the variables: * * .. c:var:: PyObject *PyExc_Warning * :exc:`Warning` - * [base]_ + * * * .. c:var:: PyObject *PyExc_BytesWarning * :exc:`BytesWarning` * @@ -1241,9 +1241,6 @@ For completeness, here are all the variables: Notes: -.. [base] - This is a base class for other standard exceptions or warning categories. - .. [win] Only defined on Windows; protect code that uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined. From 9177b805e6185c4a4b4db679fc2198e18d3188b8 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 9 Jul 2025 15:32:42 +0200 Subject: [PATCH 05/10] Apply suggestions from code review Co-authored-by: Victor Stinner --- Doc/c-api/exceptions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 993fa07a505158..a177e8a9db1221 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -1249,4 +1249,4 @@ Notes: This is a compatibility alias to :c:data:`PyExc_OSError`. .. versionchanged:: 3.3 - These aliases used to be separate exception types. + These aliases to :c:data:`PyExc_OSError` used to be separate exception types. From e1b2fcb852e205bc135168d1d5f19341685a6f3b Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 9 Jul 2025 15:41:42 +0200 Subject: [PATCH 06/10] Use :no-typesetting: and :c:var: --- Doc/c-api/exceptions.rst | 210 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index a177e8a9db1221..5745541193d74e 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -1001,215 +1001,425 @@ For completeness, here are all the variables: * Python name * Notes * * .. c:var:: PyObject *PyExc_BaseException + :no-typesetting: + + :c:var:`!PyExc_BaseException` * :exc:`BaseException` * * * .. c:var:: PyObject *PyExc_BaseExceptionGroup + :no-typesetting: + + :c:var:`!PyExc_BaseExceptionGroup` * :exc:`BaseExceptionGroup` * * * .. c:var:: PyObject *PyExc_Exception + :no-typesetting: + + :c:var:`!PyExc_Exception` * :exc:`Exception` * * * .. c:var:: PyObject *PyExc_ArithmeticError + :no-typesetting: + + :c:var:`!PyExc_ArithmeticError` * :exc:`ArithmeticError` * * * .. c:var:: PyObject *PyExc_AssertionError + :no-typesetting: + + :c:var:`!PyExc_AssertionError` * :exc:`AssertionError` * * * .. c:var:: PyObject *PyExc_AttributeError + :no-typesetting: + + :c:var:`!PyExc_AttributeError` * :exc:`AttributeError` * * * .. c:var:: PyObject *PyExc_BlockingIOError + :no-typesetting: + + :c:var:`!PyExc_BlockingIOError` * :exc:`BlockingIOError` * * * .. c:var:: PyObject *PyExc_BrokenPipeError + :no-typesetting: + + :c:var:`!PyExc_BrokenPipeError` * :exc:`BrokenPipeError` * * * .. c:var:: PyObject *PyExc_BufferError + :no-typesetting: + + :c:var:`!PyExc_BufferError` * :exc:`BufferError` * * * .. c:var:: PyObject *PyExc_ChildProcessError + :no-typesetting: + + :c:var:`!PyExc_ChildProcessError` * :exc:`ChildProcessError` * * * .. c:var:: PyObject *PyExc_ConnectionAbortedError + :no-typesetting: + + :c:var:`!PyExc_ConnectionAbortedError` * :exc:`ConnectionAbortedError` * * * .. c:var:: PyObject *PyExc_ConnectionError + :no-typesetting: + + :c:var:`!PyExc_ConnectionError` * :exc:`ConnectionError` * * * .. c:var:: PyObject *PyExc_ConnectionRefusedError + :no-typesetting: + + :c:var:`!PyExc_ConnectionRefusedError` * :exc:`ConnectionRefusedError` * * * .. c:var:: PyObject *PyExc_ConnectionResetError + :no-typesetting: + + :c:var:`!PyExc_ConnectionResetError` * :exc:`ConnectionResetError` * * * .. c:var:: PyObject *PyExc_EOFError + :no-typesetting: + + :c:var:`!PyExc_EOFError` * :exc:`EOFError` * * * .. c:var:: PyObject *PyExc_FileExistsError + :no-typesetting: + + :c:var:`!PyExc_FileExistsError` * :exc:`FileExistsError` * * * .. c:var:: PyObject *PyExc_FileNotFoundError + :no-typesetting: + + :c:var:`!PyExc_FileNotFoundError` * :exc:`FileNotFoundError` * * * .. c:var:: PyObject *PyExc_FloatingPointError + :no-typesetting: + + :c:var:`!PyExc_FloatingPointError` * :exc:`FloatingPointError` * * * .. c:var:: PyObject *PyExc_GeneratorExit + :no-typesetting: + + :c:var:`!PyExc_GeneratorExit` * :exc:`GeneratorExit` * * * .. c:var:: PyObject *PyExc_ImportError + :no-typesetting: + + :c:var:`!PyExc_ImportError` * :exc:`ImportError` * * * .. c:var:: PyObject *PyExc_IndentationError + :no-typesetting: + + :c:var:`!PyExc_IndentationError` * :exc:`IndentationError` * * * .. c:var:: PyObject *PyExc_IndexError + :no-typesetting: + + :c:var:`!PyExc_IndexError` * :exc:`IndexError` * * * .. c:var:: PyObject *PyExc_InterruptedError + :no-typesetting: + + :c:var:`!PyExc_InterruptedError` * :exc:`InterruptedError` * * * .. c:var:: PyObject *PyExc_IsADirectoryError + :no-typesetting: + + :c:var:`!PyExc_IsADirectoryError` * :exc:`IsADirectoryError` * * * .. c:var:: PyObject *PyExc_KeyError + :no-typesetting: + + :c:var:`!PyExc_KeyError` * :exc:`KeyError` * * * .. c:var:: PyObject *PyExc_KeyboardInterrupt + :no-typesetting: + + :c:var:`!PyExc_KeyboardInterrupt` * :exc:`KeyboardInterrupt` * * * .. c:var:: PyObject *PyExc_LookupError + :no-typesetting: + + :c:var:`!PyExc_LookupError` * :exc:`LookupError` * * * .. c:var:: PyObject *PyExc_MemoryError + :no-typesetting: + + :c:var:`!PyExc_MemoryError` * :exc:`MemoryError` * * * .. c:var:: PyObject *PyExc_ModuleNotFoundError + :no-typesetting: + + :c:var:`!PyExc_ModuleNotFoundError` * :exc:`ModuleNotFoundError` * * * .. c:var:: PyObject *PyExc_NameError + :no-typesetting: + + :c:var:`!PyExc_NameError` * :exc:`NameError` * * * .. c:var:: PyObject *PyExc_NotADirectoryError + :no-typesetting: + + :c:var:`!PyExc_NotADirectoryError` * :exc:`NotADirectoryError` * * * .. c:var:: PyObject *PyExc_NotImplementedError + :no-typesetting: + + :c:var:`!PyExc_NotImplementedError` * :exc:`NotImplementedError` * * * .. c:var:: PyObject *PyExc_OSError + :no-typesetting: + + :c:var:`!PyExc_OSError` * :exc:`OSError` * * * .. c:var:: PyObject *PyExc_OverflowError + :no-typesetting: + + :c:var:`!PyExc_OverflowError` * :exc:`OverflowError` * * * .. c:var:: PyObject *PyExc_PermissionError + :no-typesetting: + + :c:var:`!PyExc_PermissionError` * :exc:`PermissionError` * * * .. c:var:: PyObject *PyExc_ProcessLookupError + :no-typesetting: + + :c:var:`!PyExc_ProcessLookupError` * :exc:`ProcessLookupError` * * * .. c:var:: PyObject *PyExc_PythonFinalizationError + :no-typesetting: + + :c:var:`!PyExc_PythonFinalizationError` * :exc:`PythonFinalizationError` * * * .. c:var:: PyObject *PyExc_RecursionError + :no-typesetting: + + :c:var:`!PyExc_RecursionError` * :exc:`RecursionError` * * * .. c:var:: PyObject *PyExc_ReferenceError + :no-typesetting: + + :c:var:`!PyExc_ReferenceError` * :exc:`ReferenceError` * * * .. c:var:: PyObject *PyExc_RuntimeError + :no-typesetting: + + :c:var:`!PyExc_RuntimeError` * :exc:`RuntimeError` * * * .. c:var:: PyObject *PyExc_StopAsyncIteration + :no-typesetting: + + :c:var:`!PyExc_StopAsyncIteration` * :exc:`StopAsyncIteration` * * * .. c:var:: PyObject *PyExc_StopIteration + :no-typesetting: + + :c:var:`!PyExc_StopIteration` * :exc:`StopIteration` * * * .. c:var:: PyObject *PyExc_SyntaxError + :no-typesetting: + + :c:var:`!PyExc_SyntaxError` * :exc:`SyntaxError` * * * .. c:var:: PyObject *PyExc_SystemError + :no-typesetting: + + :c:var:`!PyExc_SystemError` * :exc:`SystemError` * * * .. c:var:: PyObject *PyExc_SystemExit + :no-typesetting: + + :c:var:`!PyExc_SystemExit` * :exc:`SystemExit` * * * .. c:var:: PyObject *PyExc_TabError + :no-typesetting: + + :c:var:`!PyExc_TabError` * :exc:`TabError` * * * .. c:var:: PyObject *PyExc_TimeoutError + :no-typesetting: + + :c:var:`!PyExc_TimeoutError` * :exc:`TimeoutError` * * * .. c:var:: PyObject *PyExc_TypeError + :no-typesetting: + + :c:var:`!PyExc_TypeError` * :exc:`TypeError` * * * .. c:var:: PyObject *PyExc_UnboundLocalError + :no-typesetting: + + :c:var:`!PyExc_UnboundLocalError` * :exc:`UnboundLocalError` * * * .. c:var:: PyObject *PyExc_UnicodeDecodeError + :no-typesetting: + + :c:var:`!PyExc_UnicodeDecodeError` * :exc:`UnicodeDecodeError` * * * .. c:var:: PyObject *PyExc_UnicodeEncodeError + :no-typesetting: + + :c:var:`!PyExc_UnicodeEncodeError` * :exc:`UnicodeEncodeError` * * * .. c:var:: PyObject *PyExc_UnicodeError + :no-typesetting: + + :c:var:`!PyExc_UnicodeError` * :exc:`UnicodeError` * * * .. c:var:: PyObject *PyExc_UnicodeTranslateError + :no-typesetting: + + :c:var:`!PyExc_UnicodeTranslateError` * :exc:`UnicodeTranslateError` * * * .. c:var:: PyObject *PyExc_ValueError + :no-typesetting: + + :c:var:`!PyExc_ValueError` * :exc:`ValueError` * * * .. c:var:: PyObject *PyExc_ZeroDivisionError + :no-typesetting: + + :c:var:`!PyExc_ZeroDivisionError` * :exc:`ZeroDivisionError` * * * .. c:var:: PyObject *PyExc_EnvironmentError + :no-typesetting: + + :c:var:`!PyExc_EnvironmentError` * :exc:`OSError` * [oserror]_ * * .. c:var:: PyObject *PyExc_IOError + :no-typesetting: + + :c:var:`!PyExc_IOError` * :exc:`OSError` * [oserror]_ * * .. c:var:: PyObject *PyExc_WindowsError + :no-typesetting: + + :c:var:`!PyExc_WindowsError` * :exc:`OSError` * [oserror]_ [win]_ * * .. c:var:: PyObject *PyExc_Warning + :no-typesetting: + + :c:var:`!PyExc_Warning` * :exc:`Warning` * * * .. c:var:: PyObject *PyExc_BytesWarning + :no-typesetting: + + :c:var:`!PyExc_BytesWarning` * :exc:`BytesWarning` * * * .. c:var:: PyObject *PyExc_DeprecationWarning + :no-typesetting: + + :c:var:`!PyExc_DeprecationWarning` * :exc:`DeprecationWarning` * * * .. c:var:: PyObject *PyExc_EncodingWarning + :no-typesetting: + + :c:var:`!PyExc_EncodingWarning` * :exc:`EncodingWarning` * * * .. c:var:: PyObject *PyExc_FutureWarning + :no-typesetting: + + :c:var:`!PyExc_FutureWarning` * :exc:`FutureWarning` * * * .. c:var:: PyObject *PyExc_ImportWarning + :no-typesetting: + + :c:var:`!PyExc_ImportWarning` * :exc:`ImportWarning` * * * .. c:var:: PyObject *PyExc_PendingDeprecationWarning + :no-typesetting: + + :c:var:`!PyExc_PendingDeprecationWarning` * :exc:`PendingDeprecationWarning` * * * .. c:var:: PyObject *PyExc_ResourceWarning + :no-typesetting: + + :c:var:`!PyExc_ResourceWarning` * :exc:`ResourceWarning` * * * .. c:var:: PyObject *PyExc_RuntimeWarning + :no-typesetting: + + :c:var:`!PyExc_RuntimeWarning` * :exc:`RuntimeWarning` * * * .. c:var:: PyObject *PyExc_SyntaxWarning + :no-typesetting: + + :c:var:`!PyExc_SyntaxWarning` * :exc:`SyntaxWarning` * * * .. c:var:: PyObject *PyExc_UnicodeWarning + :no-typesetting: + + :c:var:`!PyExc_UnicodeWarning` * :exc:`UnicodeWarning` * * * .. c:var:: PyObject *PyExc_UserWarning + :no-typesetting: + + :c:var:`!PyExc_UserWarning` * :exc:`UserWarning` * From f928b13f80913dfd1950b4d111612a1c63c928a9 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 9 Jul 2025 15:55:32 +0200 Subject: [PATCH 07/10] Separate the 3 tables --- Doc/c-api/exceptions.rst | 162 ++++++++++++++------------------------- 1 file changed, 59 insertions(+), 103 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 5745541193d74e..5dcdd90c5a2f91 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -992,6 +992,9 @@ These have the type :c:expr:`PyObject*`; they are all class objects. For completeness, here are all the variables: +Exception types +--------------- + .. list-table:: :align: left :widths: auto @@ -999,464 +1002,417 @@ For completeness, here are all the variables: * * C name * Python name - * Notes * * .. c:var:: PyObject *PyExc_BaseException :no-typesetting: :c:var:`!PyExc_BaseException` * :exc:`BaseException` - * * * .. c:var:: PyObject *PyExc_BaseExceptionGroup :no-typesetting: :c:var:`!PyExc_BaseExceptionGroup` * :exc:`BaseExceptionGroup` - * * * .. c:var:: PyObject *PyExc_Exception :no-typesetting: :c:var:`!PyExc_Exception` * :exc:`Exception` - * * * .. c:var:: PyObject *PyExc_ArithmeticError :no-typesetting: :c:var:`!PyExc_ArithmeticError` * :exc:`ArithmeticError` - * * * .. c:var:: PyObject *PyExc_AssertionError :no-typesetting: :c:var:`!PyExc_AssertionError` * :exc:`AssertionError` - * * * .. c:var:: PyObject *PyExc_AttributeError :no-typesetting: :c:var:`!PyExc_AttributeError` * :exc:`AttributeError` - * * * .. c:var:: PyObject *PyExc_BlockingIOError :no-typesetting: :c:var:`!PyExc_BlockingIOError` * :exc:`BlockingIOError` - * * * .. c:var:: PyObject *PyExc_BrokenPipeError :no-typesetting: :c:var:`!PyExc_BrokenPipeError` * :exc:`BrokenPipeError` - * * * .. c:var:: PyObject *PyExc_BufferError :no-typesetting: :c:var:`!PyExc_BufferError` * :exc:`BufferError` - * * * .. c:var:: PyObject *PyExc_ChildProcessError :no-typesetting: :c:var:`!PyExc_ChildProcessError` * :exc:`ChildProcessError` - * * * .. c:var:: PyObject *PyExc_ConnectionAbortedError :no-typesetting: :c:var:`!PyExc_ConnectionAbortedError` * :exc:`ConnectionAbortedError` - * * * .. c:var:: PyObject *PyExc_ConnectionError :no-typesetting: :c:var:`!PyExc_ConnectionError` * :exc:`ConnectionError` - * * * .. c:var:: PyObject *PyExc_ConnectionRefusedError :no-typesetting: :c:var:`!PyExc_ConnectionRefusedError` * :exc:`ConnectionRefusedError` - * * * .. c:var:: PyObject *PyExc_ConnectionResetError :no-typesetting: :c:var:`!PyExc_ConnectionResetError` * :exc:`ConnectionResetError` - * * * .. c:var:: PyObject *PyExc_EOFError :no-typesetting: :c:var:`!PyExc_EOFError` * :exc:`EOFError` - * * * .. c:var:: PyObject *PyExc_FileExistsError :no-typesetting: :c:var:`!PyExc_FileExistsError` * :exc:`FileExistsError` - * * * .. c:var:: PyObject *PyExc_FileNotFoundError :no-typesetting: :c:var:`!PyExc_FileNotFoundError` * :exc:`FileNotFoundError` - * * * .. c:var:: PyObject *PyExc_FloatingPointError :no-typesetting: :c:var:`!PyExc_FloatingPointError` * :exc:`FloatingPointError` - * * * .. c:var:: PyObject *PyExc_GeneratorExit :no-typesetting: :c:var:`!PyExc_GeneratorExit` * :exc:`GeneratorExit` - * * * .. c:var:: PyObject *PyExc_ImportError :no-typesetting: :c:var:`!PyExc_ImportError` * :exc:`ImportError` - * * * .. c:var:: PyObject *PyExc_IndentationError :no-typesetting: :c:var:`!PyExc_IndentationError` * :exc:`IndentationError` - * * * .. c:var:: PyObject *PyExc_IndexError :no-typesetting: :c:var:`!PyExc_IndexError` * :exc:`IndexError` - * * * .. c:var:: PyObject *PyExc_InterruptedError :no-typesetting: :c:var:`!PyExc_InterruptedError` * :exc:`InterruptedError` - * * * .. c:var:: PyObject *PyExc_IsADirectoryError :no-typesetting: :c:var:`!PyExc_IsADirectoryError` * :exc:`IsADirectoryError` - * * * .. c:var:: PyObject *PyExc_KeyError :no-typesetting: :c:var:`!PyExc_KeyError` * :exc:`KeyError` - * * * .. c:var:: PyObject *PyExc_KeyboardInterrupt :no-typesetting: :c:var:`!PyExc_KeyboardInterrupt` * :exc:`KeyboardInterrupt` - * * * .. c:var:: PyObject *PyExc_LookupError :no-typesetting: :c:var:`!PyExc_LookupError` * :exc:`LookupError` - * * * .. c:var:: PyObject *PyExc_MemoryError :no-typesetting: :c:var:`!PyExc_MemoryError` * :exc:`MemoryError` - * * * .. c:var:: PyObject *PyExc_ModuleNotFoundError :no-typesetting: :c:var:`!PyExc_ModuleNotFoundError` * :exc:`ModuleNotFoundError` - * * * .. c:var:: PyObject *PyExc_NameError :no-typesetting: :c:var:`!PyExc_NameError` * :exc:`NameError` - * * * .. c:var:: PyObject *PyExc_NotADirectoryError :no-typesetting: :c:var:`!PyExc_NotADirectoryError` * :exc:`NotADirectoryError` - * * * .. c:var:: PyObject *PyExc_NotImplementedError :no-typesetting: :c:var:`!PyExc_NotImplementedError` * :exc:`NotImplementedError` - * * * .. c:var:: PyObject *PyExc_OSError :no-typesetting: :c:var:`!PyExc_OSError` * :exc:`OSError` - * * * .. c:var:: PyObject *PyExc_OverflowError :no-typesetting: :c:var:`!PyExc_OverflowError` * :exc:`OverflowError` - * * * .. c:var:: PyObject *PyExc_PermissionError :no-typesetting: :c:var:`!PyExc_PermissionError` * :exc:`PermissionError` - * * * .. c:var:: PyObject *PyExc_ProcessLookupError :no-typesetting: :c:var:`!PyExc_ProcessLookupError` * :exc:`ProcessLookupError` - * * * .. c:var:: PyObject *PyExc_PythonFinalizationError :no-typesetting: :c:var:`!PyExc_PythonFinalizationError` * :exc:`PythonFinalizationError` - * * * .. c:var:: PyObject *PyExc_RecursionError :no-typesetting: :c:var:`!PyExc_RecursionError` * :exc:`RecursionError` - * * * .. c:var:: PyObject *PyExc_ReferenceError :no-typesetting: :c:var:`!PyExc_ReferenceError` * :exc:`ReferenceError` - * * * .. c:var:: PyObject *PyExc_RuntimeError :no-typesetting: :c:var:`!PyExc_RuntimeError` * :exc:`RuntimeError` - * * * .. c:var:: PyObject *PyExc_StopAsyncIteration :no-typesetting: :c:var:`!PyExc_StopAsyncIteration` * :exc:`StopAsyncIteration` - * * * .. c:var:: PyObject *PyExc_StopIteration :no-typesetting: :c:var:`!PyExc_StopIteration` * :exc:`StopIteration` - * * * .. c:var:: PyObject *PyExc_SyntaxError :no-typesetting: :c:var:`!PyExc_SyntaxError` * :exc:`SyntaxError` - * * * .. c:var:: PyObject *PyExc_SystemError :no-typesetting: :c:var:`!PyExc_SystemError` * :exc:`SystemError` - * * * .. c:var:: PyObject *PyExc_SystemExit :no-typesetting: :c:var:`!PyExc_SystemExit` * :exc:`SystemExit` - * * * .. c:var:: PyObject *PyExc_TabError :no-typesetting: :c:var:`!PyExc_TabError` * :exc:`TabError` - * * * .. c:var:: PyObject *PyExc_TimeoutError :no-typesetting: :c:var:`!PyExc_TimeoutError` * :exc:`TimeoutError` - * * * .. c:var:: PyObject *PyExc_TypeError :no-typesetting: :c:var:`!PyExc_TypeError` * :exc:`TypeError` - * * * .. c:var:: PyObject *PyExc_UnboundLocalError :no-typesetting: :c:var:`!PyExc_UnboundLocalError` * :exc:`UnboundLocalError` - * * * .. c:var:: PyObject *PyExc_UnicodeDecodeError :no-typesetting: :c:var:`!PyExc_UnicodeDecodeError` * :exc:`UnicodeDecodeError` - * * * .. c:var:: PyObject *PyExc_UnicodeEncodeError :no-typesetting: :c:var:`!PyExc_UnicodeEncodeError` * :exc:`UnicodeEncodeError` - * * * .. c:var:: PyObject *PyExc_UnicodeError :no-typesetting: :c:var:`!PyExc_UnicodeError` * :exc:`UnicodeError` - * * * .. c:var:: PyObject *PyExc_UnicodeTranslateError :no-typesetting: :c:var:`!PyExc_UnicodeTranslateError` * :exc:`UnicodeTranslateError` - * * * .. c:var:: PyObject *PyExc_ValueError :no-typesetting: :c:var:`!PyExc_ValueError` * :exc:`ValueError` - * * * .. c:var:: PyObject *PyExc_ZeroDivisionError :no-typesetting: :c:var:`!PyExc_ZeroDivisionError` * :exc:`ZeroDivisionError` - * +.. versionadded:: 3.3 + :c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, + :c:data:`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, + :c:data:`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, + :c:data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, + :c:data:`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, + :c:data:`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, + :c:data:`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` + and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`. + +.. versionadded:: 3.5 + :c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`. + +.. versionadded:: 3.6 + :c:data:`PyExc_ModuleNotFoundError`. + +.. versionadded:: 3.11 + :c:data:`PyExc_BaseExceptionGroup`. + + +OSError aliases +--------------- + +The following are a compatibility aliases to :c:data:`PyExc_OSError`. + +.. versionchanged:: 3.3 + These aliases used to be separate exception types. + +.. list-table:: + :align: left + :widths: auto + :header-rows: 1 + + * * C name + * Python name + * Notes * * .. c:var:: PyObject *PyExc_EnvironmentError :no-typesetting: :c:var:`!PyExc_EnvironmentError` * :exc:`OSError` - * [oserror]_ + * * * .. c:var:: PyObject *PyExc_IOError :no-typesetting: :c:var:`!PyExc_IOError` * :exc:`OSError` - * [oserror]_ + * * * .. c:var:: PyObject *PyExc_WindowsError :no-typesetting: :c:var:`!PyExc_WindowsError` * :exc:`OSError` - * [oserror]_ [win]_ + * [win]_ + +Notes: + +.. [win] + Only defined on Windows; protect code that uses this by testing that the + preprocessor macro ``MS_WINDOWS`` is defined. + + +Warning types +------------- + +.. list-table:: + :align: left + :widths: auto + :header-rows: 1 + * * C name + * Python name * * .. c:var:: PyObject *PyExc_Warning :no-typesetting: :c:var:`!PyExc_Warning` * :exc:`Warning` - * * * .. c:var:: PyObject *PyExc_BytesWarning :no-typesetting: :c:var:`!PyExc_BytesWarning` * :exc:`BytesWarning` - * * * .. c:var:: PyObject *PyExc_DeprecationWarning :no-typesetting: :c:var:`!PyExc_DeprecationWarning` * :exc:`DeprecationWarning` - * * * .. c:var:: PyObject *PyExc_EncodingWarning :no-typesetting: :c:var:`!PyExc_EncodingWarning` * :exc:`EncodingWarning` - * * * .. c:var:: PyObject *PyExc_FutureWarning :no-typesetting: :c:var:`!PyExc_FutureWarning` * :exc:`FutureWarning` - * * * .. c:var:: PyObject *PyExc_ImportWarning :no-typesetting: :c:var:`!PyExc_ImportWarning` * :exc:`ImportWarning` - * * * .. c:var:: PyObject *PyExc_PendingDeprecationWarning :no-typesetting: :c:var:`!PyExc_PendingDeprecationWarning` * :exc:`PendingDeprecationWarning` - * * * .. c:var:: PyObject *PyExc_ResourceWarning :no-typesetting: :c:var:`!PyExc_ResourceWarning` * :exc:`ResourceWarning` - * * * .. c:var:: PyObject *PyExc_RuntimeWarning :no-typesetting: :c:var:`!PyExc_RuntimeWarning` * :exc:`RuntimeWarning` - * * * .. c:var:: PyObject *PyExc_SyntaxWarning :no-typesetting: :c:var:`!PyExc_SyntaxWarning` * :exc:`SyntaxWarning` - * * * .. c:var:: PyObject *PyExc_UnicodeWarning :no-typesetting: :c:var:`!PyExc_UnicodeWarning` * :exc:`UnicodeWarning` - * * * .. c:var:: PyObject *PyExc_UserWarning :no-typesetting: :c:var:`!PyExc_UserWarning` * :exc:`UserWarning` - * - .. versionadded:: 3.2 :c:data:`PyExc_ResourceWarning`. -.. versionadded:: 3.3 - :c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, - :c:data:`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, - :c:data:`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, - :c:data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, - :c:data:`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, - :c:data:`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, - :c:data:`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` - and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`. - -.. versionadded:: 3.5 - :c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`. - -.. versionadded:: 3.6 - :c:data:`PyExc_ModuleNotFoundError`. - .. versionadded:: 3.10 :c:data:`PyExc_EncodingWarning`. - -.. versionadded:: 3.11 - :c:data:`PyExc_BaseExceptionGroup`. - -Notes: - -.. [win] - Only defined on Windows; protect code that uses this by testing that the - preprocessor macro ``MS_WINDOWS`` is defined. - -.. [oserror] - This is a compatibility alias to :c:data:`PyExc_OSError`. - - .. versionchanged:: 3.3 - These aliases to :c:data:`PyExc_OSError` used to be separate exception types. From ada4b42094daf999b5f78e6989c7a2f9fde9962e Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 9 Jul 2025 15:56:15 +0200 Subject: [PATCH 08/10] More specific note on PyExc_WindowsError --- Doc/c-api/exceptions.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 5dcdd90c5a2f91..8b75332e10d533 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -1336,8 +1336,8 @@ The following are a compatibility aliases to :c:data:`PyExc_OSError`. Notes: .. [win] - Only defined on Windows; protect code that uses this by testing that the - preprocessor macro ``MS_WINDOWS`` is defined. + :c:var:`!PyExc_WindowsError` is only defined on Windows; protect code that + uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined. Warning types From 4361496415be04d680a6366b767be83a6b75a8f8 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 10 Jul 2025 10:41:50 +0200 Subject: [PATCH 09/10] Move the standardwarningcategories anchor --- Doc/c-api/exceptions.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 8b75332e10d533..9522ff8ce5a7c5 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -980,7 +980,6 @@ these are the C equivalent to :func:`reprlib.recursive_repr`. invocation of :c:func:`Py_ReprEnter` that returns zero. -.. _standardwarningcategories: .. _standardexceptions: Exception and warning types @@ -1340,6 +1339,8 @@ Notes: uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined. +.. _standardwarningcategories: + Warning types ------------- From 1c971faea95cdae5c6adff1650419e4523cf5504 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 10 Jul 2025 10:47:27 +0200 Subject: [PATCH 10/10] Remove :no-typesetting: --- Doc/c-api/exceptions.rst | 210 --------------------------------------- 1 file changed, 210 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 9522ff8ce5a7c5..3ff4631a8e53c4 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -1002,279 +1002,114 @@ Exception types * * C name * Python name * * .. c:var:: PyObject *PyExc_BaseException - :no-typesetting: - - :c:var:`!PyExc_BaseException` * :exc:`BaseException` * * .. c:var:: PyObject *PyExc_BaseExceptionGroup - :no-typesetting: - - :c:var:`!PyExc_BaseExceptionGroup` * :exc:`BaseExceptionGroup` * * .. c:var:: PyObject *PyExc_Exception - :no-typesetting: - - :c:var:`!PyExc_Exception` * :exc:`Exception` * * .. c:var:: PyObject *PyExc_ArithmeticError - :no-typesetting: - - :c:var:`!PyExc_ArithmeticError` * :exc:`ArithmeticError` * * .. c:var:: PyObject *PyExc_AssertionError - :no-typesetting: - - :c:var:`!PyExc_AssertionError` * :exc:`AssertionError` * * .. c:var:: PyObject *PyExc_AttributeError - :no-typesetting: - - :c:var:`!PyExc_AttributeError` * :exc:`AttributeError` * * .. c:var:: PyObject *PyExc_BlockingIOError - :no-typesetting: - - :c:var:`!PyExc_BlockingIOError` * :exc:`BlockingIOError` * * .. c:var:: PyObject *PyExc_BrokenPipeError - :no-typesetting: - - :c:var:`!PyExc_BrokenPipeError` * :exc:`BrokenPipeError` * * .. c:var:: PyObject *PyExc_BufferError - :no-typesetting: - - :c:var:`!PyExc_BufferError` * :exc:`BufferError` * * .. c:var:: PyObject *PyExc_ChildProcessError - :no-typesetting: - - :c:var:`!PyExc_ChildProcessError` * :exc:`ChildProcessError` * * .. c:var:: PyObject *PyExc_ConnectionAbortedError - :no-typesetting: - - :c:var:`!PyExc_ConnectionAbortedError` * :exc:`ConnectionAbortedError` * * .. c:var:: PyObject *PyExc_ConnectionError - :no-typesetting: - - :c:var:`!PyExc_ConnectionError` * :exc:`ConnectionError` * * .. c:var:: PyObject *PyExc_ConnectionRefusedError - :no-typesetting: - - :c:var:`!PyExc_ConnectionRefusedError` * :exc:`ConnectionRefusedError` * * .. c:var:: PyObject *PyExc_ConnectionResetError - :no-typesetting: - - :c:var:`!PyExc_ConnectionResetError` * :exc:`ConnectionResetError` * * .. c:var:: PyObject *PyExc_EOFError - :no-typesetting: - - :c:var:`!PyExc_EOFError` * :exc:`EOFError` * * .. c:var:: PyObject *PyExc_FileExistsError - :no-typesetting: - - :c:var:`!PyExc_FileExistsError` * :exc:`FileExistsError` * * .. c:var:: PyObject *PyExc_FileNotFoundError - :no-typesetting: - - :c:var:`!PyExc_FileNotFoundError` * :exc:`FileNotFoundError` * * .. c:var:: PyObject *PyExc_FloatingPointError - :no-typesetting: - - :c:var:`!PyExc_FloatingPointError` * :exc:`FloatingPointError` * * .. c:var:: PyObject *PyExc_GeneratorExit - :no-typesetting: - - :c:var:`!PyExc_GeneratorExit` * :exc:`GeneratorExit` * * .. c:var:: PyObject *PyExc_ImportError - :no-typesetting: - - :c:var:`!PyExc_ImportError` * :exc:`ImportError` * * .. c:var:: PyObject *PyExc_IndentationError - :no-typesetting: - - :c:var:`!PyExc_IndentationError` * :exc:`IndentationError` * * .. c:var:: PyObject *PyExc_IndexError - :no-typesetting: - - :c:var:`!PyExc_IndexError` * :exc:`IndexError` * * .. c:var:: PyObject *PyExc_InterruptedError - :no-typesetting: - - :c:var:`!PyExc_InterruptedError` * :exc:`InterruptedError` * * .. c:var:: PyObject *PyExc_IsADirectoryError - :no-typesetting: - - :c:var:`!PyExc_IsADirectoryError` * :exc:`IsADirectoryError` * * .. c:var:: PyObject *PyExc_KeyError - :no-typesetting: - - :c:var:`!PyExc_KeyError` * :exc:`KeyError` * * .. c:var:: PyObject *PyExc_KeyboardInterrupt - :no-typesetting: - - :c:var:`!PyExc_KeyboardInterrupt` * :exc:`KeyboardInterrupt` * * .. c:var:: PyObject *PyExc_LookupError - :no-typesetting: - - :c:var:`!PyExc_LookupError` * :exc:`LookupError` * * .. c:var:: PyObject *PyExc_MemoryError - :no-typesetting: - - :c:var:`!PyExc_MemoryError` * :exc:`MemoryError` * * .. c:var:: PyObject *PyExc_ModuleNotFoundError - :no-typesetting: - - :c:var:`!PyExc_ModuleNotFoundError` * :exc:`ModuleNotFoundError` * * .. c:var:: PyObject *PyExc_NameError - :no-typesetting: - - :c:var:`!PyExc_NameError` * :exc:`NameError` * * .. c:var:: PyObject *PyExc_NotADirectoryError - :no-typesetting: - - :c:var:`!PyExc_NotADirectoryError` * :exc:`NotADirectoryError` * * .. c:var:: PyObject *PyExc_NotImplementedError - :no-typesetting: - - :c:var:`!PyExc_NotImplementedError` * :exc:`NotImplementedError` * * .. c:var:: PyObject *PyExc_OSError - :no-typesetting: - - :c:var:`!PyExc_OSError` * :exc:`OSError` * * .. c:var:: PyObject *PyExc_OverflowError - :no-typesetting: - - :c:var:`!PyExc_OverflowError` * :exc:`OverflowError` * * .. c:var:: PyObject *PyExc_PermissionError - :no-typesetting: - - :c:var:`!PyExc_PermissionError` * :exc:`PermissionError` * * .. c:var:: PyObject *PyExc_ProcessLookupError - :no-typesetting: - - :c:var:`!PyExc_ProcessLookupError` * :exc:`ProcessLookupError` * * .. c:var:: PyObject *PyExc_PythonFinalizationError - :no-typesetting: - - :c:var:`!PyExc_PythonFinalizationError` * :exc:`PythonFinalizationError` * * .. c:var:: PyObject *PyExc_RecursionError - :no-typesetting: - - :c:var:`!PyExc_RecursionError` * :exc:`RecursionError` * * .. c:var:: PyObject *PyExc_ReferenceError - :no-typesetting: - - :c:var:`!PyExc_ReferenceError` * :exc:`ReferenceError` * * .. c:var:: PyObject *PyExc_RuntimeError - :no-typesetting: - - :c:var:`!PyExc_RuntimeError` * :exc:`RuntimeError` * * .. c:var:: PyObject *PyExc_StopAsyncIteration - :no-typesetting: - - :c:var:`!PyExc_StopAsyncIteration` * :exc:`StopAsyncIteration` * * .. c:var:: PyObject *PyExc_StopIteration - :no-typesetting: - - :c:var:`!PyExc_StopIteration` * :exc:`StopIteration` * * .. c:var:: PyObject *PyExc_SyntaxError - :no-typesetting: - - :c:var:`!PyExc_SyntaxError` * :exc:`SyntaxError` * * .. c:var:: PyObject *PyExc_SystemError - :no-typesetting: - - :c:var:`!PyExc_SystemError` * :exc:`SystemError` * * .. c:var:: PyObject *PyExc_SystemExit - :no-typesetting: - - :c:var:`!PyExc_SystemExit` * :exc:`SystemExit` * * .. c:var:: PyObject *PyExc_TabError - :no-typesetting: - - :c:var:`!PyExc_TabError` * :exc:`TabError` * * .. c:var:: PyObject *PyExc_TimeoutError - :no-typesetting: - - :c:var:`!PyExc_TimeoutError` * :exc:`TimeoutError` * * .. c:var:: PyObject *PyExc_TypeError - :no-typesetting: - - :c:var:`!PyExc_TypeError` * :exc:`TypeError` * * .. c:var:: PyObject *PyExc_UnboundLocalError - :no-typesetting: - - :c:var:`!PyExc_UnboundLocalError` * :exc:`UnboundLocalError` * * .. c:var:: PyObject *PyExc_UnicodeDecodeError - :no-typesetting: - - :c:var:`!PyExc_UnicodeDecodeError` * :exc:`UnicodeDecodeError` * * .. c:var:: PyObject *PyExc_UnicodeEncodeError - :no-typesetting: - - :c:var:`!PyExc_UnicodeEncodeError` * :exc:`UnicodeEncodeError` * * .. c:var:: PyObject *PyExc_UnicodeError - :no-typesetting: - - :c:var:`!PyExc_UnicodeError` * :exc:`UnicodeError` * * .. c:var:: PyObject *PyExc_UnicodeTranslateError - :no-typesetting: - - :c:var:`!PyExc_UnicodeTranslateError` * :exc:`UnicodeTranslateError` * * .. c:var:: PyObject *PyExc_ValueError - :no-typesetting: - - :c:var:`!PyExc_ValueError` * :exc:`ValueError` * * .. c:var:: PyObject *PyExc_ZeroDivisionError - :no-typesetting: - - :c:var:`!PyExc_ZeroDivisionError` * :exc:`ZeroDivisionError` .. versionadded:: 3.3 @@ -1314,21 +1149,12 @@ The following are a compatibility aliases to :c:data:`PyExc_OSError`. * Python name * Notes * * .. c:var:: PyObject *PyExc_EnvironmentError - :no-typesetting: - - :c:var:`!PyExc_EnvironmentError` * :exc:`OSError` * * * .. c:var:: PyObject *PyExc_IOError - :no-typesetting: - - :c:var:`!PyExc_IOError` * :exc:`OSError` * * * .. c:var:: PyObject *PyExc_WindowsError - :no-typesetting: - - :c:var:`!PyExc_WindowsError` * :exc:`OSError` * [win]_ @@ -1352,64 +1178,28 @@ Warning types * * C name * Python name * * .. c:var:: PyObject *PyExc_Warning - :no-typesetting: - - :c:var:`!PyExc_Warning` * :exc:`Warning` * * .. c:var:: PyObject *PyExc_BytesWarning - :no-typesetting: - - :c:var:`!PyExc_BytesWarning` * :exc:`BytesWarning` * * .. c:var:: PyObject *PyExc_DeprecationWarning - :no-typesetting: - - :c:var:`!PyExc_DeprecationWarning` * :exc:`DeprecationWarning` * * .. c:var:: PyObject *PyExc_EncodingWarning - :no-typesetting: - - :c:var:`!PyExc_EncodingWarning` * :exc:`EncodingWarning` * * .. c:var:: PyObject *PyExc_FutureWarning - :no-typesetting: - - :c:var:`!PyExc_FutureWarning` * :exc:`FutureWarning` * * .. c:var:: PyObject *PyExc_ImportWarning - :no-typesetting: - - :c:var:`!PyExc_ImportWarning` * :exc:`ImportWarning` * * .. c:var:: PyObject *PyExc_PendingDeprecationWarning - :no-typesetting: - - :c:var:`!PyExc_PendingDeprecationWarning` * :exc:`PendingDeprecationWarning` * * .. c:var:: PyObject *PyExc_ResourceWarning - :no-typesetting: - - :c:var:`!PyExc_ResourceWarning` * :exc:`ResourceWarning` * * .. c:var:: PyObject *PyExc_RuntimeWarning - :no-typesetting: - - :c:var:`!PyExc_RuntimeWarning` * :exc:`RuntimeWarning` * * .. c:var:: PyObject *PyExc_SyntaxWarning - :no-typesetting: - - :c:var:`!PyExc_SyntaxWarning` * :exc:`SyntaxWarning` * * .. c:var:: PyObject *PyExc_UnicodeWarning - :no-typesetting: - - :c:var:`!PyExc_UnicodeWarning` * :exc:`UnicodeWarning` * * .. c:var:: PyObject *PyExc_UserWarning - :no-typesetting: - - :c:var:`!PyExc_UserWarning` * :exc:`UserWarning` .. versionadded:: 3.2