diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index 0e1b9397a..4361500e2 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -475,13 +475,6 @@ mod _os { Ok(vm.ctx.new_int(written as u64)) } - #[pyfunction] - fn error(message: OptionalArg, vm: &VirtualMachine) -> PyResult { - let msg = message.map_or("".to_owned(), |msg| msg.borrow_value().to_owned()); - - Err(vm.new_os_error(msg)) - } - #[pyfunction] fn fsync(fd: i64, vm: &VirtualMachine) -> PyResult<()> { let file = rust_file(fd); @@ -1414,6 +1407,7 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef { "supports_fd" => supports_fd.into_object(), "supports_dir_fd" => supports_dir_fd.into_object(), "supports_follow_symlinks" => supports_follow_symlinks.into_object(), + "error" => vm.ctx.exceptions.os_error.clone(), }); module