-
-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow PyO3 0.20.x #802
Allow PyO3 0.20.x #802
Conversation
Please rebase your changes with master to fix the pipeline |
7472a2c
to
c2a1721
Compare
Done, and |
For PyO3 0.21, it’s necessary to deal with the new I started to attempt a PyO3 0.21 port with diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 46b00c5..31f55dc 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -14,7 +14,7 @@ strip = true
overflow-checks = false
[dependencies]
-pyo3 = { version = ">= 0.19, < 0.21", features = ["extension-module", "generate-import-lib"] }
+pyo3 = { version = "0.22", features = ["extension-module", "generate-import-lib"] }
mimalloc = { version = "0.1.39", optional = true, default-features = false }
[features]
diff --git a/rust/src/python/helpers.rs b/rust/src/python/helpers.rs
index 4a53e59..3d08da4 100644
--- a/rust/src/python/helpers.rs
+++ b/rust/src/python/helpers.rs
@@ -74,10 +74,10 @@ impl PartialOrd for DateTimeInfo<'_> {
}
}
-pub fn get_tz_name<'py>(py: Python, dt: &'py PyAny) -> PyResult<&'py str> {
+pub fn get_tz_name<'py>(py: Python, dt: Bound<'py, PyAny>) -> PyResult<&'py str> {
let tz: &str = "";
- if !PyDateTime::is_type_of(dt) {
+ if !PyDateTime::is_type_of_bound(&dt) {
return Ok(tz);
}
@@ -169,7 +169,7 @@ pub fn local_time(
}
#[pyfunction]
-pub fn precise_diff<'py>(py: Python, dt1: &'py PyAny, dt2: &'py PyAny) -> PyResult<PreciseDiff> {
+pub fn precise_diff<'py>(py: Python, dt1: Bound<'py, PyAny>, dt2: Bound<'py, PyAny>) -> PyResult<PreciseDiff> {
let mut sign = 1;
let mut dtinfo1 = DateTimeInfo {
year: dt1.downcast::<PyDate>()?.get_year(),
diff --git a/rust/src/python/types/timezone.rs b/rust/src/python/types/timezone.rs
index 1a8bbad..7c6c289 100644
--- a/rust/src/python/types/timezone.rs
+++ b/rust/src/python/types/timezone.rs
@@ -10,6 +10,7 @@ pub struct FixedTimezone {
#[pymethods]
impl FixedTimezone {
+ #[pyo3(signature = (offset, name=None))]
#[new]
pub fn new(offset: i32, name: Option<String>) -> Self {
Self { offset, name } but quite a few further changes are needed, starting with
which is obviously related to the same API changes, but which my Rust experience is not adequate to immediately understand, and which I don’t have time to dig into right now. Still, migrating to a current PyO3 version that supports Python 3.13 would be a great idea, and I imagine you will have less trouble dealing with the API changes than I do. |
CodSpeed Performance ReportMerging #802 will not alter performanceComparing Summary
|
We have jumped straight to |
Pull Request Check List
I need to use the current release of
PyO3
0.20.x to update thepython-pendulum
package to 3.0.0 in Fedora Linux, and based on PyO3 release notes and on testing, there’s no reason upstream can’t allow a current version too.