Skip to content

Commit 446bace

Browse files
committed
Remove handling for python3.5 datetime implementation
1 parent 3b7a82f commit 446bace

2 files changed

Lines changed: 1 addition & 9 deletions

File tree

src/datetime.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ macro_rules! write_microsecond {
4141
}
4242

4343
pub enum DatetimeError {
44-
Offset,
4544
Library,
4645
}
4746

@@ -69,13 +68,9 @@ pub fn write_datetime(
6968
std::ptr::null_mut() as *mut pyo3::ffi::PyObject,
7069
)
7170
};
72-
// test_datetime_partial_second_pendulum_not_supported
73-
if offset.is_null() {
74-
return Err(DatetimeError::Offset);
75-
}
7671
offset_second = ffi!(PyDateTime_DELTA_GET_SECONDS(offset)) as i32;
7772
offset_day = ffi!(PyDateTime_DELTA_GET_DAYS(offset));
78-
} else if unsafe { pyo3::ffi::PyObject_HasAttr(tzinfo, NORMALIZE_METHOD_STR) == 1 } {
73+
} else if ffi!(PyObject_HasAttr(tzinfo, NORMALIZE_METHOD_STR)) == 1 {
7974
// pytz
8075
let offset = unsafe {
8176
pyo3::ffi::PyObject_CallMethodObjArgs(

src/encode.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,6 @@ impl<'p> Serialize for SerializePyObject {
171171
let mut dt: SmallVec<[u8; 32]> = SmallVec::with_capacity(32);
172172
match write_datetime(self.ptr, self.opts, &mut dt) {
173173
Ok(_) => serializer.serialize_str(str_from_slice!(dt.as_ptr(), dt.len())),
174-
Err(DatetimeError::Offset) => {
175-
err!("datetime does not support timezones with offsets that are not even minutes")
176-
}
177174
Err(DatetimeError::Library) => {
178175
err!("datetime's timezone library is not supported: use datetime.timezone.utc, pendulum, pytz, or dateutil")
179176
}

0 commit comments

Comments
 (0)