Skip to content

Returns mypy plugin crashes with mypy 1.16 #2148

Open
@Jazzinghen

Description

@Jazzinghen

Bug report

What's wrong

When using Return's plugin mypy crashes with the following error:

$ uv run mypy --show-traceback -p data_manager
hidden_path/.venv/lib/python3.13/site-packages/returns/primitives/hkt.py:87: 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.16.0
Traceback (most recent call last):
  File "mypy/checker.py", line 577, in accept
  File "mypy/nodes.py", line 1396, in accept
  File "mypy/checker.py", line 3079, in visit_assignment_stmt
  File "mypy/checker.py", line 3306, in check_assignment
  File "mypy/checker.py", line 3432, in check_compatibility_all_supers
  File "mypy/checker.py", line 3578, in node_type_from_base
  File "mypy/checkmember.py", line 378, in analyze_instance_member_access
  File "mypy/checkmember.py", line 564, in analyze_member_var_access
  File "mypy/checkmember.py", line 935, in analyze_var
  File "hidden_path/.venv/lib/python3.13/site-packages/returns/contrib/mypy/_typeops/fallback.py", line 25, in decorator
    return function(*args, **kwargs)
  File "hidden_path/.venv/lib/python3.13/site-packages/returns/contrib/mypy/_features/kind.py", line 65, in attribute_access
    return analyze_member_access(
        ctx.context.name,  # type: ignore
    ...<8 lines>...
        in_literal_context=exprchecker.is_literal_context(),
    )
TypeError: 'msg' is an invalid keyword argument for analyze_member_access()
hidden_path/.venv/lib/python3.13/site-packages/returns/primitives/hkt.py:87: : note: use --pdb to drop into pdb

It seems like Mypy 1.16.0 has deprecated passing msg to the analyze_member_access function: python/mypy#18818

How is that should be

Mypy should run without crashing when using Returns' plugin

System information

  • python version: 1.13.0
  • returns version: 0.25.0
  • mypy version: 1.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions