Skip to content

Commit dabc06c

Browse files
authored
Merge pull request dgrunwald#191 from indygreg/python3-exceptions
Define Python 3 exceptions from PEP 3151
2 parents 76cc1ff + efb5229 commit dabc06c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/objects/exc.rs

+30
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,54 @@ exc_type!(StandardError, PyExc_StandardError);
7777
exc_type!(LookupError, PyExc_LookupError);
7878
exc_type!(AssertionError, PyExc_AssertionError);
7979
exc_type!(AttributeError, PyExc_AttributeError);
80+
#[cfg(feature="python3-sys")]
81+
exc_type!(BlockingIOError, PyExc_BlockingIOError);
82+
#[cfg(feature="python3-sys")]
83+
exc_type!(BrokenPipeError, PyExc_BrokenPipeError);
84+
#[cfg(feature="python3-sys")]
85+
exc_type!(ChildProcessError, PyExc_ChildProcessError);
86+
#[cfg(feature="python3-sys")]
87+
exc_type!(ConnectionAbortedError, PyExc_ConnectionAbortedError);
88+
#[cfg(feature="python3-sys")]
89+
exc_type!(ConnectionError, PyExc_ConnectionError);
90+
#[cfg(feature="python3-sys")]
91+
exc_type!(ConnectionRefusedError, PyExc_ConnectionRefusedError);
92+
#[cfg(feature="python3-sys")]
93+
exc_type!(ConnectionResetError, PyExc_ConnectionResetError);
8094
exc_type!(EOFError, PyExc_EOFError);
8195
exc_type!(EnvironmentError, PyExc_EnvironmentError);
96+
#[cfg(feature="python3-sys")]
97+
exc_type!(FileExistsError, PyExc_FileExistsError);
98+
#[cfg(feature="python3-sys")]
99+
exc_type!(FileNotFoundError, PyExc_FileNotFoundError);
82100
exc_type!(FloatingPointError, PyExc_FloatingPointError);
83101
exc_type!(IOError, PyExc_IOError);
84102
exc_type!(ImportError, PyExc_ImportError);
85103
exc_type!(IndexError, PyExc_IndexError);
104+
#[cfg(feature="python3-sys")]
105+
exc_type!(InterruptedError, PyExc_InterruptedError);
106+
#[cfg(feature="python3-sys")]
107+
exc_type!(IsADirectoryError, PyExc_IsADirectoryError);
86108
exc_type!(KeyError, PyExc_KeyError);
87109
exc_type!(KeyboardInterrupt, PyExc_KeyboardInterrupt);
88110
exc_type!(MemoryError, PyExc_MemoryError);
89111
exc_type!(NameError, PyExc_NameError);
112+
#[cfg(feature="python3-sys")]
113+
exc_type!(NotADirectoryError, PyExc_NotADirectoryError);
90114
exc_type!(NotImplementedError, PyExc_NotImplementedError);
91115
exc_type!(OSError, PyExc_OSError);
92116
exc_type!(OverflowError, PyExc_OverflowError);
117+
#[cfg(feature="python3-sys")]
118+
exc_type!(PermissionError, PyExc_PermissionError);
119+
#[cfg(feature="python3-sys")]
120+
exc_type!(ProcessLookupError, PyExc_ProcessLookupError);
93121
exc_type!(ReferenceError, PyExc_ReferenceError);
94122
exc_type!(RuntimeError, PyExc_RuntimeError);
95123
exc_type!(SyntaxError, PyExc_SyntaxError);
96124
exc_type!(SystemError, PyExc_SystemError);
97125
exc_type!(SystemExit, PyExc_SystemExit);
126+
#[cfg(feature="python3-sys")]
127+
exc_type!(TimeoutError, PyExc_TimeoutError);
98128
exc_type!(TypeError, PyExc_TypeError);
99129
exc_type!(ValueError, PyExc_ValueError);
100130
#[cfg(target_os="windows")]

0 commit comments

Comments
 (0)