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

False positive unused-private-member when using __new__ #4668

Closed
larme opened this issue Jul 4, 2021 · 1 comment · Fixed by #4708
Closed

False positive unused-private-member when using __new__ #4668

larme opened this issue Jul 4, 2021 · 1 comment · Fixed by #4708
Assignees
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code
Milestone

Comments

@larme
Copy link

larme commented Jul 4, 2021

This may relate to #4657

Steps to reproduce

Given a file sample2.py:

class UnusedPrivateMember:
    """unused-private-member (W0238)"""

    def __new__(cls, func, *args):
        obj = super(UnusedPrivateMember, cls).__new__(cls)
        obj.func = func
        obj.__args = args
        return obj

    def exec(self):
        return self.func(*self.__args)

Current behavior

Result of pylint sample2.py:

************* Module sample2
sample2.py:7:8: W0238: Unused private member `UnusedPrivateMember.__args` (unused-private-member)

Expected behavior

I would expect no unused-private-member warning

pylint --version output

Result of pylint --version output:

pylint 3.0.0-a4
astroid 2.6.2
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0]
@Pierre-Sassoulas Pierre-Sassoulas added the False Positive 🦟 A message is emitted but nothing is wrong with the code label Jul 4, 2021
@yushao2
Copy link
Collaborator

yushao2 commented Jul 4, 2021

I'll look into this over the course of next week

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 a pull request may close this issue.

3 participants