Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix function name shadowing #3022

Merged
merged 1 commit into from
Mar 23, 2023
Merged

Fix function name shadowing #3022

merged 1 commit into from
Mar 23, 2023

Conversation

mejrs
Copy link
Member

@mejrs mejrs commented Mar 7, 2023

Fixes #3017

@mejrs mejrs added the CI-skip-changelog Skip checking changelog entry label Mar 7, 2023
let associated_method = quote! {
unsafe fn #wrapper_ident(
#py: _pyo3::Python<'_>,
_raw_slf: *mut _pyo3::ffi::PyObject,
#(#arg_idents: #arg_types),*
) -> _pyo3::PyResult<#ret_ty> {
let function = #cls::#name;
Copy link
Member

Choose a reason for hiding this comment

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

Does this imply that fn function is now broken as a #[pymethod] instead? Maybe we need let _pyo3_function instead ?

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. I also recommend adding a comment describing why we are doing this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Does this imply that fn function is now broken as a #[pymethod] instead?

No, why would it? That works fine.

Agreed. I also recommend adding a comment describing why we are doing this.

Sure

Copy link
Member

Choose a reason for hiding this comment

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

Right I see, because the previous function binding would be correctly rebound by the let. Ignore me!

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

It might be nice to add a newsfragment for this? Otherwise lgtm, thanks!

@davidhewitt
Copy link
Member

@mejrs I've squashed and added a newsfragment. Hope that's ok.

bors r+

@davidhewitt davidhewitt removed the CI-skip-changelog Skip checking changelog entry label Mar 23, 2023
@bors
Copy link
Contributor

bors bot commented Mar 23, 2023

Build succeeded:

@bors bors bot merged commit e5e8c7a into PyO3:main Mar 23, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function named "output" with pyo3 signature attribute fails to compile
4 participants