Skip to content
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

Breaking change handling Chrono Tz in 0.23.4 #4909

Open
kylebarron opened this issue Feb 13, 2025 · 0 comments
Open

Breaking change handling Chrono Tz in 0.23.4 #4909

kylebarron opened this issue Feb 13, 2025 · 0 comments
Labels

Comments

@kylebarron
Copy link
Contributor

kylebarron commented Feb 13, 2025

Bug Description

This code compiles fine in 0.23.3 but fails to compile in 0.23.4.

`Option<chrono::datetime::DateTime<Tz>>` cannot be converted to a Python object
the following trait bounds were not satisfied:
`Option<chrono::datetime::DateTime<Tz>>: pyo3::IntoPyObject<'_>`
which is required by `Option<chrono::datetime::DateTime<Tz>>: IntoPyObjectExt<'_>`
`&Option<chrono::datetime::DateTime<Tz>>: pyo3::IntoPyObject<'_>`
which is required by `&Option<chrono::datetime::DateTime<Tz>>: IntoPyObjectExt<'_>`
`&mut Option<chrono::datetime::DateTime<Tz>>: pyo3::IntoPyObject<'_>`
which is required by `&mut Option<chrono::datetime::DateTime<Tz>>: IntoPyObjectExt<'_>`
`IntoPyObject` is automatically implemented by the `#[pyclass]` macro
if you do not wish to have a corresponding Python type, implement it manually
if you do not own `Option<chrono::datetime::DateTime<Tz>>` you can perform a manual conversion to one of the types in `pyo3::types::*`

This is an Option<DateTime<Tz>>

This seems to be related to #3266, #4790 (cc @bschoenmaeckers)

Steps to Reproduce

Simplified, this code:

use arrow_array::timezone::Tz;
use chrono::DateTime;
use pyo3::prelude::*;
use pyo3::IntoPyObjectExt;

fn datetime_to_pyobject(py: Python, dt: DateTime<Tz>) -> PyResult<PyObject> {
    dt.into_py_any(py)
}

compiles in 0.23.3 but does not compile in 0.23.4.

Backtrace

Your operating system and version

MacOS 15.3

Your Python version (python --version)

3.11

Your Rust version (rustc --version)

rustc 1.84.0 (9fc6b4312 2025-01-07)

Your PyO3 version

0.23.3/0.23.4

How did you install python? Did you use a virtualenv?

From uv.

Additional Info

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant