Skip to content

fix deprecation warning for trailing optional on #[setter] functions - #4304

Merged
davidhewitt merged 2 commits into
PyO3:mainfrom
davidhewitt:setter-optional
Jul 4, 2024
Merged

davidhewitt merged 2 commits into
PyO3:mainfrom
davidhewitt:setter-optional

Conversation

@davidhewitt

Copy link
Copy Markdown
Member

Fixes #4292

Basically just don't emit the warning for setter or getter functions, and adds a test.

}
}

pub fn signature_attribute_allowed(&self) -> bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it'd be helpful for future us to add a comment explaining why (getter/setter/classattr have fixed signatures with a single arg where Option<> has a specific meaning)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good idea, added one, WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks

@davidhewitt
davidhewitt added this pull request to the merge queue Jul 4, 2024
Merged via the queue into PyO3:main with commit 0af0227 Jul 4, 2024
@davidhewitt
davidhewitt deleted the setter-optional branch July 4, 2024 10:54
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.

'Deprecation of implicit default for trailing optional arguments' Causing issues with erasable setters

2 participants