Skip to content

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

Merged
Pierre-Sassoulas merged 1 commit intopylint-dev:masterfrom
cdce8p:fix-no-member-typed_annotation
Mar 6, 2021
Merged

Fix false-positive no-member for typed annotations without default value#4194
Pierre-Sassoulas merged 1 commit intopylint-dev:masterfrom
cdce8p:fix-no-member-typed_annotation

Conversation

@cdce8p
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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