diff --git a/Cargo.toml b/Cargo.toml index 85de7c3033..63a17924bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ serde_json = "1" # "stdlib" bytes = { version = "1" } -chrono = { version = "=0.4.30", default-features = false, features = ["clock"] } +chrono = { version = "0.4", default-features = false, features = ["clock"] } regex = { version = "1" } thiserror = { version = "1" } url = { version = "2" } diff --git a/python/src/filesystem.rs b/python/src/filesystem.rs index d6a2d1dcb2..1502a1a877 100644 --- a/python/src/filesystem.rs +++ b/python/src/filesystem.rs @@ -125,7 +125,12 @@ impl DeltaFileSystemHandler { Ok(meta) => { let kwargs = HashMap::from([ ("size", meta.size as i64), - ("mtime_ns", meta.last_modified.timestamp_nanos()), + ( + "mtime_ns", + meta.last_modified.timestamp_nanos_opt().ok_or( + PyValueError::new_err("last modified datetime out of range"), + )?, + ), ]); infos.push(to_file_info( meta.location.as_ref(), @@ -212,7 +217,12 @@ impl DeltaFileSystemHandler { .map(|meta| { let kwargs = HashMap::from([ ("size", meta.size as i64), - ("mtime_ns", meta.last_modified.timestamp_nanos()), + ( + "mtime_ns", + meta.last_modified.timestamp_nanos_opt().ok_or( + PyValueError::new_err("last modified datetime out of range"), + )?, + ), ]); to_file_info( meta.location.to_string(),