Skip to content

Internal error when using Python3.5 PEP 448 tuple unpacking with printf style formatting #2794

Closed
@IanChew

Description

@IanChew

I managed to isolate the error to the following:

x = (1,2)
"%d%d" % (*x,)

This produces an INTERNAL ERROR with the following traceback:

Traceback (most recent call last):
  File "/usr/local/bin/mypy", line 6, in <module>
    main(__file__)
  File "/usr/local/lib/python3.6/site-packages/mypy/main.py", line 42, in main
    res = type_check_only(sources, bin_dir, options)
  File "/usr/local/lib/python3.6/site-packages/mypy/main.py", line 87, in type_check_only
    options=options)
  File "/usr/local/lib/python3.6/site-packages/mypy/build.py", line 183, in build
    dispatch(sources, manager)
  File "/usr/local/lib/python3.6/site-packages/mypy/build.py", line 1526, in dispatch
    process_graph(graph, manager)
  File "/usr/local/lib/python3.6/site-packages/mypy/build.py", line 1762, in process_graph
    process_stale_scc(graph, scc)
  File "/usr/local/lib/python3.6/site-packages/mypy/build.py", line 1841, in process_stale_scc
    graph[id].type_check_first_pass()
  File "/usr/local/lib/python3.6/site-packages/mypy/build.py", line 1451, in type_check_first_pass
    self.type_checker.check_first_pass()
  File "/usr/local/lib/python3.6/site-packages/mypy/checker.py", line 175, in check_first_pass
    self.accept(d)
  File "/usr/local/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
    typ = node.accept(self)
  File "/usr/local/lib/python3.6/site-packages/mypy/nodes.py", line 788, in accept
    return visitor.visit_expression_stmt(self)
  File "/usr/local/lib/python3.6/site-packages/mypy/checker.py", line 1596, in visit_expression_stmt
    self.accept(s.expr)
  File "/usr/local/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
    typ = node.accept(self)
  File "/usr/local/lib/python3.6/site-packages/mypy/nodes.py", line 1400, in accept
    return visitor.visit_op_expr(self)
  File "/usr/local/lib/python3.6/site-packages/mypy/checker.py", line 2160, in visit_op_expr
    return self.expr_checker.visit_op_expr(e)
  File "/usr/local/lib/python3.6/site-packages/mypy/checkexpr.py", line 1110, in visit_op_expr
    return self.strfrm_checker.check_str_interpolation(e.left, e.right)
  File "/usr/local/lib/python3.6/site-packages/mypy/checkstrformat.py", line 74, in check_str_interpolation
    self.check_simple_str_interpolation(specifiers, replacements)
  File "/usr/local/lib/python3.6/site-packages/mypy/checkstrformat.py", line 146, in check_simple_str_interpolation
    check_node(rep_node)
  File "/usr/local/lib/python3.6/site-packages/mypy/checkstrformat.py", line 255, in check_expr
    check_type(type)
  File "/usr/local/lib/python3.6/site-packages/mypy/checkstrformat.py", line 251, in check_type
    'expression has type', 'placeholder has type')
  File "/usr/local/lib/python3.6/site-packages/mypy/checker.py", line 2273, in check_subtype
    if is_subtype(subtype, supertype):
  File "/usr/local/lib/python3.6/site-packages/mypy/subtypes.py", line 54, in is_subtype
    for item in right.items)
  File "/usr/local/lib/python3.6/site-packages/mypy/subtypes.py", line 54, in <genexpr>
    for item in right.items)
  File "/usr/local/lib/python3.6/site-packages/mypy/subtypes.py", line 56, in is_subtype
    return left.accept(SubtypeVisitor(right, type_parameter_checker,
AttributeError: 'NoneType' object has no attribute 'accept'

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions