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

Fix ambiguous associated item error #4725

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LilyFoote
Copy link
Contributor

Fixes #4723.

The `#[pyclass]` macro implements `IntoPyObject` for the annotated enum.
When the enum has any of `Error`, `Output` or `Target` as members, this
clashes with the associated types of `IntoPyObject`.
@LilyFoote LilyFoote added bugfix rust Pull requests that update Rust code labels Nov 21, 2024
@LilyFoote LilyFoote self-assigned this Nov 21, 2024
Copy link
Contributor

@alex alex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incredible

Copy link
Contributor

@Icxolu Icxolu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! So many edge cases to look out for 😅

pyo3-macros-backend/src/pyclass.rs Outdated Show resolved Hide resolved
Output,
Target,
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is possibly a similar case for #[derive(IntoPyObject)], should probably add this as a second test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, there is the same problem for IntoPyObject/IntoPyObjectRef😢

@LilyFoote LilyFoote force-pushed the fix-ambiguous-associated-item-error branch from 8aaabb2 to a858c2e Compare November 22, 2024 07:56
@LilyFoote LilyFoote force-pushed the fix-ambiguous-associated-item-error branch from a858c2e to d7d5b54 Compare November 22, 2024 08:01
@davidhewitt davidhewitt mentioned this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ambiguous associated item 'Error' since 0.23
4 participants