Skip to content

undefined-variable regression since 2.6.0 #7720

Open

Description

Bug description

Since 2.6.0 pylint reports a false positive undefined-variable warning when local decorators are used for a class inside a class.

from myconverter import Converter


class MyContainer:
    CONVERTER = Converter()

    @CONVERTER.register()
    class NamedArray:
        def __init__(self, *args, **kwargs):
            pass

Configuration

No response

Command used

pylint --disable all --enable undefined-variable pylint_issue.py

Pylint output

************* Module pylint_issue_py311
pylint_issue.py:7:5: E0602: Undefined variable 'CONVERTER' (undefined-variable)

-------------------------------------------------------------------
Your code has been rated at 1.67/10 (previous run: 10.00/10, -8.33)

Expected behavior

No undefined-variable warning

Pylint version

pylint --version                                                                                                                                                                        
pylint 2.6.0
astroid 2.5
Python 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:36:39) [GCC 10.4.0]

(but also can be reproduced with the latest version)

OS / Environment

ubuntu 22.04

Additional dependencies

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions