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

mypy crashes on stgpytools/types/utils.py #1

Closed
DeadNews opened this issue Jan 7, 2024 · 4 comments
Closed

mypy crashes on stgpytools/types/utils.py #1

DeadNews opened this issue Jan 7, 2024 · 4 comments

Comments

@DeadNews
Copy link
Contributor

DeadNews commented Jan 7, 2024

Hi.

mypy crashes on stgpytools v1.0.4, but works fine with stgpytools v1.0.3.

$ poetry run mypy .
/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/stgpytools/types/utils.py:436: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 1.8.0

https://github.com/DeadNews/dnfunc/actions/runs/7232136909/job/19706022244?pr=123#step:7:18


Comparing changes:
v1.0.3...v1.0.4
v1.0.4...master

Maybe you can release a version with these fixes?

@Setsugennoao
Copy link
Owner

Maybe you can release a version with these fixes?

What fixes?

I honestly can't tell what's crashing it and also don't think it's my problem.
Mypy isn't known to be super stable either. 🤔

@DeadNews
Copy link
Contributor Author

DeadNews commented Feb 3, 2024

Thanks for the new version.
It crashes with the new version v1.0.4 against mypy master as well.

show-traceback
$ poetry run mypy . --show-traceback                                                                       
/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/stgpytools/types/utils.py:440: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.9.0+dev.3804f7e320288e625bbedc916a6c26d635bf8e3f
Traceback (most recent call last):
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/__main__.py", line 15, in console_entry
    main()
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/main.py", line 100, in main
    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/main.py", line 182, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/build.py", line 192, in build
    result = _build(
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/build.py", line 266, in _build
    graph = dispatch(sources, manager, stdout)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/build.py", line 2942, in dispatch
    process_graph(graph, manager)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/build.py", line 3340, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/build.py", line 3441, in process_stale_scc
    graph[id].type_check_first_pass()
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/build.py", line 2310, in type_check_first_pass
    self.type_checker().check_first_pass()
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 481, in check_first_pass
    self.accept(d)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 595, in accept
    stmt.accept(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/nodes.py", line 1142, in accept
    return visitor.visit_class_def(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 2313, in visit_class_def
    self.accept(defn.defs)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 595, in accept
    stmt.accept(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/nodes.py", line 1223, in accept
    return visitor.visit_block(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 2775, in visit_block
    self.accept(s)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 595, in accept
    stmt.accept(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/nodes.py", line 787, in accept
    return visitor.visit_func_def(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 1005, in visit_func_def
    self._visit_func_def(defn)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 1009, in _visit_func_def
    self.check_func_item(defn, name=defn.name)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 1082, in check_func_item
    self.check_func_def(defn, typ, name, allow_empty)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 1298, in check_func_def
    self.accept(item.body)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 595, in accept
    stmt.accept(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/nodes.py", line 1223, in accept
    return visitor.visit_block(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 2775, in visit_block
    self.accept(s)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 595, in accept
    stmt.accept(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/nodes.py", line 1310, in accept
    return visitor.visit_assignment_stmt(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 2823, in visit_assignment_stmt
    self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checker.py", line 3031, in check_assignment
    rvalue_type = self.expr_checker.accept(rvalue, type_context=type_context)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checkexpr.py", line 5742, in accept
    typ = node.accept(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/nodes.py", line 2408, in accept
    return visitor.visit_conditional_expr(self)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checkexpr.py", line 5625, in visit_conditional_expr
    if_type = self.analyze_cond_branch(
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checkexpr.py", line 5702, in analyze_cond_branch
    return self.accept(node, type_context=context, allow_none_return=allow_none_return)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checkexpr.py", line 5742, in accept
    typ = node.accept(self)
          ^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/nodes.py", line 1904, in accept
    return visitor.visit_call_expr(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checkexpr.py", line 476, in visit_call_expr
    return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checkexpr.py", line 605, in visit_call_expr_inner
    ret_type = self.check_call_expr_with_callee_type(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checkexpr.py", line 1443, in check_call_expr_with_callee_type
    ret_type, callee_type = self.check_call(
                            ^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checkexpr.py", line 1538, in check_call
    return self.check_callable_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checkexpr.py", line 1723, in check_callable_call
    callee = self.infer_function_type_arguments(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/checkexpr.py", line 2109, in infer_function_type_arguments
    poly_inferred_args, free_vars = infer_function_type_arguments(
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/infer.py", line 62, in infer_function_type_arguments
    return solve_constraints(type_vars, constraints, strict, allow_polymorphic)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/solve.py", line 84, in solve_constraints
    solutions, free_vars = solve_with_dependent(
                           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/solve.py", line 144, in solve_with_dependent
    graph, lowers, uppers = transitive_closure(vars, constraints)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/solve.py", line 455, in transitive_closure
    add_secondary_constraints(remaining, c.target, ut)
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/solve.py", line 469, in add_secondary_constraints
    cs.update(set(infer_constraints(lower, upper, SUBTYPE_OF)))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/constraints.py", line 314, in infer_constraints
    return _infer_constraints(template, actual, direction, skip_neg_op)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/constraints.py", line 407, in _infer_constraints
    return template.accept(ConstraintBuilderVisitor(actual, direction, skip_neg_op))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/types.py", line 1721, in accept
    return visitor.visit_parameters(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/mypy/constraints.py", line 698, in visit_parameters
    raise RuntimeError("Parameters cannot be constrained to")
RuntimeError: Parameters cannot be constrained to
/home/deadnews/.cache/pypoetry/virtualenvs/dnfunc-CKz_p_SV-py3.11/lib/python3.11/site-packages/stgpytools/types/utils.py:440: : note: use --pdb to drop into pdb

I honestly can't tell what's crashing it and also don't think it's my problem.

I don't know, considering that type: ignore occurs 62 times in this file.

I might suggest ignoring a few more: #2
After this:

$ poetry run mypy . --show-traceback                                                                        
Success: no issues found in 4 source files

Setsugennoao pushed a commit that referenced this issue Feb 4, 2024
ref: `mypy` crashes on `stgpytools/types/utils.py` #1
@Setsugennoao
Copy link
Owner

Merged #1

@DeadNews
Copy link
Contributor Author

@Setsugennoao
Maybe you can release a version with these fixes?

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