Skip to content

BUG: NDFrame.__setattr__ calls object.__setattribute__ on the same name, which can cause unexpected behavior #56794

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

Closed
wants to merge 9 commits into from

Conversation

dhodcz2
Copy link

@dhodcz2 dhodcz2 commented Jan 9, 2024

@dhodcz2 dhodcz2 changed the title Setattr BUG: NDFrame.__setattr__ calls NDFrame.__getattr__ on the same name, which can cause unexpected behavior Jan 9, 2024
@dhodcz2 dhodcz2 changed the title BUG: NDFrame.__setattr__ calls NDFrame.__getattr__ on the same name, which can cause unexpected behavior BUG: NDFrame.__setattr__ calls object.__setattribute__ on the same name, which can cause unexpected behavior Jan 9, 2024
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

As mentioned in the issue, the use case for subclassing pandas objects where a given attribute may be doing computation when accessed makes sense to avoid. I also like less try-excepts here. That said - this also appears to me it might make the code more fragile. An update to __getattribute__ not mirrored here could break things.

But overall still positive here. cc @phofl

Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Mar 29, 2024
@mroeschke
Copy link
Member

Thanks for the PR but it has appears to gone stale. Additionally, this probably needs more discussion on the issue regarding the fix so closing until that discussion has resolved

@mroeschke mroeschke closed this Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: NDFrame.__setattr__ calls object.__setattribute__ on the same name, which can cause unexpected behavior (rewrote #56773)
4 participants