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

Fix inference of instance attributes defined in base class #933

Merged
merged 2 commits into from
May 12, 2021

Conversation

nelfin
Copy link
Contributor

@nelfin nelfin commented Apr 7, 2021

Steps

  • For new features or bug fixes, add a ChangeLog entry describing what your PR does.
  • Write a good description on what the PR does.

Description

Ref #932. The cause of this appears to be failing to specify the
lookupname on the inference context in BaseInstance.igetattr.
Additionally, the context path key was not set in a manner that matched
other usages. This appears to date back to at least 2015 when context
path keys were changed. The usage as a tuple instead of a node with
implict lookupname was changed last in 3d342e8 but the lookup key was
preserved throughout various changes since then.

Type of Changes

Type
🐛 Bug fix

Related Issue

Closes #932

@nelfin nelfin force-pushed the fix/932-fix-subclass-instance-attrs branch 2 times, most recently from d246698 to 90c42f3 Compare April 8, 2021 23:41
@cdce8p
Copy link
Member

cdce8p commented May 11, 2021

@nelfin Would you mind resolving the merge conflicts? This PR seems like one I can review within the next few days.

@nelfin nelfin force-pushed the fix/932-fix-subclass-instance-attrs branch from 90c42f3 to 42530a8 Compare May 12, 2021 08:22
Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

The change itself LGTM. Just some minor comments regarding the tests.

@cdce8p cdce8p self-assigned this May 12, 2021
nelfin added 2 commits May 13, 2021 07:46
Ref pylint-dev#932. The cause of this appears to be failing to specify the
lookupname on the inference context in BaseInstance.igetattr.
Additionally, the context path key was not set in a manner that matched
other usages. This appears to date back to at least 2015 when context
path keys were changed. The usage as a tuple instead of a node with
implict lookupname was changed last in 3d342e8 but the lookup key was
preserved throughout various changes since then.
@nelfin nelfin force-pushed the fix/932-fix-subclass-instance-attrs branch from 42530a8 to 97d33ad Compare May 12, 2021 21:46
Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

Thanks 🐬

@cdce8p cdce8p merged commit d197581 into pylint-dev:master May 12, 2021
@nelfin
Copy link
Contributor Author

nelfin commented May 12, 2021

I know there's no perfect way to manage pull requests on GitHub, but I don't like how it disregarded all of the commit message and instead tells people to refer to this PR link. I'd rather that those messages stayed in the history.

@cdce8p
Copy link
Member

cdce8p commented May 12, 2021

I know there's no perfect way to manage pull requests on GitHub, but I don't like how it disregarded all of the commit message and instead tells people to refer to this PR link. I'd rather that those messages stayed in the history.

Not completely sure about that. Up until now, when I merged something I decided on the go what made sense to keep. For this one, as it's just a small bugfix, I chose to remove it. I almost never look at a commit message outside of Github history where the PR is also available so I'm not the best one to judge. If you like, I can try to keep yours if I happen to merge any other of your PRs.

@nelfin
Copy link
Contributor Author

nelfin commented May 12, 2021

Not completely sure about that. Up until now, when I merged something I decided on the go what made sense to keep. For this one, as it's just a small bugfix, I chose to remove it.

That's fine, it's not likely to cause too much confusion. To me, the real value in a small bugfix is not the lines itself, but the explanation as to why things broke.

I almost never look at a commit message outside of Github history where the PR is also available so I'm not the best one to judge.

This repository is actually older than GitHub itself so it's probably prudent to keep a "backup".

If you like, I can try to keep yours if I happen to merge any other of your PRs.

If it's not too much trouble.

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.

Instance attributes defined in parent classes can raise InferenceError
2 participants