Skip to content

Commit

Permalink
fixup chrono_tz conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Mar 8, 2024
1 parent 263fc02 commit 4dad333
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/conversions/chrono_tz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
//! }
//! ```
use crate::exceptions::PyValueError;
use crate::pybacked::PyBackedStr;
use crate::sync::GILOnceCell;
use crate::types::{any::PyAnyMethods, PyType};
use crate::{
Expand Down Expand Up @@ -62,8 +63,11 @@ impl IntoPy<PyObject> for Tz {

impl FromPyObject<'_> for Tz {
fn extract_bound(ob: &Bound<'_, PyAny>) -> PyResult<Tz> {
Tz::from_str(ob.getattr(intern!(ob.py(), "key"))?.extract()?)
.map_err(|e| PyValueError::new_err(e.to_string()))
Tz::from_str(
&ob.getattr(intern!(ob.py(), "key"))?
.extract::<PyBackedStr>()?,
)
.map_err(|e| PyValueError::new_err(e.to_string()))
}
}

Expand Down

0 comments on commit 4dad333

Please sign in to comment.