标准异常
All standard Python exceptions are available as global variables whose names are PyExc_
followed by the Python exception name. These have the type PyObject*
; they are all class objects. For completeness, here are all the variables:
C 名称 | Python 名称 | 注释 |
---|---|---|
| (1) | |
| (1) | |
| (1) | |
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| (1) | |
| ||
| ||
| ||
| ||
| ||
| (1) | |
| ||
| ||
| ||
| ||
| (2) | |
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
|
3.3 新版功能: PyExc_BlockingIOError
, PyExc_BrokenPipeError
, PyExc_ChildProcessError
, PyExc_ConnectionError
, PyExc_ConnectionAbortedError
, PyExc_ConnectionRefusedError
, PyExc_ConnectionResetError
, PyExc_FileExistsError
, PyExc_FileNotFoundError
, PyExc_InterruptedError
, PyExc_IsADirectoryError
, PyExc_NotADirectoryError
, PyExc_PermissionError
, PyExc_ProcessLookupError
and PyExc_TimeoutError
介绍如下 PEP 3151.
3.5 新版功能: PyExc_StopAsyncIteration
和 PyExc_RecursionError
.
3.6 新版功能: PyExc_ModuleNotFoundError
.
这些是兼容性别名 PyExc_OSError
:
C 名称 | 注释 |
---|---|
| |
| |
| (3) |
在 3.3 版更改: 这些别名曾经是单独的异常类型。
注释:
这是其他标准异常的基类。
Only defined on Windows; protect code that uses this by testing that the preprocessor macro
MS_WINDOWS
is defined.