Skip to content

kwargs expension with Mapping raise AttributeError: 'NoneType' object has no attribute 'get_line' #1564

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

Closed
tharvik opened this issue May 23, 2016 · 0 comments · Fixed by #1583
Labels

Comments

@tharvik
Copy link
Contributor

tharvik commented May 23, 2016

from typing import Mapping

a = {}  # type: Mapping
dict(**a)

raise

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.4/mypy", line 6, in <module>
    main(__file__)
  File "/usr/lib64/python3.4/site-packages/mypy/main.py", line 54, in main
    res = type_check_only(sources, bin_dir, options)
  File "/usr/lib64/python3.4/site-packages/mypy/main.py", line 102, in type_check_only
    python_path=options.python_path)
  File "/usr/lib64/python3.4/site-packages/mypy/build.py", line 209, in build
    dispatch(sources, manager)
  File "/usr/lib64/python3.4/site-packages/mypy/build.py", line 1325, in dispatch
    process_graph(graph, manager)
  File "/usr/lib64/python3.4/site-packages/mypy/build.py", line 1456, in process_graph
    process_stale_scc(graph, scc)
  File "/usr/lib64/python3.4/site-packages/mypy/build.py", line 1486, in process_stale_scc
    graph[id].type_check()
  File "/usr/lib64/python3.4/site-packages/mypy/build.py", line 1305, in type_check
    manager.type_checker.visit_file(self.tree, self.xpath)
  File "/usr/lib64/python3.4/site-packages/mypy/checker.py", line 424, in visit_file
    self.accept(d)
  File "/usr/lib64/python3.4/site-packages/mypy/checker.py", line 465, in accept
    typ = node.accept(self)
  File "/usr/lib64/python3.4/site-packages/mypy/nodes.py", line 729, in accept
    return visitor.visit_expression_stmt(self)
  File "/usr/lib64/python3.4/site-packages/mypy/checker.py", line 1570, in visit_expression_stmt
    self.accept(s.expr)
  File "/usr/lib64/python3.4/site-packages/mypy/checker.py", line 465, in accept
    typ = node.accept(self)
  File "/usr/lib64/python3.4/site-packages/mypy/nodes.py", line 1185, in accept
    return visitor.visit_call_expr(self)
  File "/usr/lib64/python3.4/site-packages/mypy/checker.py", line 1997, in visit_call_expr
    return self.expr_checker.visit_call_expr(e)
  File "/usr/lib64/python3.4/site-packages/mypy/checkexpr.py", line 141, in visit_call_expr
    return self.check_call_expr_with_callee_type(callee_type, e)
  File "/usr/lib64/python3.4/site-packages/mypy/checkexpr.py", line 192, in check_call_expr_with_callee_type
    e.arg_names, callable_node=e.callee)[0]
  File "/usr/lib64/python3.4/site-packages/mypy/checkexpr.py", line 257, in check_call
    messages=arg_messages)
  File "/usr/lib64/python3.4/site-packages/mypy/checkexpr.py", line 666, in overload_call_target
    typ)
  File "/usr/lib64/python3.4/site-packages/mypy/checkexpr.py", line 742, in erased_signature_similarity
    None, check_arg=check_arg)
  File "/usr/lib64/python3.4/site-packages/mypy/checkexpr.py", line 614, in check_argument_types
    messages.invalid_keyword_var_arg(arg_type, context)
  File "/usr/lib64/python3.4/site-packages/mypy/messages.py", line 687, in invalid_keyword_var_arg
    context)
  File "/usr/lib64/python3.4/site-packages/mypy/messages.py", line 147, in fail
    self.report(msg, context, 'error', file=file)
  File "/usr/lib64/python3.4/site-packages/mypy/messages.py", line 143, in report
    self.errors.report(context.get_line(), msg.strip(), severity=severity, file=file)
AttributeError: 'NoneType' object has no attribute 'get_line'

but using

from typing import Dict

a = {}  # type: Dict
dict(**a)

does nothing, it seems to be specific to Mapping or MutableMapping.

gvanrossum pushed a commit that referenced this issue May 26, 2016
gvanrossum pushed a commit that referenced this issue May 26, 2016
gvanrossum added a commit that referenced this issue May 26, 2016
gvanrossum added a commit that referenced this issue May 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants