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 false-positive no-member for typed annotations without default value #4194

Merged
merged 1 commit into from
Mar 6, 2021
Merged

Fix false-positive no-member for typed annotations without default value #4194

merged 1 commit into from
Mar 6, 2021

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Mar 5, 2021

Steps

  • Add yourself to CONTRIBUTORS if you are a new contributor.
  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature or an important bug fix, add a What's New entry in doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Description

Fix false-positive no-member for typed annotations without default value.

class A:
    myfield: int

class B(A):
    pass

a = A()
print(a.myfield)

b = B()
print(b.myfield)  # No longer emits `no-member` warning 

Type of Changes

Type
🐛 Bug fix

Related Issue

Closes #3167

@coveralls
Copy link

coveralls commented Mar 5, 2021

Coverage Status

Coverage increased (+0.005%) to 91.486% when pulling df0573f on cdce8p:fix-no-member-typed_annotation into a7d37d2 on PyCQA:master.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

Nice false positive eliminated here !

@cdce8p
Copy link
Member Author

cdce8p commented Mar 6, 2021

From what I've read, this fix alone is probably enough for the 2.7.3 release 😅

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.7.3 milestone Mar 6, 2021
@Pierre-Sassoulas Pierre-Sassoulas added the False Positive 🦟 A message is emitted but nothing is wrong with the code label Mar 6, 2021
@Pierre-Sassoulas
Copy link
Member

I'm thinking about releasing tomorrow night, a lot of things can happens during the week-end :)

@Pierre-Sassoulas Pierre-Sassoulas merged commit 803a252 into pylint-dev:master Mar 6, 2021
@cdce8p
Copy link
Member Author

cdce8p commented Mar 6, 2021

@Pierre-Sassoulas Sounds good. This is probably worth checking out as well: pylint-dev/astroid#919

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False no-member positive on defaultless instance variables on subclasses
3 participants