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

Fixed value check in property assignment #234

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

HalfWhitt
Copy link
Contributor

Prior to the dataclass restructuring, property assignment checked against getattr(self, "_%s" % name, initial) to see if a change had occurred and the property would need to be applied. I overlooked this and used None as the default instead of initial.

This didn't really make anything work incorrectly; however, a previously unassigned property being assigned a value equal to its initial value then triggers an unnecessary apply.

I've reverted it to getattr(obj, f"_{self.name}", self.initial).

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

Good catch - thanks for the fix!

@freakboy3742 freakboy3742 merged commit 6be60da into beeware:main Nov 13, 2024
9 checks passed
@Mummy-excellet

This comment was marked as spam.

@HalfWhitt HalfWhitt deleted the fix-apply-check branch November 14, 2024 04:49
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.

3 participants