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 crash for unused-private-member when there are nested attributes #4783

Merged

Conversation

yushao2
Copy link
Collaborator

@yushao2 yushao2 commented Aug 1, 2021

Type of Changes

Type
βœ“ πŸ› Bug fix
βœ“ πŸ“„ Documentation

Description

Added logic to prevent checking attributes of attributes, and only check for the first level of attributes.

Closes #4755

@yushao2 yushao2 added this to the 2.10.1 milestone Aug 1, 2021
@yushao2 yushao2 self-assigned this Aug 1, 2021
@coveralls
Copy link

coveralls commented Aug 1, 2021

Coverage Status

Coverage remained the same at 92.269% when pulling 4a9d981 on yushao2:fix-unused-private-member-4755 into 7c51580 on PyCQA:main.

@yushao2 yushao2 force-pushed the fix-unused-private-member-4755 branch from 42d1c2a to 49c4bba Compare August 1, 2021 12:20
@cdce8p cdce8p assigned cdce8p and unassigned yushao2 Aug 1, 2021
ChangeLog Outdated Show resolved Hide resolved
pylint/checkers/classes.py Show resolved Hide resolved
@@ -201,3 +201,19 @@ def __inner_4(): # [unused-private-member]

fn_to_return = __inner_1 if flag else __inner_3(__inner_2)
return fn_to_return


# Test cases for crash reported in #4755
Copy link
Member

Choose a reason for hiding this comment

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

That line is more or less obvious from the Github link below. Better to write a short description here. Something like

# https://github.com/PyCQA/pylint/issues/4755
# Nested attributes shouldn't cause crash

(I would also reverse the order and put the link first.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed this, also added a few overlooked testcases and fixed docs for some of the other test cases i've worked on.

I realise that this might bloat up this PR a little, and I'm sorry for that.

Hope it's okay πŸ™

Copy link
Member

Choose a reason for hiding this comment

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

πŸ‘ŒπŸ»

add additional test cases and docs for existing tests
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.

🐬 Looks good as well!

@Pierre-Sassoulas Pierre-Sassoulas added Bug πŸͺ² Crash πŸ’₯ A bug that makes pylint crash labels Aug 1, 2021
@Pierre-Sassoulas Pierre-Sassoulas merged commit e7b71cf into pylint-dev:main Aug 1, 2021
@yushao2 yushao2 deleted the fix-unused-private-member-4755 branch January 4, 2023 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug πŸͺ² Crash πŸ’₯ A bug that makes pylint crash
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new unused-private-member causes a crash
4 participants