From c60dcc844a61ba8788c4b5248cacc59395abaf07 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Sat, 16 Sep 2023 19:39:38 -0700 Subject: [PATCH] chore: relax chrono pin to 0.4 --- Cargo.toml | 2 +- python/src/filesystem.rs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) 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(),