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

Cannot determine type of "userlist" #11554

Open
Akuli opened this issue Nov 14, 2021 · 1 comment
Open

Cannot determine type of "userlist" #11554

Akuli opened this issue Nov 14, 2021 · 1 comment
Labels
bug mypy got something wrong topic-import-cycles

Comments

@Akuli
Copy link
Contributor

Akuli commented Nov 14, 2021

Bug Report

Unexpected error Cannot determine type of "userlist". Needs a cyclic import to happen.

To Reproduce

foo.py

import bar

class Foo:
    def __init__(self) -> None:
        self.view_selector = object()

bar.py

from foo import Foo

class ServerView:
    def __init__(self) -> None:
        print(ChannelView().userlist)
        self.view_id = str(Foo().view_selector)

class ChannelView:
    def __init__(self) -> None:
        print(ServerView().view_id)
        self.userlist = object()

Expected Behavior

no error, or an error that does not confusingly go away when I delete a seemingly unrelated line of code

Actual Behavior

$ python3 -m mypy foo.py bar.py
bar.py:5: error: Cannot determine type of "userlist"
Found 1 error in 1 file (checked 2 source files)

Your Environment

  • Mypy version used: master (053a1be)
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: doesn't matter, why do you ask?
  • Operating system and version: is a weird question to ask. I am tired of answering this question. But I guess it could be useful in some other issue.
@Akuli Akuli added the bug mypy got something wrong label Nov 14, 2021
@Akuli
Copy link
Contributor Author

Akuli commented Nov 14, 2021

This appears to be a really old bug. It happens on v0.3.1, from 5 years ago, which is the oldest mypy I could get to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-import-cycles
Projects
None yet
Development

No branches or pull requests

2 participants