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

pyfunction: fix compile error for Option<&T> argument with a default #2630

Merged
merged 1 commit into from Sep 21, 2022

Conversation

davidhewitt
Copy link
Member

This fixes an edge case broken by #2503 which was lacking a test case.

The problematic code is Option<&T> argument to a #[pyfunction] where the argument has a default set via attribute, e.g.

#[pyfunction(arg = "None")]
fn foo(arg: Option<&SomePyClass>) { /* ... */ }

Noticed this in huggingface/tokenizers#1066

@davidhewitt davidhewitt merged commit a0be791 into PyO3:main Sep 21, 2022
@davidhewitt davidhewitt deleted the option-pyclass-arg branch September 21, 2022 09:44
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

Successfully merging this pull request may close these issues.

None yet

1 participant