Skip to content

Commit 510018c

Browse files
committed
split the wheel for cp38
1 parent 3594a05 commit 510018c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

bindings/python/src/types.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
use std::sync::Arc;
1616

1717
use chrono::offset::Offset;
18-
use chrono::{DateTime, Duration, NaiveDate};
19-
#[cfg(not(Py_3_9))]
18+
#[cfg(feature = "cp38")]
2019
use chrono::FixedOffset;
20+
use chrono::{DateTime, Duration, NaiveDate};
2121
use chrono_tz::Tz;
2222
use once_cell::sync::Lazy;
2323
use pyo3::exceptions::{PyAttributeError, PyException, PyStopAsyncIteration, PyStopIteration};
@@ -81,15 +81,14 @@ impl<'py> IntoPyObject<'py> for Value {
8181
let t = DateTime::<Tz>::try_from(self.0).map_err(|e| {
8282
PyException::new_err(format!("failed to convert timestamp: {e}"))
8383
})?;
84-
#[cfg(Py_3_9)]
84+
#[cfg(feature = "cp38")]
8585
{
86+
// chrono_tz -> PyDateTime isn't implemented for Python < 3.9 (no zoneinfo).
87+
let t: DateTime<FixedOffset> = t.with_timezone(&t.offset().fix());
8688
t.into_bound_py_any(py)?
8789
}
88-
#[cfg(not(Py_3_9))]
90+
#[cfg(not(feature = "cp38"))]
8991
{
90-
// impl of IntoPyObject for chrono_tz::Tz is gated by #![cfg(all(Py_3_9, feature = "chrono-tz"))]
91-
// Convert to a fixed-offset datetime so it works on Python < 3.9 (no zoneinfo).
92-
let t: DateTime<FixedOffset> = t.with_timezone(&t.offset().fix());
9392
t.into_bound_py_any(py)?
9493
}
9594
}

0 commit comments

Comments
 (0)