stdlib/io.rs: align negative-fd-from-opener exception with CPython

This commit is contained in:
Daniel Watkins
2021-10-28 15:05:55 -04:00
parent 35e56efa65
commit 1ea93a59d5
2 changed files with 1 additions and 5 deletions

View File

@@ -3857,7 +3857,7 @@ mod fileio {
}
let fd = i32::try_from_object(vm, fd)?;
if fd < 0 {
return Err(vm.new_os_error("Negative file descriptor".to_owned()));
return Err(vm.new_value_error(format!("opener returned {}", fd)));
}
fd
} else if let Some(i) = name.payload::<crate::builtins::PyInt>() {