Skip to content

undefined-variable when using class attribute in listcomp in decorator #511

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

Closed
pylint-bot opened this issue Apr 5, 2015 · 3 comments · Fixed by #3497
Closed

undefined-variable when using class attribute in listcomp in decorator #511

pylint-bot opened this issue Apr 5, 2015 · 3 comments · Fixed by #3497
Labels
Astroid Related to astroid Bug 🪲

Comments

@pylint-bot
Copy link

Originally reported by: Florian Bruhin (BitBucket: The-Compiler, GitHub: @The-Compiler?)


With this example code:

#!python

def dec(inp):
    def inner(func):
        print(inp)
        return func
    return inner


class Cls:

    DATA = "foo"

    @dec([x for x in DATA])
    def fun(self):
        pass

I get E: 12,21: Undefined variable 'DATA' (undefined-variable) even though the code is working fine.

pylint 1.4.3,
astroid 1.3.6, common 0.63.2


@pylint-bot
Copy link
Author

Original comment by Florian Bruhin (BitBucket: The-Compiler, GitHub: @The-Compiler?):


This seems very similiar to #342 which was fixed in dc161ec8c308 - but it seems this one is still present.

@pylint-bot
Copy link
Author

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Working on it ;-)

@pylint-bot
Copy link
Author

Original comment by Florian Bruhin (BitBucket: The-Compiler, GitHub: @The-Compiler?):


Awesome, thank you!

@pylint-bot pylint-bot added Bug 🪲 Astroid Related to astroid labels Dec 9, 2015
anjsimmo added a commit to anjsimmo/pylint that referenced this issue Apr 20, 2020
PCManticore pushed a commit that referenced this issue Apr 22, 2020
msuozzo pushed a commit to msuozzo/pylint that referenced this issue Feb 18, 2022
* chore: use gapic-generator-python 0.58.4

fix: provide appropriate mock values for message body fields

committer: dovs
PiperOrigin-RevId: 419025932

Source-Link: googleapis/googleapis@73da669

Source-Link: https://github.com/googleapis/googleapis-gen/commit/46df624a54b9ed47c1a7eefb7a49413cf7b82f98
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Astroid Related to astroid Bug 🪲
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant