Skip to content

NotImplementedError in map_actuals_to_formals #1553

Closed
@The-Compiler

Description

@The-Compiler

When I run mypy (0.4 or git master with Python 3.5) with --check-untyped-defs over qutebrowser, I get:

Traceback (most recent call last):
  File "./.tox/mypy/bin/mypy", line 6, in <module>
    main(__file__)
  File ".../mypy/main.py", line 54, in main
    res = type_check_only(sources, bin_dir, options)
  File ".../mypy/main.py", line 102, in type_check_only
    python_path=options.python_path)
  File ".../mypy/build.py", line 209, in build
    dispatch(sources, manager)
  File ".../mypy/build.py", line 1321, in dispatch
    process_graph(graph, manager)
  File ".../mypy/build.py", line 1452, in process_graph
    process_stale_scc(graph, scc)
  File ".../mypy/build.py", line 1482, in process_stale_scc
    graph[id].type_check()
  File ".../mypy/build.py", line 1301, in type_check
    manager.type_checker.visit_file(self.tree, self.xpath)
  File ".../mypy/checker.py", line 419, in visit_file
    self.accept(d)
  File ".../mypy/checker.py", line 460, in accept
    typ = node.accept(self)
  File ".../mypy/nodes.py", line 650, in accept
    return visitor.visit_class_def(self)
  File ".../mypy/checker.py", line 1049, in visit_class_def
    self.accept(defn.defs)
  File ".../mypy/checker.py", line 460, in accept
    typ = node.accept(self)
  File ".../mypy/nodes.py", line 715, in accept
    return visitor.visit_block(self)
  File ".../mypy/checker.py", line 1144, in visit_block
    self.accept(s)
  File ".../mypy/checker.py", line 460, in accept
    typ = node.accept(self)
  File ".../mypy/nodes.py", line 531, in accept
    return visitor.visit_decorator(self)
  File ".../mypy/checker.py", line 1934, in visit_decorator
    e.func.accept(self)
  File ".../mypy/nodes.py", line 462, in accept
    return visitor.visit_func_def(self)
  File ".../mypy/checker.py", line 573, in visit_func_def
    self.check_func_item(defn, name=defn.name())
  File ".../mypy/checker.py", line 631, in check_func_item
    self.check_func_def(defn, typ, name)
  File ".../mypy/checker.py", line 739, in check_func_def
    self.accept_in_frame(item.body)
  File ".../mypy/checker.py", line 475, in accept_in_frame
    answer = self.accept(node, type_context)
  File ".../mypy/checker.py", line 460, in accept
    typ = node.accept(self)
  File ".../mypy/nodes.py", line 715, in accept
    return visitor.visit_block(self)
  File ".../mypy/checker.py", line 1144, in visit_block
    self.accept(s)
  File ".../mypy/checker.py", line 460, in accept
    typ = node.accept(self)
  File ".../mypy/nodes.py", line 753, in accept
    return visitor.visit_assignment_stmt(self)
  File ".../mypy/checker.py", line 1153, in visit_assignment_stmt
    self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None)
  File ".../mypy/checker.py", line 1203, in check_assignment
    self.infer_variable_type(inferred, lvalue, self.accept(rvalue),
  File ".../mypy/checker.py", line 460, in accept
    typ = node.accept(self)
  File ".../mypy/nodes.py", line 1185, in accept
    return visitor.visit_call_expr(self)
  File ".../mypy/checker.py", line 1992, in visit_call_expr
    return self.expr_checker.visit_call_expr(e)
  File ".../mypy/checkexpr.py", line 141, in visit_call_expr
    return self.check_call_expr_with_callee_type(callee_type, e)
  File ".../mypy/checkexpr.py", line 192, in check_call_expr_with_callee_type
    e.arg_names, callable_node=e.callee)[0]
  File ".../mypy/checkexpr.py", line 226, in check_call
    lambda i: self.accept(args[i]))
  File ".../mypy/checkexpr.py", line 1570, in map_actuals_to_formals
    raise NotImplementedError()
NotImplementedError: 

*** INTERNAL ERROR ***

qutebrowser/browser/webpage.py:344: error: Internal error -- please report a bug at https://github.com/python/mypy/issues

I wasn't able to construct a minimal example which fails in the same way, but it fails on this line:

    @pyqtSlot('QWebFrame*', 'QWebPage::Feature')
    def on_feature_permission_requested(self, frame, feature):
        """Ask the user for approval for geolocation/notifications."""
        options = {
            QWebPage.Notifications: ('content', 'notifications'),
            QWebPage.Geolocation: ('content', 'geolocation'),
        }
        config_val = config.get(*options[feature])  # <-----
        # [...]

Some interesting locals from a --pdb session:

>>> argt.items
[builtins.str, builtins.str]
>>> j
1
>>> ncallee
2
>>> callee_kinds
[2, 4]

Seems like the 4 for the current argument (j=1) is nodes.UNBOUND_TVAR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions