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

#[pyclass] enums do not retain identity when converted from Rust to Python #3117

Closed
alex opened this issue Apr 23, 2023 · 2 comments
Closed

Comments

@alex
Copy link
Contributor

alex commented Apr 23, 2023

Simple reproducer:

#[pyo3::prelude::pyclass]
enum Foo {
    E1,
    E2,
}

#[pyo3::prelude::pyfunction
pub fn get_foo() -> Foo {
    Foo::E1
}

if you wire this up, and call it from Python, you'll find that get_foo() is get_foo() is False.

It would be useful if these always had the same identity, as this would more closely mirror the pure python enum module's behavior.

@adamreichold
Copy link
Member

Is this possibly a duplicate of #3059? (With the resolution #3061 being underway.)

@alex
Copy link
Contributor Author

alex commented Apr 23, 2023

Yuuuup. Sorry about the news. Apparently 9am is too early for me to know how to search.

@alex alex closed this as completed Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants