Skip to content

Member is not assignable error when accessing a module member #5439

Closed
@gilbsgilbs

Description

@gilbsgilbs

Hi,

This issue seems close to the one that was fixed in this PR.

  • Are you reporting a bug, or opening a feature request?

I'm reporting a bug.

  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate
    if you try to simplify your case to a minimal repro.
import functools

class Foo:
    bar = functools

foo = Foo()
foo.bar  # error: Member "bar" is not assignable
  • What is the actual behavior/output?
test.py:7: error: Member "bar" is not assignable
  • What is the behavior/output you expect?

No Error. I'm just accessing, not mutating.

  • What are the versions of mypy and Python you are using?
    Do you see the same issue after installing mypy from Git master?
$ mypy --version
mypy 0.620

Same error on master.

  • What are the mypy flags you are using? (For example --strict-optional)

No flags. Just raw mypy test.py

If you need any further information, please let me know.
Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions