From 0b9452b0b0d2c1b908b11e2bc479dc3acd52834f Mon Sep 17 00:00:00 2001 From: Konstantin Gukov Date: Wed, 2 Dec 2020 21:44:23 +0100 Subject: [PATCH] Version 1.2.0 Upgraded PyO3 and chrono to the latest versions. --- Cargo.toml | 6 +++--- setup.py | 2 +- src/lib.rs | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c038b1e..22f0428 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] authors = ["Konstantin Gukov "] name = "python-dtparse" -version = "1.0.0" +version = "1.2.0" [dependencies] -pyo3 = "0.11.1" -chrono = "0.4.13" +pyo3 = "0.12.4" +chrono = "0.4.19" [lib] name = "dtparse" diff --git a/setup.py b/setup.py index 9877bab..275be6b 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ def run(self): setup( name='dtparse', - version='1.1.1', + version='1.2.0', classifiers=[ 'License :: OSI Approved :: MIT License', 'Development Status :: 3 - Alpha', diff --git a/src/lib.rs b/src/lib.rs index 9446a1c..9e40896 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,11 +3,11 @@ extern crate pyo3; extern crate chrono; use chrono::prelude::*; -use pyo3::exceptions; +use pyo3::exceptions::*; use pyo3::prelude::*; use pyo3::types::*; -// https://pyo3.rs/v0.11.1/module.html +// https://pyo3.rs/v0.12.4/module.html // This macro makes Rust compile a _dtparse.so binary in Python-compatible format. // Such a binary can be imported from Python just like a regular Python module. #[pymodule(_dtparse)] @@ -20,11 +20,11 @@ fn init_mod(_py: Python, m: &PyModule) -> PyResult<()> { let chrono_dt = Utc.datetime_from_str(str_datetime.as_str(), fmt.as_str()); // In case chrono couldn't parse a datetime, raise a ValueError with chrono's error message. - // Because there are no exceptions in Rust, we return a ValueError instance here. + // Because there are no exceptions in Rust, we return a PyValueError instance here. // By convention, it will make PyO3 wrapper raise an exception in Python interpreter. - // https://pyo3.rs/v0.11.1/exception.html + // https://pyo3.rs/v0.12.4/exception.html if chrono_dt.is_err() { - return Err(exceptions::ValueError::py_err( + return Err(PyValueError::new_err( chrono_dt.err().unwrap().to_string().to_owned(), )); }