Skip to content

Invalid undefined-variable error for metaclass value in Python 3.5 #1603

Closed
@mitar

Description

@mitar

Steps to reproduce

  1. Create two files in a module. foo.py:
def fun():
    pass

Metaclass = fun()

test.py:

from . import foo


class Foo(metaclass=foo.Metaclass):
    pass
  1. Run pylint on test.py.

Current behavior

Two relevant errors are returned:

E:  4, 0: Undefined variable 'foo.Metaclass' (undefined-variable)
W:  1, 0: Unused import foo (unused-import)

Expected behavior

No error is returned about undefined variable foo.Metaclass or unused import.

pylint --version output

No config file found, using default configuration
pylint 1.7.2, 
astroid 1.5.3
Python 3.5.2 (default, Oct 11 2016, 05:00:16) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs reproduction 🔍Need a way to reproduce it locally on a maintainer's machine

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions