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

AssertionError: Var(forward) in check_method_override_for_base_with_name #9321

Closed
zasdfgbnm opened this issue Aug 17, 2020 · 1 comment
Closed

Comments

@zasdfgbnm
Copy link

zasdfgbnm commented Aug 17, 2020

This happens when I replace the with_metaclass from six with metaclass=.

I am sorry that I don't have a minimum repro(but please let me know if you need help on reproducing with the method below).

To reproduce, clone pytorch/pytorch#42199 and run

mypy torch/jit/quantized.py --show-traceback

I believe the error is cause by this line:
https://github.com/pytorch/pytorch/pull/42199/files#diff-e8275ad00ce28cc930d6c736043ad876R264

And you will see:

torch/jit/quantized.py:171: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.790+dev.3b57105ef75d8f8f479e1617c035320b80b1bcfa.dirty
torch/jit/quantized.py:171: : note: use --pdb to drop into pdb
Var(forward) <class 'mypy.nodes.Var'>
Traceback (most recent call last):
  File "/home/gaoxiang/.local/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/__main__.py", line 8, in console_entry
    main(None, sys.stdout, sys.stderr)
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/main.py", line 90, in main
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/build.py", line 180, in build
    result = _build(
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/build.py", line 254, in _build
    graph = dispatch(sources, manager, stdout)
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/build.py", line 2630, in dispatch
    process_graph(graph, manager)
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/build.py", line 2953, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/build.py", line 3060, in process_stale_scc
    if not graph[id].type_check_second_pass():
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/build.py", line 2128, in type_check_second_pass
    return self.type_checker().check_second_pass()
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/checker.py", line 344, in check_second_pass
    self.check_partial(node)
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/checker.py", line 356, in check_partial
    self.accept(node)
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/checker.py", line 401, in accept
    stmt.accept(self)
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/nodes.py", line 767, in accept
    return visitor.visit_decorator(self)
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/checker.py", line 3594, in visit_decorator
    self.check_method_override(e)
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/checker.py", line 1421, in check_method_override
    if self.check_method_or_accessor_override_for_base(defn, base):
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/checker.py", line 1449, in check_method_or_accessor_override_for_base
    if self.check_method_override_for_base_with_name(defn, name, base):
  File "/home/gaoxiang/.local/lib/python3.8/site-packages/mypy/checker.py", line 1511, in check_method_override_for_base_with_name
    assert False, str(base_attr.node)
AssertionError: Var(forward)

@ilevkivskyi
Copy link
Member

Most likely this is a duplicate of #5425

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants