File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed
Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 1+ Map ` io::ErrorKind::IsADirectory ` /` NotADirectory ` to the corresponding Python exception on Rust 1.83+
Original file line number Diff line number Diff line change @@ -156,6 +156,10 @@ pub fn print_feature_cfgs() {
156156 if rustc_minor_version >= 79 {
157157 println ! ( "cargo:rustc-cfg=diagnostic_namespace" ) ;
158158 }
159+
160+ if rustc_minor_version >= 83 {
161+ println ! ( "cargo:rustc-cfg=io_error_more" ) ;
162+ }
159163}
160164
161165/// Registers `pyo3`s config names as reachable cfg expressions
@@ -180,6 +184,7 @@ pub fn print_expected_cfgs() {
180184 println ! ( "cargo:rustc-check-cfg=cfg(diagnostic_namespace)" ) ;
181185 println ! ( "cargo:rustc-check-cfg=cfg(c_str_lit)" ) ;
182186 println ! ( "cargo:rustc-check-cfg=cfg(rustc_has_once_lock)" ) ;
187+ println ! ( "cargo:rustc-check-cfg=cfg(io_error_more)" ) ;
183188
184189 // allow `Py_3_*` cfgs from the minimum supported version up to the
185190 // maximum minor version (+1 for development for the next)
Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ impl From<io::Error> for PyErr {
5454 io:: ErrorKind :: AlreadyExists => exceptions:: PyFileExistsError :: new_err ( err) ,
5555 io:: ErrorKind :: WouldBlock => exceptions:: PyBlockingIOError :: new_err ( err) ,
5656 io:: ErrorKind :: TimedOut => exceptions:: PyTimeoutError :: new_err ( err) ,
57+ #[ cfg( io_error_more) ]
58+ io:: ErrorKind :: IsADirectory => exceptions:: PyIsADirectoryError :: new_err ( err) ,
59+ #[ cfg( io_error_more) ]
60+ io:: ErrorKind :: NotADirectory => exceptions:: PyNotADirectoryError :: new_err ( err) ,
5761 _ => exceptions:: PyOSError :: new_err ( err) ,
5862 }
5963 }
You can’t perform that action at this time.
0 commit comments