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

Missed detection of undefined variable inside class #1555

Closed
sdfgeoff opened this issue Jun 25, 2017 · 1 comment · Fixed by #5544
Closed

Missed detection of undefined variable inside class #1555

sdfgeoff opened this issue Jun 25, 2017 · 1 comment · Fixed by #5544
Labels
Bug 🪲 C: undefined-variable Issues related to 'undefined-variable' check
Milestone

Comments

@sdfgeoff
Copy link

sdfgeoff commented Jun 25, 2017

Steps to reproduce

Run pylint on the following:

class SomeClass():
    '''This class does nothing'''
    def __init__(self):
        self.val = self.val

Current behavior

No errors are thrown

Expected behavior

It should warn that self.val is undefined.
Note that it works correctly inside functions and at module level.

pylint --version output

pylint 1.7.1,
astroid 1.5.3
Python 3.6.1 (default, Mar 27 2017, 00:27:06)
[GCC 6.3.1 20170306]

@sdfgeoff sdfgeoff changed the title Missed detection of undefined variable Missed detection of undefined variable inside class Jun 25, 2017
@PCManticore
Copy link
Contributor

Thanks, I can reproduce this.

@DanielNoord DanielNoord added the C: undefined-variable Issues related to 'undefined-variable' check label Nov 18, 2021
jacobtylerwalls added a commit to jacobtylerwalls/pylint that referenced this issue Dec 17, 2021
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.0 milestone Dec 17, 2021
@DanielNoord DanielNoord removed this from the 2.13.0 milestone Jan 11, 2022
jacobtylerwalls added a commit to jacobtylerwalls/pylint that referenced this issue Mar 24, 2022
Pierre-Sassoulas pushed a commit that referenced this issue Mar 25, 2022
… attribute to itself (#5544)

Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
@DanielNoord DanielNoord added this to the 2.14.0 milestone Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 C: undefined-variable Issues related to 'undefined-variable' check
Projects
None yet
4 participants